public override void DeInitPlugin() { _shortkeyManager?.Dispose(); _shortkeyManager = null; _windowsMessagePump.Dispose(); OverlayWPF?.Close(); ActGlobals.oFormActMain.OnLogLineRead -= OFormActMain_OnLogLineRead; TranslateService.Stop(); UpdateChecker.Stop(); if (_settingsLoaded) { Settings?.Save(); } StatusLabel.Text = "Exited. Bye~"; }
public override void DeInitPlugin() { _gameProcessMonitor.Stop(); MachinaService.Stop(); _shortkeyManager?.Dispose(); _shortkeyManager = null; _windowsMessagePump.Dispose(); OverlayWPF?.Close(); _networkProbe.Stop(); UpdateChecker.Stop(); if (_settingsLoaded) { Settings?.Save(); } StatusLabel.Text = "Exited. Bye~"; }
public override void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) { _settingsLoaded = false; ParentTabPage = pluginScreenSpace; StatusLabel = pluginStatusText; ParentTabPage.Text = "Chatting Translate"; try { Controller = new MainController(); Settings = new SettingsHolder(); Settings.AttachToAct(this); OverlayWPF = new PingWindow(); ElementHost.EnableModelessKeyboardInterop(OverlayWPF); OverlayWPF.AttachToAct(this); OverlayWPF.Show(); SettingsTab = new FFXIVPingTabControl(); SettingsTab.AttachToAct(this); Controller.ActivatedProcessPathChanged += ControllerOnActivatedProcessPathChanged; MachinaService.AttachToAct(this); _gameProcessMonitor.AttachToAct(this); _networkProbe.AttachToAct(this); _windowsMessagePump.AttachToAct(this); UpdateChecker.AttachToAct(this); _shortkeyManager = new ShortkeyManager <MainController, FFXIVPingPlugin>(); _shortkeyManager.AttachToAct(this); Settings.PostAttachToAct(this); OverlayWPF.PostAttachToAct(this); SettingsTab.PostAttachToAct(this); MachinaService.PostAttachToAct(this); _gameProcessMonitor.PostAttachToAct(this); _networkProbe.PostAttachToAct(this); _windowsMessagePump.PostAttachToAct(this); UpdateChecker.PostAttachToAct(this); _shortkeyManager.PostAttachToAct(this); Settings.Load(); _settingsLoaded = true; DoLocalization(); Settings.NotifySettingsLoaded(); StatusLabel.Text = "Init Success. >w<"; } catch (Exception ex) { StatusLabel.Text = "Init Failed: " + ex; if (_settingsLoaded) { MessageBox.Show($"Init failed!\nCaused by:\n{ex}"); } else { MessageBox.Show($"Init failed before settings are loaded. Settings won't be saved until next successfully initialization to prevent settings lost!\nCaused by:\n{ex}"); } } }
public override void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) { _settingsLoaded = false; ParentTabPage = pluginScreenSpace; StatusLabel = pluginStatusText; ParentTabPage.Text = "Chatting Translate"; try { Controller = new MainController(); Settings = new SettingsHolder(); Settings.AttachToAct(this); OverlayWPF = new TranslateWindow(); ElementHost.EnableModelessKeyboardInterop(OverlayWPF); OverlayWPF.AttachToAct(this); OverlayWPF.Show(); SettingsTab = new FFXIVTranslateTabControl(); SettingsTab.AttachToAct(this); Controller.ChannelFilterChanged += ControllerOnChannelFilterChanged; Controller.ChannelColorChanged += ControllerOnChannelColorChanged; Controller.ChannelLabelChanged += ControllerOnChannelLabelChanged; Controller.ActivatedProcessPathChanged += ControllerOnActivatedProcessPathChanged; Controller.ClipboardContentChanged += ControllerOnClipboardContentChanged; ProxyFactory.Instance.AttachToAct(this); TranslateService.AttachToAct(this); _windowsMessagePump.AttachToAct(this); UpdateChecker.AttachToAct(this); _shortkeyManager = new ShortkeyManager <MainController, FFXIVTranslatePlugin>(); _shortkeyManager.AttachToAct(this); Settings.PostAttachToAct(this); OverlayWPF.PostAttachToAct(this); SettingsTab.PostAttachToAct(this); ProxyFactory.Instance.PostAttachToAct(this); TranslateService.PostAttachToAct(this); _windowsMessagePump.PostAttachToAct(this); UpdateChecker.PostAttachToAct(this); _shortkeyManager.PostAttachToAct(this); Settings.Load(); _settingsLoaded = true; DoLocalization(); ActGlobals.oFormActMain.LogFileChanged += OFormActMainOnLogFileChanged; _workingThread.StartWorkingThread(ActGlobals.oFormActMain.LogFilePath); Settings.NotifySettingsLoaded(); StatusLabel.Text = "Init Success. >w<"; } catch (Exception ex) { StatusLabel.Text = "Init Failed: " + ex; if (_settingsLoaded) { MessageBox.Show($"Init failed!\nCaused by:\n{ex}"); } else { MessageBox.Show($"Init failed before settings are loaded. Settings won't be saved until next successfully initialization to prevent settings lost!\nCaused by:\n{ex}"); } } }