private void toggleLog_Click(object sender, EventArgs e) { if (toggleLog.Tag != null) { if (toggleLog.Tag.ToString() == "true") { parent.SetLogVisibility(false); toggleLog.Tag = "false"; toggleLog.Text = "Show Log"; RegOps.WriteSetting("ShowLog", 0, RegistryValueKind.DWord, ref settings); } else { parent.SetLogVisibility(true); toggleLog.Tag = "true"; toggleLog.Text = "Hide Log"; RegOps.WriteSetting("ShowLog", 1, RegistryValueKind.DWord, ref settings); } } else { parent.SetLogVisibility(true); toggleLog.Tag = "true"; toggleLog.Text = "Hide Log"; RegOps.WriteSetting("ShowLog", 1, RegistryValueKind.DWord, ref settings); } }
private void button3_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to reset all settings?" + "\n\n" + "This action cannot be undone.", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { RegOps.ResetSettings(ref settings); } }
private void setPathToolStripMenuItem_Click(object sender, EventArgs e) { using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.InitialDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName; DialogResult dialogResult = dialog.ShowDialog(); if (dialogResult == DialogResult.OK) { ServerPath = dialog.FileName; RegOps.WriteSetting("ServerPath", dialog.FileName, RegistryValueKind.String, ref settings); } } }
private void LoadSettings() { RegOps.ReadSettings(ref settings); settings.PropertyChanged += Settings_PropertyChanged; if (settings.ContainsKey("ShowLog")) { if ((bool)settings["ShowLog"]) { SetLogVisibility(true); } else { SetLogVisibility(false); } } if (settings.ContainsKey("ServerPath")) { ServerPath = settings["ServerPath"].ToString(); } }
private void Settings_Load(object sender, EventArgs e) { ColorSelectorDisplay.Text = parent.GetFormattedTagColor(); RoomSelector.Items.Clear(); //RoomSelectorDisplay.Text = parent.CurrentRoom; if (parent.IsConnected()) { foreach (KeyValuePair <string, Room> room in parent.Rooms) { RoomSelector.Items.Add(room.Value.Name); } } if (bool.Parse(RegOps.GetSettingFromDict("ShowLog", settings).ToString())) { toggleLog.Text = "Hide Log"; } else { toggleLog.Text = "Show Log"; } if (parent.IsConnected()) { RoomSelector.Enabled = true; } else { RoomSelector.Enabled = false; } if (settings.ContainsKey("NotificationStyle")) { switch (settings["NotificationStyle"]) { case NotificationType.Disabled: radioButton1.Checked = false; radioButton4.Checked = false; radioButton2.Checked = false; radioButton3.Checked = true; groupBox3.Enabled = false; break; case NotificationType.SoundOnly: radioButton1.Checked = false; radioButton4.Checked = false; radioButton2.Checked = true; radioButton3.Checked = false; groupBox3.Enabled = true; break; case NotificationType.ToastOnly: radioButton1.Checked = false; radioButton4.Checked = true; radioButton2.Checked = false; radioButton3.Checked = false; groupBox3.Enabled = false; break; case NotificationType.Both: radioButton1.Checked = true; radioButton4.Checked = false; radioButton2.Checked = false; radioButton3.Checked = false; groupBox3.Enabled = true; break; default: radioButton1.Checked = true; radioButton4.Checked = false; radioButton2.Checked = false; radioButton3.Checked = false; groupBox3.Enabled = true; break; } } }
private void radioButton3_CheckedChanged(object sender, EventArgs e) { RegOps.WriteSetting("NotificationStyle", "Disabled", RegistryValueKind.String, ref settings); }