Example #1
0
 private void HideMainWindow()
 {
     if (_mainWindow != null)
     {
         _mainWindow.Hide();
         _mainWindow = null;
     }
 }
Example #2
0
        private void ShowMainWindow()
        {
            var host = _appHost;

            var win = new MainWindow(host.LogManager, host,
                                     host.ServerConfigurationManager, host.UserManager,
                                     host.LibraryManager, host.JsonSerializer,
                                     host.DisplayPreferencesRepository);

            win.Show();

            _mainWindow = win;
        }
Example #3
0
		public static void Shutdown()
		{
			if (trayIcon != null) {
				trayIcon.Visible = false;
				trayIcon.Dispose ();
				trayIcon = null;
			}

			if (_mainWindow != null) {
				_mainWindow.HideAll ();
				_mainWindow.Dispose ();
				_mainWindow = null;
			}

			Application.Quit ();
		}
Example #4
0
		private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager)
		{
			// TODO: Show splash here

			SystemEvents.SessionEnding += SystemEvents_SessionEnding;

			// Allow all https requests
			ServicePointManager.ServerCertificateValidationCallback = _ignoreCertificates;

			_appHost = new ApplicationHost(appPaths, logManager);

			var task = _appHost.Init();
			Task.WaitAll (task);

			task = _appHost.RunStartupTasks();
			Task.WaitAll (task);

			// TODO: Hide splash here
			_mainWindow = new MainWindow ();

			// Creation of the Icon
			// Creation of the Icon
			trayIcon = new StatusIcon(new Pixbuf ("tray.png"));
			trayIcon.Visible = true;

			// When the TrayIcon has been clicked.
			trayIcon.Activate += delegate { };
			// Show a pop up menu when the icon has been right clicked.
			trayIcon.PopupMenu += OnTrayIconPopup;

			// A Tooltip for the Icon
			trayIcon.Tooltip = "Media Browser Server";

			_mainWindow.ShowAll ();
			_mainWindow.Visible = false;

			Application.Run ();
		}
Example #5
0
		public static void Restart()
		{
			// Second instance will start first, so release the mutex and dispose the http server ahead of time
			ReleaseMutex (_logger);

			_appHost.Dispose();

			if (trayIcon != null) {
				trayIcon.Visible = false;
				trayIcon.Dispose ();
				trayIcon = null;
			}

			if (_mainWindow != null) {
				_mainWindow.HideAll ();
				_mainWindow.Dispose ();
				_mainWindow = null;
			}

			Application.Quit ();
		}