public MainWindow(Irc.IrcClient client) { InitializeComponent(); c = client; c.PrivateMessage += C_PrivateMessage; if (Directory.Exists(string.Format("cfg/", c.Nick))) { UserConfig.Load(string.Format("cfg/{0}.cfg", c.Nick)); } else { Directory.CreateDirectory("cfg/"); } if ((!File.Exists(string.Format("cfg/{0}.cfg", c.Nick))) || channels == null) { UserConfig.Channels = channels = new string[] { "#osu", "#lobby" } } ; App.FriendList = new UserCollection(UserConfig.FriendList); App.IgnoreList = new UserCollection(UserConfig.IgnoreList); App.HighlightedWords = new UserCollection(UserConfig.HighlightedWords); foreach (var channel in UserConfig.Channels) { tabControl.Items.Add(new TabItem() { Header = channel, Content = new Controls.ChatPage(c, channel) }); } channels = UserConfig.Channels; App.FriendList.UserAdded += FriendList_Changed; App.FriendList.UserRemoved += FriendList_Changed; }
private void FriendList_Changed(object sender, string e) { UserConfig.FriendList = App.FriendList.ToArray(); UserConfig.Save(string.Format("cfg/{0}.cfg", c.Nick)); }