private void ShowPie() { int totalActivity = 0; int totalAction = 0; List <string> status; if (ActivityChart.Palette == null) { ActivityChart.Palette = new ResourceDictionaryCollection(); } else { ActivityChart.Palette.Clear(); } List <StatItems> activityStatList = new List <StatItems>(); List <StatItem> st = mBusinessFlow.GetActivitiesStats(); foreach (var v in st) { if (v.Description != "Running" && v.Description != "Pending" && v.Description != "Passed" && v.Description != "Failed" && v.Description != "Stopped" && !string.IsNullOrEmpty(v.Description)) { continue; } activityStatList.Add(new StatItems() { Description = v.Description, Count = (int)v.Count }); ActivityChart.Palette.Add(GingerCore.General.SelectColor(v.Description)); totalActivity += (int)v.Count; } ViewModel activity = new ViewModel(activityStatList); ActivityChart.DataContext = activity; //Action if (ActionChart.Palette == null) { ActionChart.Palette = new ResourceDictionaryCollection(); } else { ActionChart.Palette.Clear(); } List <StatItems> actionStatList = new List <StatItems>(); List <StatItem> act = mBusinessFlow.GetActionsStat(); foreach (var v in act) { if (v.Description != "Running" && v.Description != "Pending" && v.Description != "Passed" && v.Description != "Failed" && v.Description != "Stopped" && v.Description != "FailIgnored" && !string.IsNullOrEmpty(v.Description)) { continue; } actionStatList.Add(new StatItems() { Description = v.Description, Count = (int)v.Count }); ActionChart.Palette.Add(GingerCore.General.SelectColor(v.Description)); totalAction += (int)v.Count; } ViewModel action = new ViewModel(actionStatList); ActionChart.DataContext = action; status = actionStatList.Select(b => b.Description).Concat(actionStatList.Select(c => c.Description)).Distinct().ToList(); HideAllLegend(); foreach (string s in status) { SwitchLegend(s); } { stck.Children.Add(Ginger.General.makeImgFromControl(ActivityChart, totalActivity.ToString(), 1)); stck.Children.Add(Ginger.General.makeImgFromControl(ActionChart, totalAction.ToString(), 2)); } { App.RunsetActivityTextbox.Text = totalActivity.ToString(); App.RunsetActionTextbox.Text = totalAction.ToString(); } }