예제 #1
0
 /// <summary>
 /// Removes a modification from the list of modifications.
 /// </summary>
 /// <param name="modVm">The modification to remove.</param>
 private void RemoveModification(SearchModificationViewModel modVm)
 {
     if (modVm != null)
     {
         this.Modifications.Remove(modVm);
     }
 }
예제 #2
0
        /// <summary>
        /// Implementation for the AddModificationCommand.
        /// Adds a search modification to the modification selector list.
        /// </summary>
        private void AddModificationImplementation()
        {
            var modVm = new SearchModificationViewModel(this.dialogService);

            ////modVm.RemoveModificationCommand.Subscribe(_ => this.RemoveModification(modVm));
            this.Modifications.Add(modVm);
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SettingsViewModel"/> class.
        /// </summary>
        /// <param name="dialogService">Dialog service for opening dialogs from a view model.</param>
        public SettingsViewModel(IMainDialogService dialogService)
        {
            this.dialogService  = dialogService;
            this.ToleranceUnits = new ReactiveList <ToleranceUnit> {
                ToleranceUnit.Ppm, ToleranceUnit.Th
            };
            this.PrecursorIonTolerance               = IcParameters.Instance.PrecursorTolerancePpm.GetValue();
            this.PrecursorIonToleranceUnit           = IcParameters.Instance.PrecursorTolerancePpm.GetUnit();
            this.ProductIonTolerance                 = IcParameters.Instance.ProductIonTolerancePpm.GetValue();
            this.ProductIonToleranceUnit             = IcParameters.Instance.ProductIonTolerancePpm.GetUnit();
            this.IonCorrelationThreshold             = IcParameters.Instance.IonCorrelationThreshold;
            this.PointsToSmooth                      = IcParameters.Instance.PointsToSmooth;
            this.PrecursorRelativeIntensityThreshold = IcParameters.Instance.PrecursorRelativeIntensityThreshold;
            this.ShowInstrumentData                  = IcParameters.Instance.ShowInstrumentData;
            this.AutomaticallySelectIonTypes         = IcParameters.Instance.AutomaticallySelectIonTypes;
            this.CidHcdIonTypes                      = IcParameters.Instance.GetCidHcdIonTypes();
            this.EtdIonTypes    = IcParameters.Instance.GetEtdIonTypes();
            this.ExportImageDpi = IcParameters.Instance.ExportImageDpi;

            this.FeatureColors = new ColorListViewModel();
            this.IdColors      = new ColorListViewModel();

            var oxyScanCol = IcParameters.Instance.Ms2ScanColor;

            this.Ms2ScanColor = new Color {
                A = oxyScanCol.A, R = oxyScanCol.R, G = oxyScanCol.G, B = oxyScanCol.B
            };

            foreach (var color in IcParameters.Instance.FeatureColors)
            {
                this.FeatureColors.ColorViewModels.Add(new ColorViewModel {
                    SelectedColor = new Color {
                        A = color.A, R = color.R, B = color.B, G = color.G
                    }
                });
            }

            foreach (var color in IcParameters.Instance.IdColors)
            {
                this.IdColors.ColorViewModels.Add(new ColorViewModel {
                    SelectedColor = new Color {
                        A = color.A, R = color.R, B = color.B, G = color.G
                    }
                });
            }

            this.Modifications = new ReactiveList <SearchModificationViewModel>();
            foreach (var searchModification in IcParameters.Instance.SearchModifications)
            {
                var modificationVm = new SearchModificationViewModel(searchModification, this.dialogService);
                ////modificationVm.RemoveModificationCommand.Subscribe(_ => this.RemoveModification(modificationVm));
                this.Modifications.Add(modificationVm);
            }

            var addModificationCommand = ReactiveCommand.Create();

            addModificationCommand.Subscribe(_ => this.AddModificationImplementation());
            this.AddModificationCommand = addModificationCommand;

            var createNewModificationCommand = ReactiveCommand.Create();

            createNewModificationCommand.Subscribe(_ => this.CreateNewModificationImplementation());
            this.CreateNewModificationCommand = createNewModificationCommand;

            var saveCommand = ReactiveCommand.Create();

            saveCommand.Subscribe(_ => this.SaveImplementation());
            this.SaveCommand = saveCommand;

            var cancelCommand = ReactiveCommand.Create();

            cancelCommand.Subscribe(_ => this.CancelImplementation());
            this.CancelCommand = cancelCommand;

            HeavyModificationsViewModel = new HeavyModificationsViewModel(dialogService);

            this.Status = false;
        }