Beispiel #1
0
        private void AddPart(object obj)
        {
            Window mainWindow = Application.Current.MainWindow;

            if (mainWindow == null)
            {
                return;
            }

            PartPropertiesDialog dialog = new PartPropertiesDialog();

            dialog.DataContext = new PartVM(this, obj as PinnedPart ?? new PinnedPart());
            dialog.Owner       = mainWindow;
            if (dialog.ShowDialog() == true)
            {
                PartVM result = (PartVM)dialog.DataContext;

                PinnedParts.Insert(0, result);
                if (!IsExpanded)
                {
                    IsExpanded = true;
                }

                result.IsSelected = true;
                Parent?.Parent?.EnvironmentIsDirty();
            }
        }
Beispiel #2
0
        private void ShowProperties(object obj)
        {
            if (Parent == null)
            {
                return;
            }

            Window mainWindow = Application.Current.MainWindow;

            if (mainWindow == null)
            {
                return;
            }

            PartPropertiesDialog dialog = new PartPropertiesDialog();

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

                var oldModel = Model;
                Model = result.Model;
                OnPropertyChanged(nameof(Alias));
                OnPropertyChanged(nameof(Name));
                OnPropertyChanged(nameof(PartType));
                OnPropertyChanged(nameof(Repository));
                OnPropertyChanged(nameof(PartFile));

                Parent?.Parent?.Parent?.EnvironmentIsDirty();
            }
        }