private void SetNullOwnedObjects() { _logger = null; _mainControl = null; _pluginData = null; _localizationRepository = null; _instance = null; }
private void InitializePluginVariables(MainControl mainControl) { if (_mainControl != null) { return; } _mainControl = mainControl; _pluginData = ActGlobals.oFormActMain.PluginGetSelfData(mainControl.Plugin); Locator.CurrentMutable.Register(() => _mainControl); Locator.CurrentMutable.Register(() => _pluginData); }
public void InitPlugin(MainControl mainControl) { if (_pluginInitializing) { return; } InitializePluginVariables(mainControl); if (!EnsureActMainFormIsLoaded()) { return; } if (!FFXIVPluginHelper.Instance.Check(_pluginData, ffPluginIsEnabled => { if (ffPluginIsEnabled) { return; } _pluginData.cbEnabled.Checked = false; })) { return; } _pluginInitializing = true; ActGlobals.oFormActMain.Shown -= ActMainFormOnShown; _localizationRepository = Locator.Current.GetService <ILocalizationRepository>(); _dataRepository = Locator.Current.GetService <IDataRepository>(); _logger.SetTextBox(_mainControl.LoggingRichTextBox); _logger.Write("Plugin Init", LogLevel.Debug); _logger.Write($"Plugin Version: {Assembly.GetExecutingAssembly().GetName().Version}", LogLevel.Debug); _mainControl.LanguageComboBox.DataSource = new[] { new Language { Name = "English", Code = "en-us" }, new Language { Name = "한국어", Code = "ko-kr" }, new Language { Name = "日本語", Code = "ja-jp" }, new Language { Name = "Français", Code = "fr-fr" }, new Language { Name = "Deutsch", Code = "de-de" }, }; _mainControl.LanguageComboBox.DisplayMember = "Name"; _mainControl.LanguageComboBox.ValueMember = "Code"; _mainControl.TtsVoicesComboBox.DataSource = TTSHelper.Instance.AvailableVoices.Select(x => x.VoiceInfo.Name).ToArray(); _mainControl.LogLevelComboBox.DataSource = new [] { "Debug", "Info", "Warn", "Error", "Fatal", }; _pluginData.tpPluginSpace.Controls.Add(_mainControl); ACTPluginSettingsHelper.Instance.LoadSettings(); var updateTask = DFAssistRepositoriesHelper.Instance.UpdateData(); updateTask.ContinueWith(_ => { DFAssistRepositoriesHelper.Instance.LoadData(); DFAssistUIInteractionHelper.Instance.Subscribe(); _pluginData.lblPluginStatus.Text = "Starting..."; _pluginData.lblPluginStatus.Text = "Plugin Started!"; _pluginData.tpPluginSpace.Text = nameof(DFAssist); _logger.Write("Plugin Started!", LogLevel.Debug); FFXIVNetworkProcessHelper.Instance.Subscribe(); IsPluginEnabled = true; _logger.Write("Plugin Enabled", LogLevel.Debug); ACTPluginUpdateHelper.Instance.Subscribe(); _pluginInitializing = false; }); updateTask.Start(); }