public MainWindowViewModel()
        {
            Tabs = new ObservableCollection<ViewModelBase>(new ViewModelBase[]
            {
                ServerListViewModel = new ServerListViewModel()
            });
            CurrentTab = Tabs.First();

            ServerList = new Core.ServerList();
            Launcher = new GameLauncher();

            SettingsViewModel = new SettingsViewModel();
            UpdatesViewModel = new UpdatesViewModel(Launcher);
            UpdatesViewModel.LocatorChanged += (sender, e) => { ServerList.GetAndUpdateAll(); };

            PluginsViewModel = new PluginsViewModel();
            Launcher.ModDetailsChanged += (sender, e) =>
            {
                var modDetails = (MetaModDetails) e.UserState;
                if (modDetails != null && e.Cancelled == false && e.Error == null)
                {
                    Execute.OnUiThread(() => PluginsViewModel.Refresh(modDetails.Plugins));
                }
            };

            ServerListViewModel.Launcher = Launcher;
            UpdatesViewModel.CheckForUpdates();
        }
示例#2
0
 public DayZUpdater(GameLauncher gameLauncher)
 {
     Downloader = new TorrentLauncher(gameLauncher);
     Downloader.PropertyChanged += (sender, args) =>
     {
         if (args.PropertyName == "IsRunning")
         {
             PropertyHasChanged("InstallButtonVisible");
         }
         else if (args.PropertyName == "Status")
         {
             if (Downloader.Status == DayZeroLauncherUpdater.STATUS_INSTALLCOMPLETE)
             {
                 CheckForUpdates(_lastModsJsonLoc);
             }
         }
     };
 }
 public TorrentLauncher(GameLauncher launcher)
 {
     _gameLauncher = launcher;
 }