private void StartUpdate()
        {
            var cancellationToken   = _cancellationTokenSource.Token;
            var currentUpdaterModel = this.updaterModelBindingSource.Current as UpdaterModel;

            var progress = new Progress <int>(value => {
                UpdateStatus($"Updating... {value}%");
                progressBar.Value = value;
            });

            buttonDownload.Enabled    = false;
            buttonOk.Enabled          = false;
            buttonInstallPath.Enabled = false;
            buttonCancel.Text         = "&Cancel";

            UpdateStatus("Updating... 0%");
            if (_updaterService.Update(currentUpdaterModel, progress, cancellationToken))
            {
                UpdateStatus("Updated.");
                MessageBox.Show("Update was successful. You may now run the application again.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Update failed. Please submit an issue and attach the log.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            buttonDownload.Enabled    = true;
            buttonOk.Enabled          = true;
            buttonInstallPath.Enabled = true;
            buttonCancel.Text         = "&Close";
        }
Beispiel #2
0
        /// <summary>
        /// Método que se encarga de invocar el servicio de actualización de registro de un catálogo, realiza la transformación del la "vista modelo" a la "entidad" del catálogo a actualizar.
        /// </summary>
        /// <param name="_id"> Representa el identificador de una entidad a actualizar del catálogo </param>
        /// <param name="_viewModel"> Representa la información nueva a actualizar del catálogo </param>
        public void Update(Guid _id, TViewModel _viewModel)
        {
            TEntity entity = finderService.Get(_id);

            mapper.Map(_viewModel, entity);
            updateService.Update(_id, entity);
        }
Beispiel #3
0
        public SyncBlockViewModel(IUpdaterService updaterService)
        {
            _updaterService = updaterService;
            _unsubscriber   = _updaterService.Subscribe(this);

            SyncBlockInfos         = new ObservableCollection <SyncBlockInfo>();
            CombinedBlockInfos     = new ObservableCollection <CombinedBlockInfo>();
            RegistryFullBlockInfos = new ObservableCollection <RegistryFullBlockInfo>();

            _timer = new Timer(new TimerCallback(o =>
            {
                if (!_initialized)
                {
                    lock (_updaterService)
                    {
                        if (!_initialized)
                        {
                            _updaterService.Initialize();
                            _initialized = true;
                        }
                    }
                }

                _updaterService.Update();
            }), null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
        }