public FormEditor() { InitializeComponent(); this.Load += new EventHandler(FormEditor_Load); popupTypeToolStripMenuItem.Visible = false; tabControlEditor.SelectedIndexChanged += new EventHandler(tabControlEditor_SelectedIndexChanged); textAliases.KeyDown += new KeyEventHandler(OnKeyDown); textPopups.KeyDown += new KeyEventHandler(OnKeyDown); //load the aliases aliasList = FormMain.Instance.IceChatAliases; LoadAliases(); //load the popups popupList = FormMain.Instance.IceChatPopupMenus; nickListPopup = LoadPopupMenu("NickList"); consolePopup = LoadPopupMenu("Console"); channelPopup = LoadPopupMenu("Channel"); queryPopup = LoadPopupMenu("Query"); //load the nicklist by default into popup editor LoadPopups(nickListPopup); nickListToolStripMenuItem.Checked = true; currentPopup = "NickList"; currentPopupMenu = nickListToolStripMenuItem; this.Activated += new EventHandler(FormEditor_Activated); ApplyLanguage(); }
private void ReLoadAliases() { if (File.Exists(FormMain.Instance.AliasesFile)) { XmlSerializer deserializer = new XmlSerializer(typeof(IceChatAliases)); TextReader textReader = new StreamReader(FormMain.Instance.AliasesFile); aliasList = (IceChatAliases)deserializer.Deserialize(textReader); textReader.Close(); textReader.Dispose(); } else { aliasList = new IceChatAliases(); } }
private void LoadAliases() { if (File.Exists(aliasesFile)) { XmlTextReader textReader = null; try { XmlSerializer deserializer = new XmlSerializer(typeof(IceChatAliases)); textReader = new XmlTextReader(aliasesFile); iceChatAliases = (IceChatAliases)deserializer.Deserialize(textReader); textReader.Close(); } catch (Exception) { textReader.Close(); errorMessages.Add("There was a problem loading IceChatAliases.xml. Default aliases loaded"); iceChatAliases = new IceChatAliases(); SaveAliases(); } } else { iceChatAliases = new IceChatAliases(); SaveAliases(); } }