- base mechanism for changing locale;

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@80 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Pavel Petroshenko 2008-05-18 13:40:19 +00:00
parent 6af4a0948e
commit 1fb4f5ceba
7 changed files with 91 additions and 5 deletions

View File

@ -5,6 +5,7 @@ using System.Drawing;
using System.Data; using System.Data;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Resources;
namespace webImTray { namespace webImTray {
public partial class About : UserControl, OptionsPanel { public partial class About : UserControl, OptionsPanel {
@ -24,8 +25,6 @@ namespace webImTray {
return "About"; return "About";
} }
public event ModifiedEvent PanelModified;
#endregion #endregion
private void i_services_ru_link(object sender, LinkLabelLinkClickedEventArgs e) { private void i_services_ru_link(object sender, LinkLabelLinkClickedEventArgs e) {
@ -35,5 +34,10 @@ namespace webImTray {
private void webim_ru_link(object sender, LinkLabelLinkClickedEventArgs e) { private void webim_ru_link(object sender, LinkLabelLinkClickedEventArgs e) {
System.Diagnostics.Process.Start("http://webim.ru/"); System.Diagnostics.Process.Start("http://webim.ru/");
} }
public event ModifiedEvent PanelModified;
public void updateUI(ResourceManager resManager) {
}
} }
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Resources;
namespace webImTray { namespace webImTray {
@ -10,6 +11,7 @@ namespace webImTray {
void initialize(); void initialize();
void apply(); void apply();
string getDescription(); string getDescription();
void updateUI(ResourceManager resManager);
event ModifiedEvent PanelModified; event ModifiedEvent PanelModified;
} }

View File

@ -5,6 +5,7 @@ using System.Drawing;
using System.Data; using System.Data;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Resources;
namespace webImTray { namespace webImTray {
public partial class OptionsConnectionPanel : UserControl, OptionsPanel { public partial class OptionsConnectionPanel : UserControl, OptionsPanel {
@ -67,5 +68,8 @@ namespace webImTray {
modified = true; modified = true;
PanelModified.Invoke(); PanelModified.Invoke();
} }
public void updateUI(ResourceManager resManager) {
}
} }
} }

View File

@ -5,11 +5,13 @@ using System.Data;
using System.Drawing; using System.Drawing;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Resources;
using System.Globalization;
namespace webImTray { namespace webImTray {
public partial class OptionsDialog : Form { public partial class OptionsDialog : Form {
OptionsPanel[] panels = new OptionsPanel[] { static OptionsPanel[] panels = new OptionsPanel[] {
new OptionsGeneralPanel(), new OptionsGeneralPanel(),
new OptionsConnectionPanel(), new OptionsConnectionPanel(),
new OptionsSoundsPanel(), new OptionsSoundsPanel(),
@ -18,6 +20,10 @@ namespace webImTray {
OptionsPanel currentPanel = null; OptionsPanel currentPanel = null;
private static ResourceManager resourceManager = new ResourceManager("webImTray.webImTray", System.Reflection.Assembly.GetExecutingAssembly());
private static CultureInfo englishCulture = new CultureInfo("en-US");
private static CultureInfo russianCulture = new CultureInfo("ru-RU");
public OptionsDialog() { public OptionsDialog() {
InitializeComponent(); InitializeComponent();
} }
@ -91,5 +97,11 @@ namespace webImTray {
applyChanges(); applyChanges();
apply.Enabled = false; apply.Enabled = false;
} }
public static void updateUI() {
for (int i = 0; i < 4; i++) {
((OptionsPanel)panels[i]).updateUI(resourceManager);
}
}
} }
} }

View File

@ -1,3 +1,5 @@
using System;
namespace webImTray { namespace webImTray {
partial class OptionsGeneralPanel { partial class OptionsGeneralPanel {
/// <summary> /// <summary>
@ -32,8 +34,12 @@ namespace webImTray {
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.showOptions = new System.Windows.Forms.CheckBox(); this.showOptions = new System.Windows.Forms.CheckBox();
this.showHide = new System.Windows.Forms.CheckBox(); this.showHide = new System.Windows.Forms.CheckBox();
this.languageBox = new System.Windows.Forms.GroupBox();
this.radioRussian = new System.Windows.Forms.RadioButton();
this.radioEnglish = new System.Windows.Forms.RadioButton();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.languageBox.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
@ -145,10 +151,48 @@ namespace webImTray {
this.showHide.UseVisualStyleBackColor = true; this.showHide.UseVisualStyleBackColor = true;
this.showHide.CheckedChanged += new System.EventHandler(this.checkboxChanged); this.showHide.CheckedChanged += new System.EventHandler(this.checkboxChanged);
// //
// languageBox
//
this.languageBox.Controls.Add(this.radioRussian);
this.languageBox.Controls.Add(this.radioEnglish);
this.languageBox.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold);
this.languageBox.Location = new System.Drawing.Point(3, 210);
this.languageBox.Name = "languageBox";
this.languageBox.Size = new System.Drawing.Size(371, 53);
this.languageBox.TabIndex = 2;
this.languageBox.TabStop = false;
this.languageBox.Text = "Language";
//
// radioRussian
//
this.radioRussian.AutoSize = true;
this.radioRussian.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.radioRussian.Location = new System.Drawing.Point(80, 30);
this.radioRussian.Name = "radioRussian";
this.radioRussian.Size = new System.Drawing.Size(63, 17);
this.radioRussian.TabIndex = 1;
this.radioRussian.TabStop = true;
this.radioRussian.Text = "Russian";
this.radioRussian.UseVisualStyleBackColor = true;
//
// radioEnglish
//
this.radioEnglish.AutoSize = true;
this.radioEnglish.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.radioEnglish.Location = new System.Drawing.Point(15, 30);
this.radioEnglish.Name = "radioEnglish";
this.radioEnglish.Size = new System.Drawing.Size(59, 17);
this.radioEnglish.TabIndex = 0;
this.radioEnglish.TabStop = true;
this.radioEnglish.Text = "English";
this.radioEnglish.UseVisualStyleBackColor = true;
this.radioEnglish.CheckedChanged += new System.EventHandler(this.radioEnglish_CheckedChanged);
//
// OptionsGeneralPanel // OptionsGeneralPanel
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.languageBox);
this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Name = "OptionsGeneralPanel"; this.Name = "OptionsGeneralPanel";
@ -157,6 +201,8 @@ namespace webImTray {
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout(); this.groupBox2.PerformLayout();
this.languageBox.ResumeLayout(false);
this.languageBox.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -172,5 +218,8 @@ namespace webImTray {
private System.Windows.Forms.CheckBox showHide; private System.Windows.Forms.CheckBox showHide;
private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.GroupBox languageBox;
private System.Windows.Forms.RadioButton radioRussian;
private System.Windows.Forms.RadioButton radioEnglish;
} }
} }

View File

@ -5,10 +5,12 @@ using System.Drawing;
using System.Data; using System.Data;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Resources;
namespace webImTray { namespace webImTray {
public partial class OptionsGeneralPanel : UserControl, OptionsPanel { public partial class OptionsGeneralPanel : UserControl, OptionsPanel {
bool modified = false; bool modified = false;
public event ModifiedEvent PanelModified;
public OptionsGeneralPanel() { public OptionsGeneralPanel() {
InitializeComponent(); InitializeComponent();
@ -39,6 +41,15 @@ namespace webImTray {
return "General"; return "General";
} }
public event ModifiedEvent PanelModified; public void updateUI(ResourceManager resManager) {
groupBox1.Text = resManager.GetString("application");
}
private void radioEnglish_CheckedChanged(object sender, EventArgs e) {
// Set english locale
// Update UI
OptionsDialog.updateUI();
}
} }
} }

View File

@ -5,9 +5,12 @@ using System.Drawing;
using System.Data; using System.Data;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Resources;
namespace webImTray { namespace webImTray {
public partial class OptionsSoundsPanel : UserControl, OptionsPanel { public partial class OptionsSoundsPanel : UserControl, OptionsPanel {
public event ModifiedEvent PanelModified;
public OptionsSoundsPanel() { public OptionsSoundsPanel() {
InitializeComponent(); InitializeComponent();
} }
@ -26,6 +29,7 @@ namespace webImTray {
return "Sounds"; return "Sounds";
} }
public event ModifiedEvent PanelModified; public void updateUI(ResourceManager resManager) {
}
} }
} }