private void UpdateChart(List <Activity> dailyActivity) { chartCanvas.Children.Clear(); chartCanvas.Width = 500; int maxScale = dailyActivity.Select(x => x.ActivityTime).Max(); int sumScale = dailyActivity.Select(x => x.ActivityTime).Sum(); for (int i = 0; i < 4; i++) { scaleLabel[i].SetContent(((((maxScale * 100) / sumScale) / 4) * (i + 1)).ToString()); } for (int i = 0; i < dailyActivity.Count; i++) { MyRectangle r = new MyRectangle(chartCanvas, 25, ((dailyActivity[i].ActivityTime * 235) / maxScale), Color.FromArgb(200, 0, 125, 250), 30 + (70 * i), 272 - ((dailyActivity[i].ActivityTime * 235) / maxScale)); dailyActivity[i].Name = (i > 1) ? dailyActivity[i].Name.Replace(" ", "\n") : dailyActivity[i].Name; MyLabel l = new MyLabel(chartCanvas, dailyActivity[i].Name, 70, 36, 10, 8 + (70 * i), 275, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(200, 200, 0, 0)); l.ToolTip(dailyActivity[i].Name); r.ToolTip(ActionOnTime.GetTime(dailyActivity[i].ActivityTime)); r.ToolTipResizeAbout(20, 0, true); if (i > 6) { chartCanvas.Width += 70; } if (string.Equals(dailyActivity[i].Name, TurnedOffComputer)) { r.SetFillColor(Color.FromArgb(200, 178, 174, 174)); } if (string.Equals(dailyActivity[i].Name, NoUserActivity)) { r.SetFillColor(Color.FromArgb(200, 160, 180, 255)); } if (string.Equals(dailyActivity[i].Name, NoActivity)) { r.SetFillColor(Color.FromArgb(200, 223, 132, 132)); } } }
private void SetConfigurationButton() { chooseGroupCanvas = new Canvas() { Width = 200, Height = 126 }; ScrollViewer sv = ScrollViewerCreator.CreateScrollViewer(addConfigurationCanvas, 200, 126, 20, 60, chooseGroupCanvas); sv.Background = new SolidColorBrush(Color.FromArgb(255, 35, 45, 100)); chooseGroup = ButtonCreator.CreateButton(addConfigurationCanvas, "Wybierz grupÄ™", 200, 30, 14, 20, 20, Color.FromArgb(255, 255, 255, 255), Color.FromArgb(255, 155, 155, 155)); chooseGroup.Background = new SolidColorBrush(Color.FromArgb(50, 0, 125, 255)); chooseGroup.MouseEnter += buttonContent_MouseEnter; chooseGroup.MouseLeave += buttonContent_MouseLeave; chooseGroup.MouseLeftButtonDown += buttonOpenChooseGroup; new MyLabel(addConfigurationCanvas, "x", 30, 50, 24, 573, 356, Color.FromArgb(255, 170, 170, 170), Color.FromArgb(255, 70, 70, 70), 0); Label buttonExit = ButtonCreator.CreateButton(addConfigurationCanvas, "", 30, 30, 14, 573, 366, Color.FromArgb(0, 155, 155, 155), Color.FromArgb(255, 155, 155, 155), 1); buttonExit.Background = new SolidColorBrush(Color.FromArgb(0, 215, 215, 215)); buttonExit.MouseEnter += buttonExit_MouseEnter; buttonExit.MouseLeave += buttonExit_MouseLeave; buttonExit.MouseLeftButtonDown += buttonExitConfigure_MouseLeftButtonDown; ButtonCreator.SetToolTip(buttonExit, "Zamknij okno"); MyRectangle background = new MyRectangle(addConfigurationCanvas, 530, 140, Color.FromArgb(0, 244, 244, 255), 20, 200); background.SetFillColor(Color.FromArgb(255, 35, 45, 100)); new MyLabel(addConfigurationCanvas, "Filtr", 50, 30, 14, 20, 209, Color.FromArgb(255, 255, 255, 255), Color.FromArgb(255, 70, 70, 70)); CreateCheckBox(); CreateLabelWithInformation(); CreateAddFilterButton(); CreateAddFilterAccept(); CreateApplyFilterButton(); CreateDeleteApplicationWithFilterButton(); CreateSaveDeleteConfigureButton(); }