Example #1
0
        public SettingsViewModel(IGoToWindowContext context)
        {
            _context = context;
            _enabled = true;
            _updater = SquirrelContext.AcquireUpdater();

            Load();
        }
	    public SettingsViewModel(IGoToWindowContext context)
		{
			_context = context;
			_enabled = true;
			_updater = SquirrelContext.AcquireUpdater();

			Load();
		}
Example #3
0
        public GoToWindowTrayIcon(IGoToWindowContext context)
        {
            _context = context;

            _trayIcon = new TaskbarIcon
            {
                Icon               = Properties.Resources.AppIcon,
                ToolTipText        = "Go To Window",
                DoubleClickCommand = new OpenMainWindowCommand(_context),
                ContextMenu        = CreateContextMenu()
            };
        }
		public GoToWindowTrayIcon(IGoToWindowContext context)
		{
			_context = context;

			_trayIcon = new TaskbarIcon
			{
				Icon = Properties.Resources.AppIcon,
				ToolTipText = "Go To Window",
				DoubleClickCommand = new OpenMainWindowCommand(_context),
				ContextMenu = CreateContextMenu()
			};
		}
Example #5
0
        private void Application_Exit(object sender, ExitEventArgs e)
        {
            SquirrelContext.Dispose();

            if (_menu != null)
            {
                _menu.Dispose();
                _menu = null;
            }

            if (_context != null)
            {
                _context.Dispose();
                _context = null;
            }

            if (_mutex != null)
            {
                _mutex.Dispose();
                _mutex = null;
            }

            Log.Info("Application exited.");
        }
 public ShowSettingsCommand(IGoToWindowContext context)
 {
     _context = context;
 }
		public ShowSettingsCommand(IGoToWindowContext context)
		{
			_context = context;
		}
Example #8
0
		private void Application_Startup(object sender, StartupEventArgs e)
		{
			var isFirstRun = false;
			if(e.Args.Any() && e.Args[0].StartsWith("--squirrel"))
			{
				var cliHandler = new SquirrelCommandLineArgumentsHandler();
				if (cliHandler.HandleSquirrelArguments(e.Args))
				{
					Log.Info("Handled Squirrel arguments. Shutting down.");
					Current.Shutdown(1);
					return;
				}

				isFirstRun = cliHandler.IsFirstRun;
			}

			if (!WaitForOtherInstancesToShutDown())
			{
				MessageBox.Show(
					"Another Go To Window instance is already running." + Environment.NewLine +
					"Exit by right-clicking the icon in the tray, and selecting 'Exit'.",
					"Go To Window",
					MessageBoxButton.OK,
					MessageBoxImage.Information
					);
				Log.Warn("Application already running. Shutting down.");
				Current.Shutdown(1);
				return;
			}

			// http://stackoverflow.com/questions/14635862/exception-occurs-while-pressing-a-button-on-touchscreen-using-a-stylus-or-a-fing
			DisableWpfTabletSupport();

			_context = new GoToWindowContext();
			
			_menu = new GoToWindowTrayIcon(_context);

			var shortcut = KeyboardShortcut.FromString(GoToWindow.Properties.Settings.Default.OpenShortcut);
			_context.EnableKeyboardHook(shortcut);

			_context.Init();

			if (shortcut.IsValid)
				Log.InfoFormat("Application started. Shortcut is '{0}' ({1})", shortcut.ToHumanReadableString(), GoToWindow.Properties.Settings.Default.OpenShortcut);
			else
				Log.WarnFormat("Application started with invalid shortcut. Shortcut is '{0}', reason: {1}", GoToWindow.Properties.Settings.Default.OpenShortcut, shortcut.InvalidReason);

			if (isFirstRun)
			{
				Log.Info("Squirrel: First run");
				Dispatcher.InvokeAsync(() =>
				{
					new FirstRunWindow(_context) {DataContext = new FirstRunViewModel()}.Show();
				});
			}
			else
			{
				_menu.ShowStartupTooltip();
			}

			SquirrelContext.AcquireUpdater().CheckForUpdates(_context.UpdateAvailable, null);
		}
Example #9
0
		private void Application_Exit(object sender, ExitEventArgs e)
		{
            SquirrelContext.Dispose();

			if (_menu != null)
			{
				_menu.Dispose();
				_menu = null;
			}

			if (_context != null)
			{
				_context.Dispose();
				_context = null;
			}

			if (_mutex != null)
			{
				_mutex.Dispose();
				_mutex = null;
			}

			Log.Info("Application exited.");
		}
Example #10
0
 public OpenMainWindowCommand(IGoToWindowContext context)
 {
     _context = context;
 }
Example #11
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var isFirstRun = false;

            if (e.Args.Any() && e.Args[0].StartsWith("--squirrel"))
            {
                var cliHandler = new SquirrelCommandLineArgumentsHandler();
                if (cliHandler.HandleSquirrelArguments(e.Args))
                {
                    Log.Info("Handled Squirrel arguments. Shutting down.");
                    Current.Shutdown(1);
                    return;
                }

                isFirstRun = cliHandler.IsFirstRun;
            }

            if (!WaitForOtherInstancesToShutDown())
            {
                MessageBox.Show(
                    "Another Go To Window instance is already running." + Environment.NewLine +
                    "Exit by right-clicking the icon in the tray, and selecting 'Exit'.",
                    "Go To Window",
                    MessageBoxButton.OK,
                    MessageBoxImage.Information
                    );
                Log.Warn("Application already running. Shutting down.");
                Current.Shutdown(1);
                return;
            }

            // http://stackoverflow.com/questions/14635862/exception-occurs-while-pressing-a-button-on-touchscreen-using-a-stylus-or-a-fing
            DisableWpfTabletSupport();

            _context = new GoToWindowContext();

            _menu = new GoToWindowTrayIcon(_context);

            var shortcut = KeyboardShortcut.FromString(GoToWindow.Properties.Settings.Default.OpenShortcut);

            _context.EnableKeyboardHook(shortcut);

            _context.Init();

            if (shortcut.IsValid)
            {
                Log.InfoFormat("Application started. Shortcut is '{0}' ({1})", shortcut.ToHumanReadableString(), GoToWindow.Properties.Settings.Default.OpenShortcut);
            }
            else
            {
                Log.WarnFormat("Application started with invalid shortcut. Shortcut is '{0}', reason: {1}", GoToWindow.Properties.Settings.Default.OpenShortcut, shortcut.InvalidReason);
            }

            if (isFirstRun)
            {
                Log.Info("Squirrel: First run");
                Dispatcher.InvokeAsync(() =>
                {
                    new FirstRunWindow(_context)
                    {
                        DataContext = new FirstRunViewModel()
                    }.Show();
                });
            }
            else
            {
                _menu.ShowStartupTooltip();
            }

            SquirrelContext.AcquireUpdater().CheckForUpdates(_context.UpdateAvailable, null);
        }
 public FirstRunWindow(IGoToWindowContext context)
     : this()
 {
     context.Showing += context_Showing;
 }
		public FirstRunWindow(IGoToWindowContext context)
			: this()
		{
			context.Showing += context_Showing;
		}
		public OpenMainWindowCommand(IGoToWindowContext context)
		{
			_context = context;
		}