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
|
|
|
|
|
{
|
2015-03-26 19:36:18 +00:00
|
|
|
|
public partial class SettingsForm : ThemedForms
|
2014-04-25 21:55:43 +00:00
|
|
|
|
{
|
2015-03-26 19:36:18 +00:00
|
|
|
|
public static bool ApplyingSettings = false;
|
2014-04-25 21:55:43 +00:00
|
|
|
|
public SettingsForm()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2014-07-23 22:44:20 +00:00
|
|
|
|
listView1.Columns[0].Width = listView1.Width;
|
2014-10-24 17:02:38 +00:00
|
|
|
|
this.Text = Language.Translate("settings");
|
2015-03-26 19:36:18 +00:00
|
|
|
|
//Language.Translate(this, "settings");
|
|
|
|
|
|
2014-10-24 17:02:38 +00:00
|
|
|
|
glacialList1.Items[0].Text = Language.Translate("settings_personal");
|
|
|
|
|
personal.Text = Language.Translate("settings_personal");
|
2015-03-26 19:36:18 +00:00
|
|
|
|
glacialList1.Items[1].Text = Language.Translate("settings_layout");
|
|
|
|
|
|
|
|
|
|
layout.Text = Language.Translate("settings_layout"); //2014.10.28.
|
2014-10-24 17:02:38 +00:00
|
|
|
|
label1.Text = Language.Translate("name");
|
|
|
|
|
label2.Text = Language.Translate("message");
|
|
|
|
|
label3.Text = Language.Translate("language");
|
2015-03-26 19:36:18 +00:00
|
|
|
|
chatwindow.Text = Language.Translate("settings_chatwindow"); //2014.10.28.
|
|
|
|
|
chatwindowTabs.Text = Language.Translate("settings_chatwindowTabs"); //2014.10.28.
|
|
|
|
|
//isserver.Text = Language.Translate("settings_isserver"); //2014.11.15.
|
|
|
|
|
|
2014-04-25 21:55:43 +00:00
|
|
|
|
nameText.Text = CurrentUser.Name;
|
|
|
|
|
messageText.Text = CurrentUser.Message;
|
2015-03-26 19:36:18 +00:00
|
|
|
|
chatwindow.Checked = (Storage.Settings["chatwindow"] == "1"); //2014.10.28.
|
|
|
|
|
//isserver.Checked = (Storage.Settings["isserver"] == "1"); //2014.11.15.
|
|
|
|
|
isserver.Enabled = false; //2015.01.12.
|
2014-07-23 22:44:20 +00:00
|
|
|
|
|
2015-03-26 19:36:18 +00:00
|
|
|
|
foreach (var entry in Language.UsedLangs)
|
2014-07-23 22:44:20 +00:00
|
|
|
|
{
|
|
|
|
|
listView1.Items.Add(Language.UsedLangs[entry.Key].Strings["currentlang"], Language.UsedLangs[entry.Key].Strings["currentlang"], 0);
|
2015-03-26 19:36:18 +00:00
|
|
|
|
if (Language.UsedLangs[entry.Key].Equals(Language.GetCurrentLanguage()))
|
2014-07-23 22:44:20 +00:00
|
|
|
|
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;
|
2015-03-26 19:36:18 +00:00
|
|
|
|
case 1:
|
|
|
|
|
//Kinézet
|
|
|
|
|
panel1.ScrollControlIntoView(layout);
|
|
|
|
|
break;
|
2014-04-25 21:55:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void okbtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-03-26 19:36:18 +00:00
|
|
|
|
ApplyingSettings = true;
|
|
|
|
|
CurrentUser.Name = nameText.Text;
|
|
|
|
|
CurrentUser.Message = messageText.Text;
|
|
|
|
|
bool reopen = false;
|
|
|
|
|
if (chatwindow.Checked && Storage.Settings["chatwindow"] == "0")
|
|
|
|
|
{
|
|
|
|
|
reopen = true;
|
|
|
|
|
Storage.Settings["chatwindow"] = "1";
|
|
|
|
|
}
|
|
|
|
|
else if (!chatwindow.Checked && Storage.Settings["chatwindow"] == "1")
|
|
|
|
|
{
|
|
|
|
|
reopen = true;
|
|
|
|
|
Storage.Settings["chatwindow"] = "0";
|
|
|
|
|
}
|
|
|
|
|
//Storage.Settings["isserver"] = isserver.Checked ? "1" : "0"; //2014.11.15.
|
2014-10-24 17:02:38 +00:00
|
|
|
|
string lang = "en";
|
2015-03-26 19:36:18 +00:00
|
|
|
|
if(listView1.SelectedItems.Count!=0) //2014.10.28. - Eddig valószínűleg hiba történt a SelectedItems[0]-nál
|
2014-10-24 17:02:38 +00:00
|
|
|
|
{
|
2015-03-26 19:36:18 +00:00
|
|
|
|
foreach (var lng in Language.UsedLangs)
|
2014-07-23 22:44:20 +00:00
|
|
|
|
{
|
2015-03-26 19:36:18 +00:00
|
|
|
|
if (lng.Value.Strings.ContainsKey("currentlang") && listView1.SelectedItems[0].Text == lng.Value.Strings["currentlang"])
|
|
|
|
|
{
|
|
|
|
|
lang = lng.Key;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (Storage.Settings["lang"] != lang)
|
|
|
|
|
{
|
|
|
|
|
Storage.Settings["lang"] = lang;
|
|
|
|
|
//MessageBox.Show(Language.Translate("restart_needed"));
|
|
|
|
|
//Program.Restart(true);
|
|
|
|
|
Language.ReloadLangs();
|
2014-07-23 22:44:20 +00:00
|
|
|
|
}
|
2014-10-24 17:02:38 +00:00
|
|
|
|
}
|
2015-03-26 19:36:18 +00:00
|
|
|
|
if (reopen)
|
|
|
|
|
ChatPanel.ReopenChatWindows(true);
|
|
|
|
|
ApplyingSettings = false;
|
2014-10-24 17:02:38 +00:00
|
|
|
|
this.Close();
|
2014-04-25 21:55:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cancelbtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
2015-03-26 19:36:18 +00:00
|
|
|
|
|
|
|
|
|
private void SettingsForm_FormClosed(object sender, FormClosedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Program.SettingsF = null;
|
|
|
|
|
}
|
2014-04-25 21:55:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|