コード例 #1
0
        public void TransitionCheckBoxChanged(object sender, RoutedEventArgs args)
        {
            CheckBox checkBox   = sender as CheckBox;
            var      seriesName = checkBox.Content.ToString();

            Plotter.GetExistingSeries(seriesName).IsVisible = checkBox.IsChecked ?? false;
            Plotter.PlotFrame.InvalidatePlot(false);
        }
コード例 #2
0
        public void ImportedSpectrums_SelectionChanged(SelectionChangedEventArgs args)
        {
            var existingSeries = Plotter.GetExistingSeries("Imported");

            if (existingSeries != null)
            {
                Plotter.PlotFrame.Series.Remove(existingSeries);
            }

            var existingTransition = Transitions.Where(x => x.Name == "Imported");

            if (existingTransition != null && existingTransition.Any())
            {
                Transitions.Remove(existingTransition.First());
            }

            existingSeries = Plotter.GetExistingSeries("Imported Peaks");
            if (existingSeries != null)
            {
                Plotter.PlotFrame.Series.Remove(existingSeries);
            }

            existingTransition = Transitions.Where(x => x.Name == "Imported Peaks");
            if (existingTransition != null && existingTransition.Any())
            {
                Transitions.Remove(existingTransition.First());
            }

            SelectedImportedSpectrum = args.AddedItems.Cast <object>().Where(x => x is SpectrumBase).Count() == 1
                ? args.AddedItems.Cast <SpectrumBase>().First()
                : null;
            if (SelectedImportedSpectrum != null)
            {
                Spectrum spectrum = new Spectrum(SelectedImportedSpectrum);
                Plotter.Plot(spectrum, null, SpectrumType.Imported);
                Transitions.Add(new ListViewTransitionItem()
                {
                    Name = spectrum.Optimized.Name
                });
                Transitions.Add(new ListViewTransitionItem()
                {
                    Name = spectrum.Peaks.Name
                });
            }
        }
コード例 #3
0
        public void AddToDatabase(object parameter)
        {
            IWindowManager manager = new WindowManager();
            var            vm      = new AddToDatabaseDialogViewModel(Plotter.PlotFrame.Title);
            var            result  = manager.ShowDialog(vm, null, null);

            if (result == true)
            {
                SpectrumBase spectrumBase = new SpectrumBase()
                {
                    Name  = vm.SpectrumName,
                    Data  = string.Join(";", AnalyzingSpectrum.Optimized.Data.Select(x => x.X + ":" + x.Y).ToArray()),
                    Peaks = string.Join(";", (Plotter.GetExistingSeries("Peaks") as ScatterSeries).Points.Select(x => x.X + ":" + x.Y).ToArray())
                };

                Database.GetConnection().Insert(spectrumBase);
            }
        }