Example #1
0
        public MainWindow()
        {
            InitializeComponent();
            userSessionService = new UserSessionService();

            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...");
            }
            catch (AddressAlreadyInUseException)
            {
                Log.Info("Address for UserSessionService is already in use");
            }
            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);

            if (!Installation.IsProductInstalled(MPExtendedProduct.WebMediaPortal))
            {
                taskbarItemContextMenu.Items.Remove(MenuOpenWebMP);
            }
        }
Example #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);
        }