Пример #1
0
        private bool Validate(out string errorMessage, out IOptionsViewModel firstViewModelWithError)
        {
            StringBuilder errorMessageBuilder = new StringBuilder();
            bool          isValid             = true;

            firstViewModelWithError = null;

            foreach (var viewModel in _options)
            {
                StringBuilder currentControlErrorMessageBuilder = new StringBuilder();

                if (!viewModel.Validate(currentControlErrorMessageBuilder))
                {
                    if (errorMessageBuilder.Length > 0)
                    {
                        errorMessageBuilder.AppendLine();
                    }

                    errorMessageBuilder.AppendFormat(Strings.Get($"Profile '{viewModel.Name}'"));
                    errorMessageBuilder.AppendLine();
                    errorMessageBuilder.Append(currentControlErrorMessageBuilder);

                    isValid = false;
                    if (firstViewModelWithError == null)
                    {
                        firstViewModelWithError = viewModel;
                    }
                }
            }

            errorMessage = errorMessageBuilder.ToString();
            return(isValid);
        }
Пример #2
0
        protected override void SetOptionsOverride(CalDavSynchronizer.Contracts.Options options)
        {
            MappingConfigurationViewModel = options.MappingConfiguration?.CreateConfigurationViewModel(_mappingConfigurationViewModelFactory);

            CoerceMappingConfiguration();

            MappingConfigurationViewModel?.SetOptions(options);
        }
Пример #3
0
 private void CoerceMappingConfiguration()
 {
     MappingConfigurationViewModel = OptionTasks.CoerceMappingConfiguration(
         MappingConfigurationViewModel,
         _outlookFolderViewModel.OutlookFolderType,
         _serverSettingsViewModel.IsGoogle,
         _mappingConfigurationViewModelFactory);
 }
