예제 #1
0
        internal static void RunCommand(RunCommandType runCommandType)
        {
            switch (runCommandType)
            {
            case RunCommandType.ShowSettings:
            {
                if (FlyoutHandler.HasInitialized)
                {
                    FlyoutHandler.ShowSettingsWindow();
                }
                else
                {
                    FlyoutHandler.Initialized += (_, __) => FlyoutHandler.ShowSettingsWindow();
                }
                break;
            }

            case RunCommandType.RestoreDefault:
            {
                if (!DUIHandler.IsDUIAvailable())
                {
                    DUIHandler.GetAllInfos();
                }
                FlyoutHandler.SafelyExitApplication();
                break;
            }

            case RunCommandType.SafeExit:
            {
                FlyoutHandler.SafelyExitApplication();
                break;
            }

            case RunCommandType.AppUpdated:
            {
                if (AppLifecycleManager.IsBuildBetaChannel)
                {
                    MessageBox.Show("App update successfully!", AppName);
                }

                break;
            }

            default:
                break;
            }
        }
예제 #2
0
        internal static void RunCommand(RunCommandType runCommandType)
        {
            switch (runCommandType)
            {
            case RunCommandType.ShowSettings:
            {
                if (FlyoutHandler.HasInitialized)
                {
                    FlyoutHandler.ShowSettingsWindow();
                }
                else
                {
                    FlyoutHandler.Initialized += (_, __) => FlyoutHandler.ShowSettingsWindow();
                }
                break;
            }

            case RunCommandType.RestoreDefault:
            {
                NativeFlyoutHandler.Instance.VerifyNativeFlyoutCreated();
                FlyoutHandler.SafelyExitApplication();
                break;
            }

            case RunCommandType.SafeExit:
            {
                FlyoutHandler.SafelyExitApplication();
                break;
            }

            case RunCommandType.AppUpdated:
            {
                //if (AppLifecycleManager.IsBuildBetaChannel)
                //{
                //    MessageBox.Show("App update successfully!", AppName);
                //}

                break;
            }

            default:
                break;
            }
        }
예제 #3
0
        public static void ProcessCommandLineArgs(IList <string> args, bool isFirstInstance = true)
        {
            string arg = string.Empty;

            if ((isFirstInstance && args?.Count > 0) || (!isFirstInstance && args?.Count > 1))
            {
                arg = isFirstInstance ? args[0] : args[1];
            }

            if (arg == string.Empty)
            {
                if (!isFirstInstance)
                {
                    FlyoutHandler.ShowSettingsWindow();
                }
            }
            else if (arg.ToLowerInvariant() == arg_settings)
            {
                if (FlyoutHandler.HasInitialized)
                {
                    FlyoutHandler.ShowSettingsWindow();
                }
                else
                {
                    FlyoutHandler.Initialized += (_, __) => FlyoutHandler.ShowSettingsWindow();
                }
            }
            else if (arg.ToLowerInvariant() == arg_restore)
            {
                if (!DUIHandler.IsDUIAvailable())
                {
                    DUIHandler.GetAllInfos();
                }
                FlyoutHandler.SafelyExitApplication();
            }
            else if (arg.ToLowerInvariant() == arg_exit)
            {
                FlyoutHandler.SafelyExitApplication();
            }
        }
예제 #4
0
        internal static void RunCommand(RunCommandType runCommandType)
        {
            switch (runCommandType)
            {
            case RunCommandType.ShowSettings:
            {
                if (FlyoutHandler.HasInitialized)
                {
                    FlyoutHandler.ShowSettingsWindow();
                }
                else
                {
                    FlyoutHandler.Initialized += (_, __) => FlyoutHandler.ShowSettingsWindow();
                }
                break;
            }

            case RunCommandType.RestoreDefault:
            {
                if (!DUIHandler.IsDUIAvailable())
                {
                    DUIHandler.GetAllInfos();
                }
                FlyoutHandler.SafelyExitApplication();
                break;
            }

            case RunCommandType.SafeExit:
            {
                FlyoutHandler.SafelyExitApplication();
                break;
            }

            default:
                break;
            }
        }
예제 #5
0
        public void Initialize(FlyoutWindow flyoutWindow)
        {
            _flyoutWindow = flyoutWindow;

            FlyoutTimeout = AppDataHelper.FlyoutTimeout;
            MaxVerticalSessionControlsCount = AppDataHelper.MaxVerticalSessionControlsCount;
            SessionsPanelOrientation        = AppDataHelper.SessionsPanelOrientation;

            themeResources = (ThemeResources)App.Current.Resources.MergedDictionaries.FirstOrDefault(x => x is ThemeResources);
            lightResources = themeResources.ThemeDictionaries["Light"];
            darkResources  = themeResources.ThemeDictionaries["Dark"];

            FlyoutBackgroundOpacity = AppDataHelper.FlyoutBackgroundOpacity;

            #region Setup TaskbarIcon

            var settingsItem = new MenuItem()
            {
                Header  = Properties.Strings.SettingsItem,
                ToolTip = Properties.Strings.SettingsItemDescription,
                Icon    = new SymbolIcon()
                {
                    Symbol = Symbol.Setting
                }
            };
            settingsItem.Click += (_, __) => FlyoutHandler.ShowSettingsWindow();

            var exitItem = new MenuItem()
            {
                Header  = Properties.Strings.ExitItem,
                ToolTip = Properties.Strings.ExitItemDescription,
                Icon    = new FontIcon()
                {
                    Glyph = CommonGlyphs.PowerButton
                }
            };
            exitItem.Click += (_, __) => FlyoutHandler.SafelyExitApplication();

            TaskbarIconContextMenu = new ContextMenu()
            {
                Items = { settingsItem, exitItem }
            };

            TaskbarIconToolTip = new ToolTip()
            {
                Content = Program.AppName
            };

            TaskbarIcon = new TaskbarIcon()
            {
                TrayToolTip = TaskbarIconToolTip,
                ContextMenu = TaskbarIconContextMenu
            };
            TaskbarIcon.TrayMouseDoubleClick += (_, __) => FlyoutHandler.ShowSettingsWindow();

            #endregion

            UseColoredTrayIcon = AppDataHelper.UseColoredTrayIcon;

            SystemTheme.SystemThemeChanged += OnSystemThemeChange;
            SystemTheme.Initialize();
        }