示例#1
0
 public UpdateCommand(IInstallService installService, ISelfUpdateService selfUpdate)
 {
     Ensure.NotNull(installService, "service");
     Ensure.NotNull(selfUpdate, "selfUpdate");
     this.install    = installService;
     this.selfUpdate = selfUpdate;
 }
示例#2
0
        public UpdateSplashScreenViewModel(ISelfUpdateService selfUpdateService)
        {
            _selfUpdateService = selfUpdateService;
            _selfUpdateService.UpdateStatusChanged += UpdateStatusChanged;

            Messenger.Default.Register <PerformUpdateMessage>(this, PerformUpdateMessageReceived);
        }
示例#3
0
        public SelfUpdateCommand(ApplicationInformation applicationInformation, ISelfUpdateService selfUpdateService, _Assembly targetAssembly)
        {
            if (applicationInformation == null)
            {
                throw new ArgumentNullException("applicationInformation");
            }

            if (selfUpdateService == null)
            {
                throw new ArgumentNullException("selfUpdateService");
            }

            if (targetAssembly == null)
            {
                throw new ArgumentNullException("targetAssembly");
            }

            this.applicationInformation = applicationInformation;
            this.selfUpdateService = selfUpdateService;
            this.targetAssembly = targetAssembly;

            this.Attributes = new CommandAttributes
            {
                CommandName = CommandName,
                AlternativeCommandNames = this.alternativeCommandNames,
                RequiredArguments = new string[] { },
                PositionalArguments = new string[] { },
                Description = string.Format(Resources.SelfUpdateCommand.CommandDescriptionTextTemplate, this.applicationInformation.NameOfExecutable),
                Usage = string.Format("{0}", CommandName),
                Examples = new Dictionary<string, string>
                    {
                        {
                            string.Format("{0}", CommandName),
                            Resources.SelfUpdateCommand.CommandExampleDescription1
                        }
                    },
                ArgumentDescriptions = new Dictionary<string, string>()
            };

            this.Arguments = new Dictionary<string, string>();
        }
示例#4
0
        public UpdatesViewModel(IPackageSourceSelector packageSource, IInstallService installService, ISearchService searchService, SelfPackageConfiguration selfPackageConfiguration, ISelfUpdateService selfUpdate, IComparer <IPackageIdentity> packageVersionComparer)
        {
            Ensure.NotNull(installService, "service");
            Ensure.NotNull(searchService, "searchService");

            Packages  = new ObservableCollection <PackageUpdateViewModel>();
            Refresh   = new RefreshUpdatesCommand(this, packageSource, installService, searchService, selfPackageConfiguration, packageVersionComparer);
            Update    = new UpdateCommand(installService, selfUpdate);
            UpdateAll = new UpdateAllCommand(this);
        }
示例#5
0
        public MainViewModel(IPackageSourceCollection sources, ISearchService search, IInstallService install, SelfPackageConfiguration selfPackageConfiguration, ISelfUpdateService selfUpdate, IComparer <IPackageIdentity> packageVersionComparer)
        {
            SourceSelector = new PackageSourceSelectorViewModel(sources);

            Browser   = new BrowserViewModel(SourceSelector, search, install);
            Installed = new InstalledViewModel(SourceSelector, install, selfPackageConfiguration);
            Updates   = new UpdatesViewModel(SourceSelector, install, search, selfPackageConfiguration, selfUpdate, packageVersionComparer);

            Cancel = new CancelCommand(
                Browser.Search,
                Browser.Install,
                Installed.Uninstall,
                Installed.UninstallAll,
                Installed.Reinstall,
                Installed.Refresh,
                Updates.Update,
                Updates.UpdateAll,
                Updates.Refresh
                );
            Cancel.CanExecuteChanged += OnCancelCanExecuteChanged;

            Installed.Uninstall.Completed += OnInstalledChanged;
            Updates.Update.Completed      += OnInstalledChanged;
        }
        public MainViewModel(
            ILogger logger,
            ISettingsProvider settingsProvider,
            INewsProvider newsProvider,
            IHelpProvider helpProvider,
            IServerListProvider serverListProvider,
            IStatisticsProvider statisticsProvider,
            IServerStatusProvider serverStatusProvider,
            INotificationService notificationService,
            ISelfUpdateService selfUpdateService,
            IGameBackupService gameBackupService,
            IServerHostProvider serverHostProvider,
            ITroubleshootProvider troubleshootProvider,
            IProtocolGameLauncherService protocolGameLauncherService)
        {
            _logger               = logger;
            _settingsProvider     = settingsProvider;
            _newsProvider         = newsProvider;
            _helpProvider         = helpProvider;
            _serverListProvider   = serverListProvider;
            _statisticsProvider   = statisticsProvider;
            _serverStatusProvider = serverStatusProvider;
            _selfUpdateService    = selfUpdateService;
            _serverHostProvider   = serverHostProvider;
            _troubleshootProvider = troubleshootProvider;
            NotificationService   = notificationService;

            LoadTheme(_settingsProvider.GetCurrentSettings().DarkTheme);

            AboutCommand = new RelayCommand(AboutButtonClicked);
            LaunchButtonClickedCommand     = new RelayCommand(LaunchButtonClicked);
            BrowseGameFileCommand          = new RelayCommand(BrowseGameFileClicked);
            BrowseServerFileCommand        = new RelayCommand(BrowseServerFileClicked);
            ApplySettingsCommand           = new RelayCommand(ApplySettingsClicked);
            BrowseResourceDirectoryCommand = new RelayCommand(BrowseResourceDirectoryClicked);
            OpenServerSettingsXmlCommand   = new RelayCommand(EditServerSettingsXmlClicked);
            StartServerCommand             = new RelayCommand(StartServerClicked);
            StopServerCommand            = new RelayCommand(StopServerClicked);
            RestartServerCommand         = new RelayCommand(RestartServerClicked);
            RemoveNotificationCommand    = new RelayCommand <Notification>(RemoveNotificationClicked);
            ServerListTabGotFocusCommand = new RelayCommand <ServerBrowserViewModel>(ServerListTabGotFocus);

            ServerListViewModel = SimpleIoc.Default.GetInstanceWithoutCaching <ServerBrowserViewModel>();

            VerifiedServerListViewModel = SimpleIoc.Default.GetInstanceWithoutCaching <ServerBrowserViewModel>();
            VerifiedServerListViewModel.ServerFilter = s => s.IsVerified;

            FavoriteServerListViewModel = SimpleIoc.Default.GetInstanceWithoutCaching <ServerBrowserViewModel>();
            FavoriteServerListViewModel.ServerFilter = s => s.IsFavorited;

            LocalServerListViewModel = SimpleIoc.Default.GetInstanceWithoutCaching <ServerBrowserViewModel>();
            LocalServerListViewModel.ServerFilter = s => s.LAN;

            RecentServerListViewModel = SimpleIoc.Default.GetInstanceWithoutCaching <ServerBrowserViewModel>();
            RecentServerListViewModel.ServerFilter = s => s.IsRecent;

            _serverListProvider.FavoritedServersUpdated += ServerListProviderOnFavoritedServersUpdated;
            _settingsProvider.SettingsSaved             += SettingsSaved;

            CheckForUpdate();
            GetNews();
            GetTroubleshooting();
            GetHelpItems();
            GetStatistics();
            GetServerStatus();

            if (_settingsProvider.GetCurrentSettings().AskToBackUpGame)
            {
                gameBackupService.CheckBackupStatus();
            }

            protocolGameLauncherService.CheckIfLaunchArgumentExists();
            protocolGameLauncherService.TryVerifyProtocolRegistration();

            EnsureEula();
        }