コード例 #1
0
ファイル: MainVM.cs プロジェクト: rschili/Builder
        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);
        }
コード例 #2
0
 public ConfigurationItem GenerateInitialDirectoryLists()
 {
     SourceDirectories.Add(new DirectoryItem {
         Path = string.Empty
     });
     DestinationDirectories.Add(new DirectoryItem {
         Path = string.Empty
     });
     return(this);
 }
コード例 #3
0
        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
                }
            }
        }
コード例 #4
0
ファイル: MainVM.cs プロジェクト: rschili/Builder
 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"
     });
 }
コード例 #5
0
ファイル: MainVM.cs プロジェクト: rschili/Builder
        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);
        }