static void RegisterUrlHandlers(IPlayStartupManager startupManager) {
     try {
         startupManager.RegisterUrlHandlers();
     } catch (UnauthorizedAccessException e) {
         MainLog.Logger.FormattedWarnException(e);
     } catch (Exception e) {
         UserError.Throw(new InformationalUserError(e, "failed to register user handlers", null));
     }
 }
Example #2
0
 static void RegisterUrlHandlers(IPlayStartupManager startupManager)
 {
     try {
         startupManager.RegisterUrlHandlers();
     } catch (UnauthorizedAccessException e) {
         MainLog.Logger.FormattedWarnException(e);
     } catch (Exception e) {
         UserErrorHandler.HandleUserError(new InformationalUserError(e, "failed to register user handlers", null));
     }
 }
 public static void Start(IPlayStartupManager startupManager) {
     startupManager.HandleSoftwareUpdate();
     startupManager.ClearAwesomiumCache();
     startupManager.StartAwesomium();
     startupManager.FirstTimeLicenseDialog(new FirstTimeRunDialogViewModel());
     startupManager.RegisterServices();
     RegisterUrlHandlers(startupManager);
     RegisterUserAppKeys(startupManager);
     //startupManager.RegisterOnline();
     startupManager.LaunchSignalr();
 }
Example #4
0
 public static void Start(IPlayStartupManager startupManager)
 {
     startupManager.HandleSoftwareUpdate();
     startupManager.ClearAwesomiumCache();
     startupManager.StartAwesomium();
     startupManager.FirstTimeLicenseDialog(new FirstTimeRunDialogViewModel());
     startupManager.RegisterServices();
     RegisterUrlHandlers(startupManager);
     RegisterUserAppKeys(startupManager);
     //startupManager.RegisterOnline();
     startupManager.LaunchSignalr();
 }
Example #5
0
        protected override void PreStart()
        {
            // TODO: How to deal with other mappers?
            var c = new MapperConfiguration(cfg => {
                cfg.SetupConverters();
                cfg.CreateMap <Collection, CollectionInfo>()
                .Include <CustomCollection, CollectionInfo>()
                .ForMember(x => x.ShortId, opt => opt.MapFrom(src => new ShortGuid(src.Id)));
                cfg.CreateMap <CustomCollection, CollectionInfo>();
                cfg.CreateMap <CustomCollection, CollectionImageDataModel>();
            });

            MappingExtensions.Mapper = c.CreateMapper();
            _startupManager          = Container.GetInstance <IPlayStartupManager>();
            StartupSequence.Start(_startupManager);
            //SetupCookies(Container.GetInstance<IInstalledGamesService>());
            SetupThemes();
            // WARNING - DO NOT SHOW NON-FATAL DIALOGS HERE
        }
        public PlayShellViewModel(IPlayStartupManager startupManager, IDialogManager dialogManager,
                                  IProcessManager processManager,
                                  IEventAggregator eventBus, ISystemInfo systemInfo,
                                  Func <NotificationsCenterViewModel> notificationsCenter, IStatusViewModel statusViewModel,
                                  SettingsViewModel settings, HomeViewModel home,
                                  Lazy <IContentManager> contentManager,
                                  Lazy <ContentViewModel> contentLazy,
                                  IUpdateManager updateManager, IViewModelFactory factory,
                                  ISoftwareUpdate softwareUpdate, ConnectViewModel connect, LocalMachineInfo machineInfo,
                                  UserSettings userSettings, IMediator mediator, IRestarter restarter)
        {
            _contentLazy = contentLazy;
            _restarter   = restarter;
            using (this.Bench()) {
                _startupManager = startupManager;
                _dialogManager  = dialogManager;
                _processManager = processManager;
                _eventBus       = eventBus;
                _systemInfo     = systemInfo;
                _contentManager = contentManager;
                UpdateManager   = updateManager;
                SoftwareUpdate  = softwareUpdate;
                UserSettings    = userSettings;
                _mediator       = mediator;
                _machineInfo    = machineInfo;

                Router = new RoutingState();

                Factory      = factory;
                Connect      = connect;
                Home         = home;
                Settings     = settings;
                StatusFlyout = statusViewModel;

                NotificationsCenter = notificationsCenter();
                // TODO: Normally we would do this only on a user action, like when we would open the menu. It would require the Shell button to be separate from the menu though.
                ProfilesMenu = _mediator.Send(new GetProfilesMenuViewModelQuery());

                DisplayName = GetTitle();

                DidDetectAVRun      = _systemInfo.DidDetectAVRun;
                SecurityStatus      = _startupManager.GetSecurityWarning();
                TrayIconContextMenu = new TrayIconContextMenu(this);
                RecentJumpList      = new RecentJumpList();
                OptionsMenu         = new OptionsMenuViewModel(this);
                ScreenHistory       = new ReactiveList <object>();

                Activator = new ViewModelActivator();

                Application.Current.Exit += (sender, args) => UpdateManager.Terminate();

                Overlay = new OverlayConductor();

                this.SetCommand(x => x.TrayIconDoubleclicked).Subscribe(x => SwitchWindowState());

                this.SetCommand(x => x.Exit).Subscribe(x => {
                    if (!IsBusy())
                    {
                        _mediator.Send(new Shutdown());
                    }
                });

                this.SetCommand(x => x.GoPremiumCommand)
                .Subscribe(x => BrowserHelper.TryOpenUrlIntegrated(new Uri(CommonUrls.MainUrl, "/gopremium")));
                this.SetCommand(x => x.GoPremiumSettingsCommand)
                .Subscribe(
                    x => BrowserHelper.TryOpenUrlIntegrated(new Uri(CommonUrls.ConnectUrl, "settings/premium")));
                this.SetCommand(x => x.SwitchHome).Subscribe(x => SwitchHomeButton());
                this.SetCommand(x => x.GoLatestNewsCommand).Subscribe(x => GoLatestNews());
                this.SetCommand(x => x.SecuritySuiteCommand).Subscribe(x => BrowserHelper.TryOpenUrlIntegrated(
                                                                           "https://community.withsix.com"));

                this.SetCommand(x => x.GoBackCommand, this.WhenAnyValue(x => x.CanGoBack))
                .Subscribe(GoBack);
                this.SetCommand(x => x.GoForwardCommand, this.WhenAnyValue(x => x.CanGoForward))
                .Subscribe(GoForward);
            }
        }