public DynamicPropertyScaleDescriptor(IPowerShellDataSource dataSource, string name)
 {
     _dataSource = dataSource;
     _name       = name;
     Color       = ColorManager.AssignColor();
     _dataSource.Data.CollectionChanged += OnData;
     _ranges = new ObservableCollection <IRangeDescriptor>(RangeDescriptorFactory.Create(Color, new object[] { _minimum, "?", _maximum }).ToList());
 }
 public DynamicPropertyScaleDescriptor( IPowerShellDataSource dataSource, string name )
 {
     _dataSource = dataSource;
     _name = name;
     Color = ColorManager.AssignColor();
     _dataSource.Data.CollectionChanged += OnData;
     _ranges = new ObservableCollection<IRangeDescriptor>( RangeDescriptorFactory.Create(Color, new object[]{_minimum,"?",_maximum}).ToList() );
 }
Example #3
0
 protected override SolidObjectViewModel CreateSeriesViewModel(string seriesName, IEnumerable <string> plotPropertyNames, string againstPropertyName,
                                                               IPowerShellDataSource dataSource)
 {
     return(new SolidObjectViewModel
     {
         AgainstPropertyName = againstPropertyName,
         SeriesName = seriesName,
         PlotPropertyNames = new List <string>(plotPropertyNames)
     });
 }
Example #4
0
        public AcrossByPowerShellDataSource(IPowerShellDataSource rootDataSource, object acrossItem, object byItem)
        {
            _rootDataSource = rootDataSource;
            _byItem         = byItem;
            _across         = acrossItem;
            _byItem         = byItem;

            CreateScriptBlock();

            rootDataSource.Data.CollectionChanged += OnData;
        }
        public AcrossByPowerShellDataSource(IPowerShellDataSource rootDataSource, object acrossItem, object byItem)
        {
            _rootDataSource = rootDataSource;
            _byItem = byItem;
            _across = acrossItem;
            _byItem = byItem;

            CreateScriptBlock();

            rootDataSource.Data.CollectionChanged += OnData;
        }
Example #6
0
        private IPowerShellDataSource CreateNewDataSource(string dataSourceName, string itemTypeName, ScriptBlock script)
        {
            IPowerShellDataSource currentDataSource = null;
            var coll = SessionState.InvokeProvider.Item.New(
                "datasources:/",
                dataSourceName,
                itemTypeName,
                script);

            var pso = coll.FirstOrDefault();

            if (null != pso)
            {
                currentDataSource = pso.BaseObject as IPowerShellDataSource;
            }
            return(currentDataSource);
        }
Example #7
0
        void ConfigureAxes(IPowerShellDataSource dataSource)
        {
            if (null != dataSource && null != dataSource.Data)
            {
                bool configured = false;

                if (0 != dataSource.Data.Count)
                {
                    var o = dataSource.Data[0];
                    configured = TryConfigureAxes(o as SolidPSObjectBase);
                }

                if (!configured)
                {
                    dataSource.Data.CollectionChanged += OnFirstDataItem;
                }
            }
        }
