public void AddNewChatWindow(ChatWindowViewModelSettings settings) { if (ChatWindows.Count >= 10) { return; } ChatWindowViewModel cwm = null; var trEng = TranslationEngines; UiWindow.Window.UIThread(() => { cwm = new ChatWindowViewModel(settings, trEng.ToList(), _AllChatCodes.ToList(), _TataruModel.HotKeyManager); try { ChatWindows.Add(cwm); } catch (Exception e) { Logger.WriteLog(e); } SelectedTabIndex = ChatWindows.Count - 1; }); }
public void AddNewChatWindow() { UiWindow.Window.UIThread(() => { if (ChatWindows.Count >= 10) { return; } long winId = 0; if (ChatWindows.Count > 0) { winId = ChatWindows[ChatWindows.Count - 1].WinId + 1; } ChatWindowViewModelSettings cws = null; ChatWindowViewModel cwm = null; var trEng = TranslationEngines; cws = new ChatWindowViewModelSettings((winId + 1).ToString(), winId); cwm = new ChatWindowViewModel(cws, trEng.ToList(), _AllChatCodes.ToList(), _TataruModel.HotKeyManager); ChatWindows.Add(cwm); SelectedTabIndex = ChatWindows.Count - 1; }); }
private void InitWindows() { ChatWindows.Clear(); App.Settings.ChatWindowsSettings.ToList().ForEach(s => { if (s.Tabs.Count == 0) { return; } var m = new ChatViewModel(s); var w = new ChatWindow(m); ChatWindows.Add(w); m.LoadTabs(s.Tabs); }); if (ChatWindows.Count != 0) { return; } { Log.CW("No chat windows found, initializing default one."); var ws = new ChatWindowSettings(0, 1, 200, 500, true, ClickThruMode.Never, 1, false, 1, false, true, false) { HideTimeout = 10, FadeOut = true, LfgOn = false }; var m = new ChatViewModel(ws); var w = new ChatWindow(m); App.BaseDispatcher.InvokeAsync(() => { App.Settings.ChatWindowsSettings.Add((ChatWindowSettings)w.WindowSettings); }); ChatWindows.Add(w); m.LoadTabs(); if (App.Settings.ChatEnabled) { w.Show(); } } }
public void InitWindows() { ChatWindows.Clear(); SettingsHolder.ChatWindowsSettings.ToList().ForEach(s => { if (s.Tabs.Count == 0) { return; } var m = new ChatViewModel(); var w = new ChatWindow(s, m); ChatWindows.Add(w); m.LoadTabs(s.Tabs); }); if (ChatWindows.Count != 0) { return; } { Log.CW("No chat windows found, initializing default one."); var ws = new ChatWindowSettings(0, 1, 200, 500, true, ClickThruMode.Never, 1, false, 1, false, true, false) { HideTimeout = 10, FadeOut = true, LfgOn = false }; var m = new ChatViewModel(); var w = new ChatWindow(ws, m); SettingsHolder.ChatWindowsSettings.Add(w.WindowSettings as ChatWindowSettings); ChatWindows.Add(w); m.LoadTabs(); if (SettingsHolder.ChatEnabled) { w.Show(); } } }