Exemplo n.º 1
0
        //TODO DarthAffe 06.01.2016: This is a somehow weird design ...
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            this.DispatcherUnhandledException += OnDispatcherUnhandledException;

            _apiService    = new HikariApiService();
            _configService = new ConfigService();
            _patchService  = new PatchService(_apiService, UpdateStatusFunc);

            _topBarViewModel     = new TopBarViewModel(_configService);
            _gamesViewModel      = new GamesViewModel(_configService, _patchService);
            _mainWindowViewModel = new MainWindowViewModel(_apiService, _topBarViewModel, _gamesViewModel);

            new MainWindow {
                DataContext = _mainWindowViewModel
            }.Show();
        }
Exemplo n.º 2
0
        /// <summary>
        ///     The patch process needs to happen before dependencies are loaded
        /// </summary>
        private static void PatchCheck()
        {
            if (!Directory.Exists(PathConfiguration.ApplicationDirectory))
            {
                Directory.CreateDirectory(PathConfiguration.ApplicationDirectory);
            }

            var path     = Path.Combine(PathConfiguration.ApplicationDirectory, "version");
            var current  = SemanticVersion.Application;
            var previous = GetLoadedVersion(path);

            if (previous != current)
            {
                var(updated, failed) = new PatchService().Patch(previous.ToVersion(), current.ToVersion());
                if (!failed)
                {
                    File.WriteAllText(path, current.ToString());
                }
            }
        }
        public virtual IActionResult Patch(int id, [FromBody] JsonPatchDocument <TUpdateModel> patch)
        {
            var result = PatchService.Patch(id, patch);

            return(Ok(result));
        }
Exemplo n.º 4
0
        public GamesViewModel(ConfigService configService, PatchService patchService)
        {
            this._patchService = patchService;

            _config = configService.Config;
        }
 public void RunPatch(string name)
 {
     PatchService.Run(_session, name);
 }