Example #8
0
        public void Add(IPowerShellDataSource dataSource)
        {
            PropertyChangedEventHandler handler = null;
            IList oldDataSource = dataSource.Data;

            handler = (s, a) =>
            {
                if (a.PropertyName == "Data")
                {
                    _data.ChildCollections.Remove(oldDataSource);
                    _data.ChildCollections.Add(dataSource.Data);
                    oldDataSource = dataSource.Data;
                    NotifyOfPropertyChange(() => Data);
                }
            };
            dataSource.PropertyChanged += handler;

            _data.ChildCollections.Add(dataSource.Data);
            _allRecords.ChildCollections.Add(dataSource.AllRecords);
            _progressRecords.ChildCollections.Add(dataSource.ProgressRecords);
            _dataSources.Add(dataSource);
        }
        void DoProcessRecord(IPowerShellDataSource dataSource, object[] plot, object by, object across, object keyOn)
        {
            IEnumerable <TSeriesViewModel> viewModels = null;

            try
            {
                dataSource.Dispatcher = Manager.Dispatcher;
                viewModels            = CreatePlotSeriesViewModels(plot, by, across as PSScriptProperty, keyOn as PSScriptProperty);
            }
            catch (Exception)
            {
                viewModels = new TSeriesViewModel[] { CreateSeriesViewModel(String.Empty, new[] { String.Empty }, String.Empty, dataSource) };
                throw;
            }
            finally
            {
                if (null != viewModels)
                {
                    _scaleViewModels.AddRange(viewModels);
                }
            }
        }
 protected void ProcessRecord(IPowerShellDataSource dataSource, object[] plot, object by, object across, object keyOn)
 {
     Dispatch(() => DoProcessRecord(dataSource, plot, by, across, keyOn));
     //DoProcessRecord(dataSource, plot, by, across, keyOn);
 }
        private TSeriesViewModel CreateSeriesViewModelAndScale(IEnumerable <DynamicMemberDescriptor> plot, string by, IPowerShellDataSource dataSource)
        {
            var props = plot.ToList();

            props.ForEach(p => dataSource.AddDynamicScaleForProperty(p.MemberInfo.Name));
            var names       = from prop in props select prop.MemberInfo.Name;
            var seriesNames =
                (from prop in plot
                 let propName = prop.MemberInfo.Name.StartsWith("_") ? null : prop.MemberInfo.Name
                                let scriptName =
                     prop.MemberInfo is PSScriptProperty
                            ? (prop.MemberInfo as PSScriptProperty).GetterScript.ToString()
                            : null
                     let indexName = prop.IndexValue
                                     select(indexName ?? propName ?? scriptName).ToString()).ToArray();
            var seriesName = String.Join(", ", seriesNames);

            return(_creator(seriesName, names.ToList(), by, dataSource));
        }
Example #12
0
 public DynamicMemberFactory(IPowerShellDataSource dataSource, IEnumerable <DynamicMemberSpecification> spec, PSObject dataItem)
 {
     _dataSource = dataSource;
     _spec       = spec;
     _dataItem   = dataItem;
 }
Example #13
0
 public static void Remove(IPowerShellDataSource powerShellDataSource)
 {
     DataSourceList.Remove(powerShellDataSource);
 }
        public IEnumerable <TSeriesViewModel> CreateSeriesViewModelsFromDynamicMemberSpecification(DynamicMemberSpecification spec, IPowerShellDataSource dataSource)
        {
            var vms = CreateSeriesViewModelAndScale(spec.PlotItemDescriptors, spec.AgainstPropertyName, dataSource);

            return(new[] { vms });
        }
 protected virtual void OnDataSourceChanged(IPowerShellDataSource oldDataSource, IPowerShellDataSource newDataSource)
 {
 }
Example #16
0
 protected override void OnDataSourceChanged(IPowerShellDataSource oldDataSource, IPowerShellDataSource newDataSource)
 {
     ConfigureAxes(newDataSource);
     base.OnDataSourceChanged(oldDataSource, newDataSource);
 }
Example #17
0
 public static void Add(IPowerShellDataSource dataSource)
 {
     DataSourceList.Add(dataSource);
 }
 protected override void OnDataSourceChanged(IPowerShellDataSource oldDataSource, IPowerShellDataSource newDataSource)
 {
     ConfigureAxes( newDataSource );
      	         base.OnDataSourceChanged(oldDataSource, newDataSource);
 }
 protected abstract TSeriesViewModel CreateSeriesViewModel(string seriesName, IEnumerable <string> plotPropertyNames, string againstPropertyName, IPowerShellDataSource dataSource);
 public DynamicMemberFactory( IPowerShellDataSource dataSource, IEnumerable<DynamicMemberSpecification> spec, PSObject dataItem )
 {
     _dataSource = dataSource;
     _spec = spec;
     _dataItem = dataItem;
 }
        void ConfigureAxes( IPowerShellDataSource dataSource )
        {
            if (null != dataSource && null != dataSource.Data)
                {
                    bool configured = false;

                    if (0 != dataSource.Data.Count)
                    {
                        var o = dataSource.Data[0];
                        configured = TryConfigureAxes(o as SolidPSObjectBase);
                    }

                    if (!configured)
                    {
                        dataSource.Data.CollectionChanged += OnFirstDataItem;
                    }
                }
        }
