/// <inheritdoc /> protected override void OnActivate(CancelEventArgs e) { var themeManager = new ThemeManager(); var windowLayoutManager = new WindowLayoutManager(); IEnumerable <Theme> themes = themeManager.GetInstalledThemes(); IEnumerable <WindowLayout> windowLayouts = windowLayoutManager.GetWindowLayouts(); string currentTheme1 = this.Theme1Id; string currentTheme2 = this.Theme2Id; string currentLayout1 = this.WindowLayout1Key; string currentLayout2 = this.WindowLayout2Key; windowLayouts = windowLayouts.Union(new[] { new WindowLayout(string.Empty, -1, "Do not change window layout") }); this.UpdateCollectionView(this.AvailableThemes1, themes); this.UpdateCollectionView(this.AvailableThemes2, themes); this.UpdateCollectionView(this.AvailableWindowLayouts, windowLayouts); this.Theme1Id = currentTheme1; this.Theme2Id = currentTheme2; this.WindowLayout1Key = currentLayout1; this.WindowLayout2Key = currentLayout2; base.OnActivate(e); }
public static void Main() { var windowManager = new WindowLayoutManager(); while (true) { Console.WriteLine("Type the number of the application to start and then press [enter]."); foreach (var value in Enum.GetValues(typeof(DemoAppLauncherSelection))) { Console.WriteLine($"{(int)value} - {value}"); } var selection = Console.ReadLine(); Console.Clear(); if (string.IsNullOrEmpty(selection) || !Enum.IsDefined(typeof(DemoAppLauncherSelection), Convert.ToInt32(selection))) { continue; } var appSelection = Enum.Parse <DemoAppLauncherSelection>(selection); if (appSelection != DemoAppLauncherSelection.Exit) { windowManager.DisplayBrokerConsole(WorkingDirectory, appSelection); } else { windowManager.CloseWindows(); break; } } }
/// <summary>Applies the window layout for an applied theme.</summary> /// <param name="theme">The theme that was applied.</param> private void ApplyWindowLayoutForTheme(AppliedTheme theme) { string targetLayoutKey = theme == AppliedTheme.Theme1 ? this.package.Options.WindowLayout1Key : this.package.Options.WindowLayout2Key; var windowLayoutManager = new WindowLayoutManager(); WindowLayout targetLayout; if (!string.IsNullOrEmpty(targetLayoutKey)) { targetLayout = windowLayoutManager.GetWindowLayoutByKey(targetLayoutKey); if (targetLayout == null) { throw new InvalidOperationException("Target window layout not found. Please check Theme Switcher settings."); } windowLayoutManager.ApplyWindowLayout(targetLayout); } }
public MainWindow(ILog log, MainViewModel model, WindowLayoutManager windowLayoutManager) { InitializeComponent(); Title = string.Format("Ingress v{0} ({1})", ApplicationDeployment.IsNetworkDeployed ? ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString() : Assembly.GetExecutingAssembly().GetName().Version + "d", ConfigurationManager.ConnectionStrings["IngressDb"].ConnectionString.Contains("LIVESERVER") ? "LIVE" : "TEST"); log.Info(Title); _log = log; _model = model; DataContext = _model; Loaded += MainWindow_Loaded; Closing += MainWindow_Closing; windowLayoutManager.ApplyJot(this); Messenger.Default.Register <NavigationCommand>(this, CheckShown); }
/// <summary>Initializes a new instance of the <see cref="ThemeSwitcherOptionsDialogPage" /> class.</summary> public ThemeSwitcherOptionsDialogPage() { ThreadHelper.ThrowIfNotOnUIThread(); var themeManager = new ThemeManager(); var windowLayoutManager = new WindowLayoutManager(); var themes1 = new ObservableCollection <Theme>(themeManager.GetInstalledThemes()); var themes2 = new ObservableCollection <Theme>(themeManager.GetInstalledThemes()); var windowLayouts = new ObservableCollection <WindowLayout>(windowLayoutManager.GetWindowLayouts()); windowLayouts.Add(new WindowLayout(string.Empty, -1, "Do not change window layout")); this.AvailableThemes1 = CollectionViewSource.GetDefaultView(themes1); this.AvailableThemes1.SortDescriptions.Add(new SortDescription(nameof(Theme.DisplayName), ListSortDirection.Ascending)); this.AvailableThemes1.Filter = theme => !((Theme)theme).Id.Equals(this.Theme2Id); this.AvailableThemes2 = CollectionViewSource.GetDefaultView(themes2); this.AvailableThemes2.SortDescriptions.Add(new SortDescription(nameof(Theme.DisplayName), ListSortDirection.Ascending)); this.AvailableThemes2.Filter = theme => !((Theme)theme).Id.Equals(this.Theme1Id); this.AvailableWindowLayouts = CollectionViewSource.GetDefaultView(windowLayouts); this.AvailableWindowLayouts.SortDescriptions.Add(new SortDescription(nameof(WindowLayout.Index), ListSortDirection.Ascending)); }