public static void CloseAllFlyouts(FlyoutsControl _list) { foreach (Flyout item in _list.Items) { item.IsOpen = false; } }
public ModelHelpers(IBackend gallifrey, FlyoutsControl flyoutsControl) { this.flyoutsControl = flyoutsControl; Gallifrey = gallifrey; DialogContext = new DialogContext(); openFlyouts = new List <OpenFlyoutDetails>(); }
/// <summary> /// Initializes a new instance of the <see cref="ShellWindow"/> class. /// </summary> public ShellWindow() { ThemeHelper.EnsureApplicationThemes(GetType().Assembly, true); MahAppsHelper.ApplyTheme(); InitializeComponent(); var accentColorBrush = ThemeHelper.GetAccentColorBrush(); border.BorderBrush = accentColorBrush; var serviceLocator = ServiceLocator.Default; var statusService = serviceLocator.ResolveType <IStatusService>(); statusService.Initialize(statusTextBlock); var commandManager = serviceLocator.ResolveType <ICommandManager>(); var flyoutService = serviceLocator.ResolveType <IFlyoutService>(); var mahAppsService = serviceLocator.ResolveType <IMahAppsService>(); serviceLocator.RegisterInstance <IAboutInfoService>(mahAppsService); var flyouts = new FlyoutsControl(); foreach (var flyout in flyoutService.GetFlyouts()) { flyouts.Items.Add(flyout); } Flyouts = flyouts; var windowCommands = mahAppsService.GetRightWindowCommands(); if (mahAppsService.GetAboutInfo() != null) { var aboutWindowCommand = WindowCommandHelper.CreateWindowCommandButton("appbar_information", "about"); var aboutService = serviceLocator.ResolveType <IAboutService>(); commandManager.RegisterAction("Help.About", aboutService.ShowAbout); aboutWindowCommand.Command = commandManager.GetCommand("Help.About"); windowCommands.Items.Add(aboutWindowCommand); } RightWindowCommands = windowCommands; var mainView = mahAppsService.GetMainView(); contentControl.Content = mainView; SetBinding(TitleProperty, new Binding("ViewModel.Title") { Source = mainView }); }
public MainWindow() { InitializeComponent(); var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; Title = string.Format(Title, $"{version.Major}.{version.Minor}.{version.Build}"); Flyouts = new FlyoutsControl(); Flyouts.Items.Add(_configFlyout); }
public MainWindow() { var exeVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; if (exeVersion > new Version(Settings.Default.SettingsVersion)) { Settings.Default.Upgrade(); } Settings.Default.SettingsVersion = exeVersion.ToString(); Settings.Default.Save(); try { // Load app theme and accent var currentTheme = ThemeManager.GetAppTheme(Settings.Default.AppTheme); var currentAccent = ThemeManager.GetAccent(Settings.Default.AppAccent); ThemeManager.ChangeAppStyle(Application.Current, currentAccent, currentTheme); } catch { // Theme error, revert to default Settings.Default.AppTheme = "BaseLight"; Settings.Default.AppAccent = "Blue"; Settings.Default.Save(); var currentTheme = ThemeManager.GetAppTheme(Settings.Default.AppTheme); var currentAccent = ThemeManager.GetAccent(Settings.Default.AppAccent); ThemeManager.ChangeAppStyle(Application.Current, currentAccent, currentTheme); } InitializeComponent(); var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; Title = string.Format(Title, $"{version.Major}.{version.Minor}.{version.Build}"); Flyouts = new FlyoutsControl(); Flyouts.Items.Add(_configFlyout); // Only show the donation message once every 3 days if (!Settings.Default.NeverShowDonation && (Settings.Default.DonationMessage < (DateTime.Now - new TimeSpan(3, 0, 0, 0)) || Debugger.IsAttached)) { // Show donation message var _donateFlyout = new DonateFlyout(); Flyouts.Items.Add(_donateFlyout); _donateFlyout.IsOpen = true; Settings.Default.DonationMessage = DateTime.Now; Settings.Default.Save(); } }
private void SetupFlyouts(IFlyoutService flyoutService) { var flyouts = new FlyoutsControl(); foreach (var flyout in flyoutService.GetFlyouts()) { flyouts.Items.Add(flyout); } Flyouts = flyouts; }
public ModelHelpers(IBackend gallifrey, FlyoutsControl flyoutsControl) { this.flyoutsControl = flyoutsControl; Gallifrey = gallifrey; DialogContext = new DialogContext(); openFlyouts = new List <OpenFlyoutDetails>(); toastNotifier = new Notifier(cfg => { cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(TimeSpan.FromSeconds(10), MaximumNotificationCount.FromCount(5)); cfg.PositionProvider = new PrimaryScreenPositionProvider(Corner.BottomRight, 10, 40); cfg.Dispatcher = Application.Current.Dispatcher; cfg.DisplayOptions.TopMost = true; cfg.DisplayOptions.Width = 400; }); }
public MainWindow() { var exeVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; if (exeVersion > new Version(Settings.Default.SettingsVersion)) { Settings.Default.Upgrade(); } Settings.Default.SettingsVersion = exeVersion.ToString(); Settings.Default.Save(); try { // Load app theme and accent var currentTheme = ThemeManager.GetAppTheme(Settings.Default.AppTheme); var currentAccent = ThemeManager.GetAccent(Settings.Default.AppAccent); ThemeManager.ChangeAppStyle(Application.Current, currentAccent, currentTheme); } catch { // Theme error, revert to default Settings.Default.AppTheme = "BaseLight"; Settings.Default.AppAccent = "Blue"; Settings.Default.Save(); var currentTheme = ThemeManager.GetAppTheme(Settings.Default.AppTheme); var currentAccent = ThemeManager.GetAccent(Settings.Default.AppAccent); ThemeManager.ChangeAppStyle(Application.Current, currentAccent, currentTheme); } InitializeComponent(); var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; Title = string.Format(Title, $"{version.Major}.{version.Minor}.{version.Build}"); Flyouts = new FlyoutsControl(); Flyouts.Items.Add(_configFlyout); }
/// <summary> /// Initializes a new instance of the <see cref="ShellWindow"/> class. /// </summary> public ShellWindow() : base(DataWindowMode.Custom, setOwnerAndFocus: false) { var serviceLocator = ServiceLocator.Default; InitializeComponent(); statusBar.Background = Orc.Controls.ThemeHelper.GetAccentColorBrush(Orc.Controls.AccentColorStyle.AccentColor4); serviceLocator.RegisterInstance(pleaseWaitProgressBar, "pleaseWaitService"); var statusService = serviceLocator.ResolveType <IStatusService>(); statusService.Initialize(statusTextBlock); var commandManager = serviceLocator.ResolveType <ICommandManager>(); var flyoutService = serviceLocator.ResolveType <IFlyoutService>(); var mahAppsService = serviceLocator.ResolveType <IMahAppsService>(); serviceLocator.RegisterInstance <IAboutInfoService>(mahAppsService); var flyouts = new FlyoutsControl(); foreach (var flyout in flyoutService.GetFlyouts()) { flyouts.Items.Add(flyout); } Flyouts = flyouts; var windowCommands = mahAppsService.GetRightWindowCommands(); if (mahAppsService.GetAboutInfo() != null) { var aboutWindowCommand = WindowCommandHelper.CreateWindowCommandButton("appbar_information", "about"); var aboutService = serviceLocator.ResolveType <IAboutService>(); #pragma warning disable AvoidAsyncVoid // Avoid async void commandManager.RegisterAction("Help.About", async() => await aboutService.ShowAboutAsync()); #pragma warning restore AvoidAsyncVoid // Avoid async void aboutWindowCommand.SetCurrentValue(System.Windows.Controls.Primitives.ButtonBase.CommandProperty, commandManager.GetCommand("Help.About")); windowCommands.Items.Add(aboutWindowCommand); } RightWindowCommands = windowCommands; var statusBarContent = mahAppsService.GetStatusBar(); if (statusBarContent != null) { customStatusBarItem.SetCurrentValue(ContentProperty, statusBarContent); } var mainView = mahAppsService.GetMainView(); contentControl.Content = mainView; ShellDimensionsHelper.ApplyDimensions(this, mainView); SetBinding(TitleProperty, new Binding("ViewModel.Title") { Source = mainView }); }
/// <summary> /// Initializes a new instance of the <see cref="ShellWindow"/> class. /// </summary> public ShellWindow() : base(DataWindowMode.Custom, setOwnerAndFocus: false) { var serviceLocator = ServiceLocator.Default; InitializeComponent(); statusBar.Background = ThemeHelper.GetAccentColorBrush(AccentColorStyle.AccentColor4); serviceLocator.RegisterInstance(pleaseWaitProgressBar, "pleaseWaitService"); var statusService = serviceLocator.ResolveType <IStatusService>(); statusService.Initialize(statusTextBlock); var commandManager = serviceLocator.ResolveType <ICommandManager>(); var flyoutService = serviceLocator.ResolveType <IFlyoutService>(); var mahAppsService = serviceLocator.ResolveType <IMahAppsService>(); serviceLocator.RegisterInstance <IAboutInfoService>(mahAppsService); var flyouts = new FlyoutsControl(); foreach (var flyout in flyoutService.GetFlyouts()) { flyouts.Items.Add(flyout); } Flyouts = flyouts; var windowCommands = mahAppsService.GetRightWindowCommands(); if (mahAppsService.GetAboutInfo() != null) { var aboutWindowCommand = WindowCommandHelper.CreateWindowCommandButton("appbar_information", "about"); var aboutService = serviceLocator.ResolveType <IAboutService>(); commandManager.RegisterAction("Help.About", aboutService.ShowAbout); aboutWindowCommand.Command = commandManager.GetCommand("Help.About"); windowCommands.Items.Add(aboutWindowCommand); } RightWindowCommands = windowCommands; var statusBarContent = mahAppsService.GetStatusBar(); if (statusBarContent != null) { customStatusBarItem.Content = statusBarContent; } var mainView = mahAppsService.GetMainView(); contentControl.Content = mainView; SetBinding(TitleProperty, new Binding("ViewModel.Title") { Source = mainView }); }