Example #22
0
 protected abstract void ProcessRecord(IPowerShellDataSource ds);
 protected virtual void OnDataSourceChanged( IPowerShellDataSource oldDataSource, IPowerShellDataSource newDataSource )
 {
 }
Example #24
0
 public static void Remove(IPowerShellDataSource powerShellDataSource)
 {
     DataSourceList.Remove(powerShellDataSource);
 }
        public IEnumerable <TSeriesViewModel> CreateSeriesViewModelsFromDynamicMemberSpecification(DynamicMemberSpecification spec, IPowerShellDataSource dataSource)
        {
            var vms =
                (from prop in spec.PlotItemDescriptors
                 let propName = prop.MemberInfo.Name.StartsWith("_") ? null : prop.MemberInfo.Name
                                let scriptName = prop.MemberInfo is PSScriptProperty ? (prop.MemberInfo as PSScriptProperty).GetterScript.ToString() : null
                                                 let indexName = prop.IndexValue
                                                                 let seriesName = (indexName ?? propName ?? scriptName).ToString()
                                                                                  select CreateSeriesViewModelAndScale(seriesName, prop.MemberInfo.Name, spec.AgainstPropertyName, dataSource)).ToList();

            return(vms);
        }
 public DataSourceNodeFactory(IPowerShellDataSource dataSource)
 {
     _dataSource = dataSource;
 }
Example #27
0
        protected override ChartSeriesViewModel CreateSeriesViewModel(string seriesName, IEnumerable <string> plotPropertyName, string againstPropertyName, IPowerShellDataSource dataSource)
        {
            var series = new ChartSeriesViewModel()
            {
                Name = seriesName, EnableConfigureAxes = false
            };

            series.LiteralSeriesName = _literalPlotValue;
            series.LiteralByName     = _literalByValue;
            series.SeriesType        = Type;
            series.DataSource        = dataSource;
            series.LabelMemberPath   = series.XMemberPath = series.AngleMemberPath = againstPropertyName;
            series.ValueMemberPath   = series.RadiusMemberPath = series.YMemberPath = plotPropertyName.FirstOrDefault();
            series.ScaleDescriptors  = this.ScaleDescriptorTable;
            switch (series.SeriesType)
            {
            case (ChartSeriesType.Bubble):
            {
                if (null != RadiusFrom)
                {
                    var spec = new DynamicMemberSpecification(new[] { RadiusFrom }, null,
                                                              Across as PSScriptProperty,
                                                              KeyOn as PSScriptProperty,
                                                              ScaleDescriptorTable);

                    series.DataSource.AddDynamicMemberSpecification(spec);

                    var prop = spec.PlotItemDescriptors.FirstOrDefault();
                    if (null != prop)
                    {
                        series.RadiusMemberPath = prop.MemberInfo.Name;
                    }
                }
                else
                {
                    series.SeriesType = ChartSeriesType.Scatter;
                }

                break;
            }

            case (ChartSeriesType.RangeArea):
            case (ChartSeriesType.RangeColumn):
            {
                if (2 != plotPropertyName.Count())
                {
                    //todo
                }
                series.HighMemberPath = plotPropertyName.First();
                series.LowMemberPath  = plotPropertyName.Last();

                break;
            }

            default:
                series.HighMemberPath = null;
                series.LowMemberPath  = null;
                break;
            }

            series.EnableConfigureAxes = true;

            return(series);
        }
Example #28
0
 protected override void ProcessRecord(IPowerShellDataSource dataSource)
 {
     ProcessRecord(dataSource, Plot, By, Across, KeyOn);
 }
Example #29
0
 public static void Add( IPowerShellDataSource dataSource )
 {
     DataSourceList.Add( dataSource);
 }
 private TSeriesViewModel CreateSeriesViewModelAndScale(string seriesName, string plot, string by, IPowerShellDataSource dataSource)
 {
     dataSource.AddDynamicScaleForProperty(plot);
     return(_creator(seriesName, new[] { plot }, by, dataSource));
 }
 public DataSourceNodeFactory(IPowerShellDataSource dataSource)
 {
     _dataSource = dataSource;
 }