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); }
protected override void SetOptionsOverride(CalDavSynchronizer.Contracts.Options options) { MappingConfigurationViewModel = options.MappingConfiguration?.CreateConfigurationViewModel(_mappingConfigurationViewModelFactory); CoerceMappingConfiguration(); MappingConfigurationViewModel?.SetOptions(options); }
private void CoerceMappingConfiguration() { MappingConfigurationViewModel = OptionTasks.CoerceMappingConfiguration( MappingConfigurationViewModel, _outlookFolderViewModel.OutlookFolderType, _serverSettingsViewModel.IsGoogle, _mappingConfigurationViewModelFactory); }
/// <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; }
/// <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; }
public GameViewModel(IOptionsViewModel optionsViewModel) { this.optionsViewModel = optionsViewModel; Clients = new ObservableCollection <Client>(); communicationsManager = new CommunicationsManager(); communicationsManager.MessageReceived += CommunicationsManagerOnMessageReceived; communicationsManager.Start(); }
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; } }
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(); }
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); }
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); } }
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) { }
/// <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; }
public void RequestRemoval(IOptionsViewModel viewModel) { }
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); }
public GameWindow(IOptionsViewModel options) { InitializeComponent(); this.DataContext = new GameViewModel(options); }
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); } }
public void RequestCacheDeletion(IOptionsViewModel viewModel) { }