private OperationResult UpdateSourceDirectoryViewModels(ICollection <SourceDirectory> updateSource) { bool save = false; lock (SourceDirectories) { foreach (var foundDirectory in updateSource) { SourceDirectoryVM vm = SourceDirectories.FirstOrDefault(e => PathHelper.PointsToSameDirectory(e.SrcPath, foundDirectory.SrcPath)); if (vm == null) { vm = new SourceDirectoryVM(this, foundDirectory); SourceDirectories.Add(vm); save = true; continue; } if (vm.MergeConfigurationViewModels(foundDirectory.Configurations) == OperationResult.Success) { save = true; } } if (save) { EnvironmentIsDirty(); } } return(save ? OperationResult.Success : OperationResult.Finished); }
public ConfigurationItem GenerateInitialDirectoryLists() { SourceDirectories.Add(new DirectoryItem { Path = string.Empty }); DestinationDirectories.Add(new DirectoryItem { Path = string.Empty }); return(this); }
private void AcceptFolderToSources(string folder) { if (folder.ValidateDirectory()) { SourceDirectory sourceDir = new SourceDirectory(folder); var sourceExists = SourceDirectories.Where(item => item.DirectoryName == sourceDir.DirectoryName).FirstOrDefault(); if (sourceExists == null) { SourceDirectories.Add(sourceDir); //ensure duplicate entries are not allowed } } }
public MainVM() { SourceDirectories.Add(new SourceDirectoryVM() { AliasEditable = "Hello", Stream = "**stream**" }); SourceDirectories.Add(new SourceDirectoryVM() { AliasEditable = "Foo", Stream = "bar" }); SourceDirectories.Add(new SourceDirectoryVM() { AliasEditable = "Batman", Stream = "Superman" }); }
public MainVM(SettingsVM settings, ICollection <SourceDirectory> sourceDirectories) { Guard.NotNull(settings); _ts = TaskScheduler.FromCurrentSynchronizationContext(); HistoryVM = new HistoryVM(this); OutputVM = new OutputVM(this); SettingsVM = settings; WireupCommands(); if (sourceDirectories != null) { foreach (var src in sourceDirectories) { SourceDirectories.Add(new SourceDirectoryVM(this, src)); } } System.Windows.Data.BindingOperations.EnableCollectionSynchronization(SourceDirectories, SourceDirectories); ThemeHelper.ApplyTheme(SettingsVM.Theme); }