2014-04-25 21:55:43 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace MSGer.tk
|
|
|
|
|
{
|
|
|
|
|
public partial class SettingsForm : Form
|
|
|
|
|
{
|
|
|
|
|
public SettingsForm()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2014-07-23 22:44:20 +00:00
|
|
|
|
listView1.Columns[0].Width = listView1.Width;
|
2014-04-25 21:55:43 +00:00
|
|
|
|
this.Text = Language.GetCuurentLanguage().Strings["settings"];
|
2014-07-27 08:28:59 +00:00
|
|
|
|
glacialList1.Items[0].Text = Language.GetCuurentLanguage().Strings["settings_personal"];
|
|
|
|
|
personal.Text = Language.GetCuurentLanguage().Strings["settings_personal"];
|
2014-07-23 22:44:20 +00:00
|
|
|
|
label1.Text = Language.GetCuurentLanguage().Strings["name"];
|
|
|
|
|
label2.Text = Language.GetCuurentLanguage().Strings["message"];
|
|
|
|
|
label3.Text = Language.GetCuurentLanguage().Strings["language"];
|
2014-04-25 21:55:43 +00:00
|
|
|
|
nameText.Text = CurrentUser.Name;
|
|
|
|
|
messageText.Text = CurrentUser.Message;
|
2014-07-23 22:44:20 +00:00
|
|
|
|
|
|
|
|
|
foreach(var entry in Language.UsedLangs)
|
|
|
|
|
{
|
|
|
|
|
listView1.Items.Add(Language.UsedLangs[entry.Key].Strings["currentlang"], Language.UsedLangs[entry.Key].Strings["currentlang"], 0);
|
|
|
|
|
if (Language.UsedLangs[entry.Key].Equals(Language.GetCuurentLanguage()))
|
|
|
|
|
listView1.Items[listView1.Items.Count - 1].Selected = true;
|
|
|
|
|
}
|
2014-04-25 21:55:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void glacialList1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int tmp = glacialList1.HotItemIndex;
|
|
|
|
|
if (tmp > glacialList1.Items.Count)
|
|
|
|
|
return;
|
|
|
|
|
switch(tmp)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
//Személyes
|
|
|
|
|
panel1.ScrollControlIntoView(personal);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void okbtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-07-23 22:44:20 +00:00
|
|
|
|
string lang="en";
|
|
|
|
|
foreach (var lng in Language.UsedLangs)
|
|
|
|
|
{
|
|
|
|
|
if(listView1.SelectedItems[0].Text==lng.Value.Strings["currentlang"])
|
|
|
|
|
{
|
|
|
|
|
lang = lng.Key;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-04-25 21:55:43 +00:00
|
|
|
|
string result = Networking.SendRequest("updatesettings", nameText.Text + "ͦ" + messageText.Text, 0, true);
|
|
|
|
|
if (result != "Success")
|
|
|
|
|
MessageBox.Show(Language.GetCuurentLanguage().Strings["error"] + ": " + result);
|
|
|
|
|
else
|
2014-07-23 22:44:20 +00:00
|
|
|
|
{
|
|
|
|
|
if (Settings.Default.lang != lang)
|
|
|
|
|
{
|
|
|
|
|
Settings.Default.lang = lang;
|
|
|
|
|
Settings.Default.Save();
|
|
|
|
|
MessageBox.Show(Language.GetCuurentLanguage().Strings["restart_needed"]);
|
|
|
|
|
System.Diagnostics.Process.Start("msger.tk.exe");
|
|
|
|
|
Environment.Exit(0);
|
|
|
|
|
}
|
2014-04-25 21:55:43 +00:00
|
|
|
|
this.Close();
|
2014-07-23 22:44:20 +00:00
|
|
|
|
}
|
2014-04-25 21:55:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cancelbtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|