Exemple #1
0
        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);
        }
Exemple #2
0
        private void ShowProperties(object obj)
        {
            if (Parent == null)
            {
                return;
            }

            Window mainWindow = Application.Current.MainWindow;

            if (mainWindow == null)
            {
                return;
            }

            SourceDirectoryPropertiesDialog dialog = new SourceDirectoryPropertiesDialog();

            dialog.DataContext = Copy();
            dialog.Owner       = mainWindow;
            if (dialog.ShowDialog() == true)
            {
                SourceDirectoryVM result = (SourceDirectoryVM)dialog.DataContext;
                if (!result.IsDirty)
                {
                    return;
                }

                Model = result.Model;
                OnPropertyChanged(nameof(Alias));
                OnPropertyChanged(nameof(SrcPath));
                OnPropertyChanged(nameof(Stream));

                Parent.EnvironmentIsDirty();
            }
        }
Exemple #3
0
        public ConfigurationVM(SourceDirectoryVM parent, Configuration model)
        {
            Parent = parent;
            Model  = model;
            WireupCommands();

            if (model.PinnedParts != null)
            {
                foreach (var part in model.PinnedParts)
                {
                    PinnedParts.Add(new PartVM(this, part));
                }
            }

            System.Windows.Data.BindingOperations.EnableCollectionSynchronization(PinnedParts, PinnedParts);
        }
Exemple #4
0
        private void AddSourceDirectory(object obj)
        {
            Window mainWindow = Application.Current.MainWindow;

            if (mainWindow == null)
            {
                return;
            }

            SourceDirectoryPropertiesDialog dialog = new SourceDirectoryPropertiesDialog();

            dialog.DataContext = new SourceDirectoryVM(this);
            dialog.Owner       = mainWindow;
            if (dialog.ShowDialog() == true)
            {
                SourceDirectoryVM result = (SourceDirectoryVM)dialog.DataContext;

                SourceDirectories.Insert(0, result);
                result.IsSelected = true;
                EnvironmentIsDirty();
            }
        }
Exemple #5
0
 public ConfigurationVM(SourceDirectoryVM parent) : this(parent, new Configuration())
 {
 }