Пример #4
0
 /// <remarks>
 /// Just for creating the DesingInstance
 /// </remarks>
 public GenericOptionsViewModel(IOptionsViewModelParent parent, NetworkSettingsViewModel networkSettingsViewModel, OutlookFolderViewModel outlookFolderViewModel, IServerSettingsViewModel serverSettingsViewModel, SyncSettingsViewModel syncSettingsViewModel, IOptionsViewModel mappingConfigurationViewModel)
     : base(parent)
 {
     _networkSettingsViewModel     = networkSettingsViewModel;
     _outlookFolderViewModel       = outlookFolderViewModel;
     _serverSettingsViewModel      = serverSettingsViewModel;
     _syncSettingsViewModel        = syncSettingsViewModel;
     MappingConfigurationViewModel = mappingConfigurationViewModel;
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShellViewModel"/> class.
 /// </summary>
 /// <param name="errorService">
 /// The error Service.
 /// </param>
 /// <param name="mainViewModel">
 /// The main View Model.
 /// </param>
 /// <param name="optionsViewModel">
 /// The options View Model.
 /// </param>
 public ShellViewModel(IErrorService errorService, IMainViewModel mainViewModel, IOptionsViewModel optionsViewModel)
 {
     this.errorService = errorService;
     this.showMainWindow = true;
     this.showOptions = false;
     this.IsMainPanelEnabled = true;
     this.MainViewModel = mainViewModel;
     this.OptionsViewModel = optionsViewModel;
 }
Пример #6
0
        public GameViewModel(IOptionsViewModel optionsViewModel)
        {
            this.optionsViewModel = optionsViewModel;
            Clients = new ObservableCollection <Client>();
            communicationsManager = new CommunicationsManager();

            communicationsManager.MessageReceived += CommunicationsManagerOnMessageReceived;

            communicationsManager.Start();
        }
Пример #7
0
        private void Delete(IOptionsViewModel viewModel)
        {
            var index = _options.IndexOf(viewModel);

            _options.Remove(viewModel);
            if (_options.Count > 0)
            {
                _options[Math.Max(0, Math.Min(_options.Count - 1, index))].IsSelected = true;
            }
        }
Пример #8
0
        public void WhenDone(int action, bool saveChange)
        {
            this.WhenDoneAction = (WhenDone)action;

            if (saveChange)
            {
                this.userSettingService.SetUserSetting(UserSettingConstants.WhenCompleteAction, action);
            }

            IOptionsViewModel ovm = IoC.Get <IOptionsViewModel>();

            ovm.UpdateSettings();
        }
Пример #9
0
        private void ClearCache(IOptionsViewModel viewModel)
        {
            s_logger.InfoFormat("Deleting cache for profile '{0}'", viewModel.Name);

            var profileDataDirectory = _profileDataDirectoryFactory(viewModel.Model.Id);

            if (Directory.Exists(profileDataDirectory))
            {
                Directory.Delete(profileDataDirectory, true);
            }

            MessageBox.Show(Strings.Get($"A new intial sync will be performed with the next sync run!"), Strings.Get($"Profile cache deleted"), MessageBoxButton.OK, MessageBoxImage.Information);
        }
        public void RequestCacheDeletion(IOptionsViewModel viewModel)
        {
            s_logger.InfoFormat("Deleting cache for profile '{0}'", viewModel.Name);

            var profileDataDirectory = _profileDataDirectoryFactory(viewModel.Id);

            if (Directory.Exists(profileDataDirectory))
            {
                Directory.Delete(profileDataDirectory, true);
            }

            MessageBox.Show("A new intial sync will be performed with the next sync run!", "Profile cache deleted", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Пример #11
0
        private void Copy(IOptionsViewModel viewModel)
        {
            var modelCopy = viewModel.Model.Clone();

            modelCopy.Name += " (Copy)";

            var index = _options.IndexOf(viewModel) + 1;

            var newViewModel = modelCopy.ModelFactory.CreateViewModel(modelCopy);

            _options.Insert(index, newViewModel);

            ShowProfile(newViewModel.Model.Id);
        }
        private void Copy(IOptionsViewModel viewModel)
        {
            var options = viewModel.GetOptionsOrNull();

            if (options != null)
            {
                options.Id    = Guid.NewGuid();
                options.Name += " (Copy)";

                var index = _options.IndexOf(viewModel) + 1;

                foreach (var vm in _optionsViewModelFactory.Create(new[] { options }, _generalOptions))
                {
                    _options.Insert(index, vm);
                }

                ShowProfile(options.Id);
            }
        }
Пример #13
0
        public static IOptionsViewModel CoerceMappingConfiguration(
            IOptionsViewModel currentMappingConfiguration,
            OlItemType?outlookFolderType,
            bool isGoogleProfile,
            IMappingConfigurationViewModelFactory factory)
        {
            switch (outlookFolderType)
            {
            case OlItemType.olAppointmentItem:
                return(currentMappingConfiguration as EventMappingConfigurationViewModel ?? factory.Create(new EventMappingConfiguration()));

            case OlItemType.olContactItem:
                return(currentMappingConfiguration as ContactMappingConfigurationViewModel ?? factory.Create(new ContactMappingConfiguration()));

            case OlItemType.olTaskItem:
                return(isGoogleProfile
              ? null
              : currentMappingConfiguration as TaskMappingConfigurationViewModel ?? factory.Create(new TaskMappingConfiguration()));

            default:
                return(null);
            }
        }
 public void RequestRemoval (IOptionsViewModel viewModel)
 {
 
 }
 public void RequestCacheDeletion (IOptionsViewModel viewModel)
 {
   
 }
Пример #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShellViewModel"/> class.
 /// </summary>
 /// <param name="errorService">
 /// The error Service.
 /// </param>
 /// <param name="mainViewModel">
 /// The main View Model.
 /// </param>
 /// <param name="optionsViewModel">
 /// The options View Model.
 /// </param>
 public ShellViewModel(IErrorService errorService, IMainViewModel mainViewModel, IOptionsViewModel optionsViewModel)
 {
     this.errorService       = errorService;
     this.showMainWindow     = true;
     this.showOptions        = false;
     this.IsMainPanelEnabled = true;
     this.MainViewModel      = mainViewModel;
     this.OptionsViewModel   = optionsViewModel;
     //this.OverlayPanelViewModel = overlayPanel;
 }
    private bool Validate (out string errorMessage, out IOptionsViewModel firstViewModelWithError)
    {
      StringBuilder errorMessageBuilder = new StringBuilder ();
      bool isValid = true;
      firstViewModelWithError = null;

      foreach (var viewModel in _options)
      {
        StringBuilder currentControlErrorMessageBuilder = new StringBuilder ();

        if (!viewModel.Validate (currentControlErrorMessageBuilder))
        {
          if (errorMessageBuilder.Length > 0)
            errorMessageBuilder.AppendLine ();

          errorMessageBuilder.AppendFormat ("Profile '{0}'", viewModel.Name);
          errorMessageBuilder.AppendLine ();
          errorMessageBuilder.Append (currentControlErrorMessageBuilder);

          isValid = false;
          if (firstViewModelWithError == null)
            firstViewModelWithError = viewModel;
        }
      }

      errorMessage = errorMessageBuilder.ToString ();
      return isValid;
    }
 private void Delete (IOptionsViewModel viewModel)
 {
   var index = _options.IndexOf (viewModel);
   _options.Remove (viewModel);
   if (_options.Count > 0)
     _options[Math.Max (0, Math.Min (_options.Count - 1, index))].IsSelected = true;
 }
Пример #19
0
 public void RequestRemoval(IOptionsViewModel viewModel)
 {
 }
Пример #20
0
 public OptionsWindow(IOptionsViewModel viewModel)
     : base(viewModel)
 {
     InitializeComponent();
 }
    public void RequestCacheDeletion (IOptionsViewModel viewModel)
    {
     
        s_logger.InfoFormat ("Deleting cache for profile '{0}'", viewModel.Name);

        var profileDataDirectory = _profileDataDirectoryFactory (viewModel.Id);
        if (Directory.Exists (profileDataDirectory))
          Directory.Delete (profileDataDirectory, true);

        MessageBox.Show ("A new intial sync will be performed with the next sync run!", "Profile cache deleted",MessageBoxButton.OK, MessageBoxImage.Information);
    
    }
 public void RequestRemoval (IOptionsViewModel viewModel)
 {
   Delete (viewModel);
 }
Пример #23
0
 public OptionsWindow(IOptionsViewModel viewModel)
     : base(viewModel)
 {
     InitializeComponent();
 }
Пример #24
0
 public GameWindow(IOptionsViewModel options)
 {
     InitializeComponent();
     this.DataContext = new GameViewModel(options);
 }
Пример #25
0
 public void RequestRemoval(IOptionsViewModel viewModel)
 {
     Delete(viewModel);
 }
    private void Copy (IOptionsViewModel viewModel)
    {
      var options = viewModel.GetOptionsOrNull ();
      if (options != null)
      {
        options.Id = Guid.NewGuid();
        options.Name += " (Copy)";

        var index = _options.IndexOf (viewModel) + 1;

        foreach (var vm in _optionsViewModelFactory.Create (new[] { options }, _generalOptions))
          _options.Insert (index, vm);

        ShowProfile (options.Id);
      }
    }
Пример #27
0
 public void RequestCacheDeletion(IOptionsViewModel viewModel)
 {
 }