/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MetroWindowContentRendered(object sender, EventArgs e) { if (this.IsRendered) { return; } this.IsRendered = true; if (string.IsNullOrWhiteSpace(Settings.Default.UILanguage)) { Settings.Default.UILanguage = Settings.Default.GameLanguage; } else { LocaleHelper.Update(Settings.Default.Culture); } DispatcherHelper.Invoke( delegate { Initializer.LoadAvailableSources(); Initializer.LoadAvailablePlugins(); Initializer.CheckUpdates(); Initializer.SetGlobals(); Initializer.StartMemoryWorkers(); }); Initializer.GetHomePlugin(); Initializer.UpdatePluginConstants(); }
public TabItem CreateTab() { this.Locale = LocaleHelper.Update(Constants.CultureInfo); var content = new ShellView(); // TODO: Loaded event not needed?, content.Loaded += ShellViewModel.Loaded; var tabItem = new TabItem { Header = this.Name, Content = content }; // do your gui stuff here EventSubscriber.Subscribe(); // content gives you access to the base xaml return(tabItem); }
private void InitDone(object sender, EventArgs e) { if (this.IsRendered) { return; } this.IsRendered = true; this.ShellViewTC = this.FindControl <TabControl>("ShellViewTC"); this.PluginsTC = this.FindControl <TabControl>("PluginsTC"); if (string.IsNullOrWhiteSpace(Settings.Default.UILanguage)) { Settings.Default.UILanguage = Settings.Default.GameLanguage; } else { LocaleHelper.Update(Settings.Default.Culture); } DispatcherHelper.Invoke( delegate { Initializer.LoadAvailablePlugins(); Initializer.CheckUpdates(); Initializer.SetGlobals(); Initializer.StartMemoryWorkers(); /* TODO: Network * if (Settings.Default.EnableNetworkReading && !Initializer.NetworkWorking) { * Initializer.StartNetworkWorker(); * } */ }); Initializer.GetHomePlugin(); Initializer.UpdatePluginConstants(); }
/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MetroWindowContentRendered(object sender, EventArgs e) { if (IsRendered) { return; } IsRendered = true; #region GUI Finalization if (String.IsNullOrWhiteSpace(Settings.Default.UILanguage)) { Settings.Default.UILanguage = Settings.Default.GameLanguage; } else { LocaleHelper.Update(Settings.Default.Culture); } DispatcherHelper.Invoke(delegate { Initializer.LoadAvailableSources(); Initializer.LoadAvailablePlugins(); Initializer.CheckUpdates(); Initializer.SetGlobals(); Initializer.StartMemoryWorkers(); if (Settings.Default.EnableNetworkReading && !Initializer.NetworkWorking) { Initializer.StartNetworkWorker(); } }); Initializer.GetHomePlugin(); Initializer.UpdatePluginConstants(); #endregion }
/// <summary> /// </summary> /// <param name="sender"> </param> /// <param name="e"> </param> private void MetroWindowLoaded(object sender, RoutedEventArgs e) { View.Topmost = Settings.Default.TopMost; LocaleHelper.Update(Settings.Default.Culture); ThemeHelper.ChangeTheme(Settings.Default.Theme, null); #region GUI Finalization Initializer.LoadAvailableSources(); Initializer.LoadAvailablePlugins(); Initializer.CheckUpdates(); Initializer.SetGlobals(); Initializer.SetSignatures(); Initializer.StartMemoryWorkers(); Initializer.GetHomePlugin(); Initializer.UpdatePluginConstants(); #endregion AppViewModel.Instance.NotifyIcon.Text = "FFXIVAPP"; AppViewModel.Instance.NotifyIcon.ContextMenu.MenuItems[0].Enabled = false; AppBootstrapper.Instance.ProcessDetachCheckTimer.Enabled = true; }
static void Main(string[] args) { LocaleHelper.Update(Settings.Default.Culture); BuildAvaloniaApp().Start <ShellView>(); //(() => new MainWindowViewModel()); }
/// <summary> /// </summary> /// <param name="sender"> </param> /// <param name="e"> </param> private static void SettingsPropertyChanged(object sender, PropertyChangedEventArgs e) { Logging.Log(Logger, $"PropertyChanged : {e.PropertyName}"); try { switch (e.PropertyName) { case "CharacterName": Constants.CharacterName = Settings.Default.CharacterName; break; case "GameLanguage": Constants.GameLanguage = Settings.Default.GameLanguage; break; case "UILanguage": if (AppViewModel.Instance.UILanguages.Any(ui => ui.Language == Settings.Default.UILanguage)) { UILanguage uiLanguage = AppViewModel.Instance.UILanguages.First(ui => ui.Language == Settings.Default.UILanguage); Constants.CultureInfo = Settings.Default.Culture = uiLanguage.CultureInfo; LocaleHelper.Update(Settings.Default.Culture); } break; case "ServerName": Constants.ServerName = Settings.Default.ServerName; break; case "EnableNLog": Common.Constants.EnableNLog = Constants.EnableNLog = Settings.Default.EnableNLog; break; case "EnableNetworkReading": Common.Constants.EnableNetworkReading = Constants.EnableNetworkReading = Settings.Default.EnableNetworkReading; if (Settings.Default.EnableNetworkReading) { if (!Initializer.NetworkWorking && Constants.IsOpen) { Initializer.StartNetworkWorker(); } } else { Initializer.StopNetworkWorker(); } break; case "NetworkUseWinPCap": if (Initializer.NetworkWorking) { Initializer.RefreshNetworkWorker(); } break; case "EnableHelpLabels": Constants.EnableHelpLabels = Settings.Default.EnableHelpLabels; break; case "Theme": Constants.Theme = Settings.Default.Theme; break; case "UIScale": Constants.UIScale = Settings.Default.UIScale; break; case "TopMost": if (ShellView.View != null) { ShellView.View.Topmost = Settings.Default.TopMost; } break; case "DefaultAudioDevice": if (Settings.Default.DefaultAudioDevice == "System Default") { Common.Constants.DefaultAudioDevice = Guid.Empty; } else { foreach (DirectSoundDeviceInfo audioDevice in AvailableAudioDevices.Where(device => device.Guid != Guid.Empty)) { if (audioDevice.Description == Settings.Default.DefaultAudioDevice) { Common.Constants.DefaultAudioDevice = audioDevice.Guid; } } } break; } } catch (Exception ex) { Logging.Log(Logger, new LogItem(ex, true)); } }
/// <summary> /// </summary> /// <param name="sender"> </param> /// <param name="e"> </param> private static void SettingsPropertyChanged(object sender, PropertyChangedEventArgs e) { Logging.Log(Logger, String.Format("PropertyChanged : {0}", e.PropertyName)); try { switch (e.PropertyName) { case "CharacterName": Constants.CharacterName = Settings.Default.CharacterName; break; case "FirstName": Initializer.SetCharacter(); break; case "LastName": Initializer.SetCharacter(); break; case "GameLanguage": Constants.GameLanguage = Settings.Default.GameLanguage; var lang = Settings.Default.GameLanguage.ToLower(); var cultureInfo = new CultureInfo("en"); switch (lang) { case "japanese": cultureInfo = new CultureInfo("ja"); break; case "german": cultureInfo = new CultureInfo("de"); break; case "french": cultureInfo = new CultureInfo("fr"); break; } Constants.CultureInfo = Settings.Default.Culture = cultureInfo; LocaleHelper.Update(Settings.Default.Culture); break; case "ServerName": Constants.ServerName = Settings.Default.ServerName; break; case "EnableNLog": Common.Constants.EnableNLog = Constants.EnableNLog = Settings.Default.EnableNLog; break; case "EnableHelpLabels": Constants.EnableHelpLabels = Settings.Default.EnableHelpLabels; break; case "Theme": Constants.Theme = Settings.Default.Theme; break; case "UIScale": Constants.UIScale = Settings.Default.UIScale; break; case "TopMost": if (ShellView.View != null) { ShellView.View.Topmost = Settings.Default.TopMost; } break; case "DefaultAudioDevice": if (Settings.Default.DefaultAudioDevice == "System Default") { Common.Constants.DefaultAudioDevice = Guid.Empty; } else { foreach (var audioDevice in AvailableAudioDevices.Where(device => device.Guid != Guid.Empty)) { if (audioDevice.Description == Settings.Default.DefaultAudioDevice) { Common.Constants.DefaultAudioDevice = audioDevice.Guid; } } } break; } } catch (Exception ex) { } }
/// <summary> /// </summary> /// <param name="sender"> </param> /// <param name="e"> </param> private static void SettingsPropertyChanged(object sender, PropertyChangedEventArgs e) { Logging.Log(Logger, $"PropertyChanged : {e.PropertyName}"); try { switch (e.PropertyName) { case "CharacterName": Constants.CharacterName = Settings.Default.CharacterName; break; case "GameLanguage": Constants.GameLanguage = Settings.Default.GameLanguage; break; case "UILanguage": if (AppViewModel.Instance.UILanguages.Any(ui => ui.Language == Settings.Default.UILanguage)) { UILanguage uiLanguage = AppViewModel.Instance.UILanguages.First(ui => ui.Language == Settings.Default.UILanguage); Constants.CultureInfo = Settings.Default.Culture = uiLanguage.CultureInfo; LocaleHelper.Update(Settings.Default.Culture); } break; case "ServerName": Constants.ServerName = Settings.Default.ServerName; break; case "EnableNLog": Common.Constants.EnableNLog = Constants.EnableNLog = Settings.Default.EnableNLog; break; case "EnableNetworkReading": /* TODO: Network * Common.Constants.EnableNetworkReading = Constants.EnableNetworkReading = Settings.Default.EnableNetworkReading; * if (Settings.Default.EnableNetworkReading) { * if (!Initializer.NetworkWorking && Constants.IsOpen) { * Initializer.StartNetworkWorker(); * } * } * else { * Initializer.StopNetworkWorker(); * } */ break; case "NetworkUseWinPCap": /* TODO: Network * if (Initializer.NetworkWorking) { * Initializer.RefreshNetworkWorker(); * } */ break; case "EnableHelpLabels": Constants.EnableHelpLabels = Settings.Default.EnableHelpLabels; break; case "Theme": Constants.Theme = Settings.Default.Theme; break; case "UIScale": Constants.UIScale = Settings.Default.UIScale; break; case "DefaultAudioDevice": /* TODO: Audio * if (Settings.Default.DefaultAudioDevice == "System Default") { * Common.Constants.DefaultAudioDevice = Guid.Empty; * } * else { * foreach (DirectSoundDeviceInfo audioDevice in AvailableAudioDevices.Where(device => device.Guid != Guid.Empty)) { * if (audioDevice.Description == Settings.Default.DefaultAudioDevice) { * Common.Constants.DefaultAudioDevice = audioDevice.Guid; * } * } * } */ break; case nameof(SettingModel.Top): case nameof(SettingModel.Left): { var iX = (int)ShellView.View.Position.X; var iY = (int)ShellView.View.Position.Y; if (iX != Settings.Default.Left || iY != Settings.Default.Top) { ShellView.View.Position = new Avalonia.Point(Settings.Default.Left, Settings.Default.Top); } break; } } } catch (Exception ex) { Logging.Log(Logger, new LogItem(ex, true)); } }