private void AddChartToShowObject(Chart chart, IEnumerable<Chart> charts = null) { var chartToShow = GetChartToShowObjectByID(chart.ID, charts); if (chartToShow != null) return; //in case user tries to add chart to show object twice var chartToShowObject = new ChartToShow { ChartObject = chart }; if (charts == null) IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.Charts.Add(chartToShowObject); else GlobalDataModel.Instance.ChartToShowObjects.Add(chartToShowObject); }
public void AddChartObject(Chart chart, IEnumerable<Chart> charts = null) { var chartObject = HelperMethods.Instance.GetChartByID(chart.ID, charts); if (chartObject == null && charts == null) //in case user tries to add same object twice { chart.DisplayIndex = GlobalCollection.Instance.Charts.Any() ? GlobalCollection.Instance.Charts.Max(u => u.DisplayIndex) + 1 : 0; GlobalCollection.Instance.Charts.Add(chart); } AddChartToShowObject(chart, charts); if (GlobalCollection.Instance.Charts.Count == 1 && charts == null) IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.SelectedChart = IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.Charts.First(); }
public void RemoveChartObject(Chart chart) { RemoveChartToShowObject(chart.ID); GlobalCollection.Instance.Charts.Remove(chart); }