public SynchronizationViewModel InitializeView()
 {
     DateTime lastSynchronizationDate = DateTime.MinValue;
     if (_configurationManager.GetConfig("Common")
                              .GetSection("Synchronization")
                              .GetSetting("LastSyncDate").Value != string.Empty)
         lastSynchronizationDate = _configurationManager.GetConfig("Common")
                                                        .GetSection("Synchronization")
                                                        .GetSetting("LastSyncDate").As<DateTime>();
     _viewModel = new SynchronizationViewModel
         {
             SynchronizeFully = false,
             LastSynchronizationDate = lastSynchronizationDate
         };
     return _viewModel;
 }
Ejemplo n.º 2
0
        private void SynchronizationViewLoad(object sender, EventArgs e)
        {
            if (_synchronizationPresenter == null) {
                _synchronizationPresenter = _presentersFactory.CreateSynchronizationPresenter(this, _autostart);
                ViewModel = _synchronizationPresenter.InitializeView();
                ViewModel = ViewModel;

                _synchronizeFullyCheckBox.Checked = ViewModel.SynchronizeFully;
                _lastSyncDateLabel.Text = ViewModel.LastSynchronizationDate != DateTime.MinValue
                                          ? ViewModel.LastSynchronizationDate.ToString(_localizationManager.Localization.GetLocalizedValue("datetimeformat"))
                                          : _localizationManager.Localization.GetLocalizedValue("never");

                if (_autostart) {
                    _synchronizeFullyCheckBox.Checked = true;
                    _synchronizationPresenter.Synchronize();
                }
                else {
                    ViewContainer.RegisterLeftAction(new Synchronize(_synchronizationPresenter));
                    ViewContainer.RegisterRightAction(new Cancel(_synchronizationPresenter));
                }
            }
        }