Esempio n. 1
0
 private void MenuStartCloseMp_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         bool isMpRunning = userSessionService.IsMediaPortalRunning().Result;
         if (!isMpRunning)
         {
             userSessionService.StartMediaPortal();
             HandleMpState(true);
         }
         else
         {
             userSessionService.CloseMediaPortal();
             HandleMpState(false);
         }
     }
     catch (Exception ex)
     {
         Log.Warn("Exception while trying to start/stop MediaPortal", ex);
     }
 }
Esempio n. 2
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                Log.Debug("MPExtended.Applications.ServiceConfigurator starting...");
                ussHost     = new ServiceHost(typeof(MPExtended.Services.UserSessionService.UserSessionService));
                privateHost = new ServiceHost(typeof(MPExtended.Applications.ServiceConfigurator.Code.PrivateUserSessionService));

                Log.Debug("Opening ServiceHost...");
                ussHost.Open();
                privateHost.Open();

                Log.Info("UserSessionService started...");
                userSessionService = new UserSessionService();
            }
            catch (Exception ex)
            {
                Log.Error("Failed to start service", ex);
            }

            try
            {
                MainFrame.Navigate(new Pages.ServiceConfiguration());
            }
            catch (Exception ex)
            {
                Log.Error("Failed to open configurator", ex);
                ErrorHandling.ShowError(ex);
            }

            if (StartupArguments.RunAsTrayApp && !StartupArguments.OpenOnStart)
            {
                Hide();
            }

            HandleMpState(userSessionService.IsMediaPortalRunning().Result);
        }