public HandleForm(Plugin plugin) { this.m_plugin = plugin; InitializeComponent(); this.m_styleManager = new FixedStyleManager(this); this.clrStyle.SelectedValueChanged += clrStyle_SelectedValueChanged; this.clrTheme.SelectedValueChanged += clrTheme_SelectedValueChanged; this.clrStyle.Items.AddRange(Enum.GetNames(typeof(MetroColorStyle))); this.clrTheme.Items.AddRange(Enum.GetNames(typeof(MetroThemeStyle))); this.widthLabel.Text = String.Format(this.widthLabel.Text, (this.m_plugin.Map != null ? this.m_plugin.Map.Width.ToString() : "Not in world")); this.heightLabel.Text = String.Format(this.heightLabel.Text, (this.m_plugin.Map != null ? this.m_plugin.Map.Height.ToString() : "Not in world")); this.metroTile1.Text = (this.m_plugin.Map != null ? this.m_plugin.Map.Name.ToString() : "Not in world"); this.clrTheme.SelectedItem = this.clrStyle.SelectedItem = "Default"; if (this.m_plugin.Map != null) { this.m_plugin.Map.TilesAdded += Map_TilesAdded; //this.metroProgressBar1.Maximum = this.m_plugin.Map.Tiles[0].Length * this.m_plugin.Map.Tiles[1].Length; } }
private void InitSettings() { Invoke((MethodInvoker) delegate { m_themeManager = new FixedStyleManager(this); themeCombobox.Items.AddRange(Enum.GetNames(typeof(MetroThemeStyle))); styleCombobox.Items.AddRange(Enum.GetNames(typeof(MetroColorStyle))); lstServers.Items.AddRange(GameData.Servers.Map.Select(x => x.Value.Name).OrderBy(x => x).ToArray()); themeCombobox.SelectedValueChanged += themeCombobox_SelectedValueChanged; styleCombobox.SelectedValueChanged += styleCombobox_SelectedValueChanged; themeCombobox.SelectedItem = Config.Default.Theme.ToString(); styleCombobox.SelectedItem = Config.Default.Style.ToString(); tglStartByDefault.Checked = Config.Default.StartProxyByDefault; lstServers.SelectedItem = Config.Default.DefaultServerName; Config.Default.PropertyChanged += (sender, e) => { if (e.PropertyName == "DefaultServerName") { string serverName = Config.Default.DefaultServerName; // Update default server in Proxy class (used by State constructor) Lib_K_Relay.Proxy.DefaultServer = GameData.Servers.ByName(serverName).Address; Invoke((MethodInvoker) delegate { if (!lstServers.SelectedItem.Equals(serverName)) { lstServers.SelectedItem = serverName; } }); } }; m_themeManager.OnStyleChanged += m_themeManager_OnStyleChanged; m_themeManager_OnStyleChanged(null, null); }); }
private void InitSettings() { Invoke((MethodInvoker) delegate { m_themeManager = new FixedStyleManager(this); themeCombobox.Items.AddRange(Enum.GetNames(typeof(MetroThemeStyle))); styleCombobox.Items.AddRange(Enum.GetNames(typeof(MetroColorStyle))); themeCombobox.SelectedValueChanged += themeCombobox_SelectedValueChanged; styleCombobox.SelectedValueChanged += styleCombobox_SelectedValueChanged; themeCombobox.SelectedItem = Config.Default.Theme.ToString(); styleCombobox.SelectedItem = Config.Default.Style.ToString(); tglStartByDefault.Checked = Config.Default.StartProxyByDefault; lstServers.SelectedItem = Config.Default.DefaultServerName; m_themeManager.OnStyleChanged += m_themeManager_OnStyleChanged; m_themeManager_OnStyleChanged(null, null); }); }
private void InitSettings() { Invoke((MethodInvoker)delegate { m_themeManager = new FixedStyleManager(this); themeCombobox.Items.AddRange(Enum.GetNames(typeof(MetroThemeStyle))); styleCombobox.Items.AddRange(Enum.GetNames(typeof(MetroColorStyle))); themeCombobox.SelectedValueChanged += themeCombobox_SelectedValueChanged; styleCombobox.SelectedValueChanged += styleCombobox_SelectedValueChanged; themeCombobox.SelectedItem = Config.Default.Theme.ToString(); styleCombobox.SelectedItem = Config.Default.Style.ToString(); tglStartByDefault.Checked = Config.Default.StartProxyByDefault; lstServers.SelectedItem = Config.Default.DefaultServerName; m_themeManager.OnStyleChanged += m_themeManager_OnStyleChanged; m_themeManager_OnStyleChanged(null, null); }); }