示例#1
0
        public PanelsListViewModel()
        {
            Current           = this;
            SpectralMappingVM = new SpectralMappingViewModel();
            PlotVM            = new PlotViewModel();

            PanelsList = new List <PanelsItem>
            {
                new PanelsItem {
                    Id = Guid.NewGuid().ToString(), Name = "Spectral Panel", Description = "Construct absorption and reduced scattering coefficient spectra."
                },
                new PanelsItem {
                    Id = Guid.NewGuid().ToString(), Name = "Second item", Description = "This is an item description."
                },
            };

            LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand());


            //MessagingCenter.Subscribe<NewItemPage, Item>(this, "AddItem", async (obj, item) =>
            //{
            //    var newItem = item as Item;
            //    Items.Add(newItem);
            //    await DataStore.AddItemAsync(newItem);
            //});
        }
        public static PlotViewModel Clone(PlotViewModel plotToClone)
        {
            var output = new PlotViewModel(plotToClone._plotViewId + 1);

            plotToClone._plotViewId += 1;

            //Commands.Plot_PlotValues.Executed -= output.Plot_Executed;

            output._Title                          = plotToClone._Title;
            output._PlotTitles                     = plotToClone._PlotTitles.ToList();
            output._PlotType                       = plotToClone._PlotType;
            output._HoldOn                         = plotToClone._HoldOn;
            output._PlotSeriesCollection           = new PlotPointCollection();
            output._Labels                         = plotToClone._Labels.ToList();
            output.ShowInPlotView                  = false;
            output._HideKey                        = plotToClone.HideKey;
            output._ShowAxes                       = plotToClone._ShowAxes;
            output._minYValue                      = plotToClone._minYValue;
            output._maxYValue                      = plotToClone._maxYValue;
            output._minXValue                      = plotToClone._minXValue;
            output._maxXValue                      = plotToClone._maxXValue;
            output._manualScaleX                   = plotToClone._manualScaleX;
            output._manualScaleY                   = plotToClone._manualScaleY;
            output._IsComplexPlot                  = plotToClone._IsComplexPlot;
            output._CurrentIndependentVariableAxis = plotToClone._CurrentIndependentVariableAxis;

            output.RealLabels      = plotToClone.RealLabels;
            output.ImagLabels      = plotToClone.ImagLabels;
            output.PhaseLabels     = plotToClone.PhaseLabels;
            output.AmplitudeLabels = plotToClone.AmplitudeLabels;

            output._plotNormalizationTypeOptionVm.Options[output._plotNormalizationTypeOptionVm.SelectedValue]
            .IsSelected = false;
            output._PlotToggleTypeOptionVM.Options[output._PlotToggleTypeOptionVM.SelectedValue].IsSelected = false;
            output._plotNormalizationTypeOptionVm.Options[plotToClone._plotNormalizationTypeOptionVm.SelectedValue]
            .IsSelected = true;
            output._PlotToggleTypeOptionVM.Options[plotToClone._PlotToggleTypeOptionVM.SelectedValue].IsSelected = true;

            output.DataSeriesCollection =
                plotToClone.DataSeriesCollection.Select(
                    ds =>
                    new DataPointCollection
            {
                DataPoints = ds.DataPoints.Select(val => val).ToArray(),
                ColorTag   = ds.ColorTag,
                Title      = ds.Title
            }).ToList();
            //output.DataSeriesCollectionToggle =
            //    plotToClone.DataSeriesCollectionToggle.Select(ds => (IList<IDataPoint>)ds.Select(val => val).ToList()).ToList();

            return(output);
        }