Beispiel #1
0
        public void Load()
        {
            // Settings
            WindowListSingleClick = Settings.Default.WindowListSingleClick;

            // Shortcut
            var shortcut = KeyboardShortcut.FromString(Settings.Default.OpenShortcut);

            ShortcutControlKey        = Enum.IsDefined(typeof(ModifierVirtualKeys), shortcut.ControlVirtualKeyCode) ? (ModifierVirtualKeys)shortcut.ControlVirtualKeyCode : ModifierVirtualKeys.Undefined;
            ShortcutKey               = shortcut.VirtualKeyCode;
            ShortcutPressesBeforeOpen = shortcut.ShortcutPressesBeforeOpen;

            // Warnings
            NoElevatedPrivilegesWarning = !WindowsRuntimeHelper.GetHasElevatedPrivileges();

            // Plugins
            var disabledPlugins = Settings.Default.DisabledPlugins ?? new StringCollection();

            Plugins = _context.PluginsContainer.Plugins
                      .Select(plugin => new SettingsPluginViewModel
            {
                Id      = plugin.Id,
                Enabled = !disabledPlugins.Contains(plugin.Id),
                Name    = plugin.Title
            })
                      .OrderBy(plugin => plugin.Name)
                      .ToList();
            var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;

            Version = String.Format("{0}.{1}.{2}", currentVersion.Major, currentVersion.Minor, currentVersion.Build);

            // Updates
            UpdateAvailable = CheckForUpdatesStatus.Checking;
            _updater.CheckForUpdates(CheckForUpdatesCallback, CheckForUpdatesError);
        }
Beispiel #2
0
        public void ShowStartupTooltip()
        {
            var shortcut = KeyboardShortcut.FromString(Properties.Settings.Default.OpenShortcut);
            var openShortcutDescription = shortcut.ToHumanReadableString();

            var tooltipMessage = $"Press {openShortcutDescription} and start typing to find a window.";

            if (!WindowsRuntimeHelper.GetHasElevatedPrivileges())
            {
                tooltipMessage += Environment.NewLine + Environment.NewLine + "NOTE: Not running with elevated privileges. Performance will be affected; Will not work in applications running as an administrator.";
            }

            _trayIcon.ShowBalloonTip(
                "Go To Window",
                tooltipMessage,
                BalloonIcon.None);
        }