private void LoadNonAssignedApplication() { List <ActiveApplication> titlesAllNotAssignedApplication = ActiveApplication_db.GetNonJoinedApplication(); for (int i = 0; i < titlesAllNotAssignedApplication.Count; i++) { Thread.Sleep(10); Application.Current.Dispatcher.Invoke(() => { applicationWithoutGroup = new Canvas(); applicationWithoutGroup = CanvasCreator.CreateCanvas(applicationsWithoutGroup, 560, 60, Color.FromArgb(0, 110, 0, 0), 0, 59 * i); }); string titleApplication = string.Empty; titleApplication = (titlesAllNotAssignedApplication[i].Title.Length > 40) ? titlesAllNotAssignedApplication[i].Title.Remove(40, titlesAllNotAssignedApplication[i].Title.Length - 40) : titlesAllNotAssignedApplication[i].Title; Application.Current.Dispatcher.Invoke(() => { new MyCircle(applicationWithoutGroup, 46, 2, Color.FromArgb(255, 150, 150, 150), 8, 8, 1, true); MyLabel l = new MyLabel(applicationWithoutGroup, "\t" + titleApplication, 560, 60, 14, 0, 0, Color.FromArgb(255, 120, 120, 120), Color.FromArgb(30, 100, 100, 100), 1, HorizontalAlignment.Left, fontWeight: FontWeights.Bold); l.ToolTip(titlesAllNotAssignedApplication[i].Title); new MyLabel(applicationWithoutGroup, ActionOnString.GetFirstLetterFromString(titleApplication), 50, 50, 20, 6, 11, Color.FromArgb(255, 240, 240, 240), Color.FromArgb(0, 100, 100, 100), 0, HorizontalAlignment.Center, fontWeight: FontWeights.ExtraBold); new MyLabel(applicationWithoutGroup, titlesAllNotAssignedApplication[i].NameActivity, 300, 30, 12, 60, 30, Color.FromArgb(255, 120, 120, 120), Color.FromArgb(30, 100, 100, 100), horizontalAlignment: HorizontalAlignment.Left); new MyLabel(applicationWithoutGroup, ActionOnTime.GetNumberDayAgo(titlesAllNotAssignedApplication[i].Date), 100, 30, 13, 466, 0, Color.FromArgb(255, 120, 120, 120), Color.FromArgb(30, 100, 100, 100), horizontalAlignment: HorizontalAlignment.Left); new MyLabel(applicationWithoutGroup, "(" + (titlesAllNotAssignedApplication.Count - i) + ")", 100, 30, 9, 420, 0, Color.FromArgb(255, 120, 120, 120), Color.FromArgb(30, 100, 100, 100), horizontalAlignment: HorizontalAlignment.Left); new MyCircle(applicationWithoutGroup, 25, 1, (Color.FromArgb(255, 0, 123, 255)), 525, 28, setFill: true); Label buttonAddActivity = ButtonCreator.CreateButton(applicationWithoutGroup, "+", 25, 34, 20, 525, 28, Color.FromArgb(255, 255, 255, 255), Color.FromArgb(200, 255, 0, 0), 0, fontWeight: FontWeights.ExtraBold); buttonAddActivity.Margin = new Thickness(0, -8, 0, 0); applicationWithoutGroup.Name = "ID_" + titlesAllNotAssignedApplication[i].ID; buttonAddActivity.MouseLeftButtonDown += buttonAddActivity_MouseLeftButtonDown; applicationsWithoutGroup.Height += 59; }); } Application.Current.Dispatcher.Invoke(() => { applicationsWithoutGroup.Height = ((applicationsWithoutGroup.Height - 300) < 300) ? 300 : applicationsWithoutGroup.Height - 299; }); loadingWindow.notClose = false; Thread.Sleep(200); backgroundWorkerLoadingWindow.DoWork -= loadingWindow.Load; backgroundWorkerLoadingWindow.DoWork += loadingWindow.Close; backgroundWorkerLoadingWindow.RunWorkerAsync(); }
private void LoadNonAssignedApplication() { List <ActiveApplication> titlesAllNotAssignedApplication = ActiveApplication_db.GetNonAssignedApplication(); titlesAllNotAssignedApplication.AddRange(ActiveApplication_db.GetNonAssignedApplicationWithGroup()); titlesAllNotAssignedApplication = titlesAllNotAssignedApplication.OrderByDescending(x => x.Date).ToList(); Dictionary <string, string> titleMembership = Membership_db.GetNameGroupsDictionaryIfIsActive(false); titleMembership["0"] = "Brak przynależności"; for (int i = 0; i < titlesAllNotAssignedApplication.Count; i++) { Thread.Sleep(10); Application.Current.Dispatcher.Invoke(() => { nonAssignedAppCanvas = new Canvas(); nonAssignedAppCanvas = CanvasCreator.CreateCanvas(nonAssignedApplications, 560, 60, Color.FromArgb(0, 110, 0, 0), 0, 59 * i); }); string titleApplication = string.Empty; titleApplication = (titlesAllNotAssignedApplication[i].Title.Length > 40) ? titlesAllNotAssignedApplication[i].Title.Remove(40, titlesAllNotAssignedApplication[i].Title.Length - 40) : titlesAllNotAssignedApplication[i].Title; Application.Current.Dispatcher.Invoke(() => { new MyCircle(nonAssignedAppCanvas, 46, 2, Color.FromArgb(255, 150, 150, 150), 8, 8, 1, true); MyLabel l = new MyLabel(nonAssignedAppCanvas, "\t" + titleApplication, 560, 60, 14, 0, 0, Color.FromArgb(255, 120, 120, 120), Color.FromArgb(30, 100, 100, 100), 1, HorizontalAlignment.Left, fontWeight: FontWeights.Bold); l.ToolTip(titlesAllNotAssignedApplication[i].Title); new MyLabel(nonAssignedAppCanvas, ActionOnString.GetFirstLetterFromString(titleApplication), 50, 50, 20, 6, 11, Color.FromArgb(255, 240, 240, 240), Color.FromArgb(0, 100, 100, 100), 0, HorizontalAlignment.Center, fontWeight: FontWeights.ExtraBold); new MyLabel(nonAssignedAppCanvas, titleMembership[titlesAllNotAssignedApplication[i].IdMembership.ToString()], 300, 30, 12, 60, 30, Color.FromArgb(255, 120, 120, 120), Color.FromArgb(30, 100, 100, 100), horizontalAlignment: HorizontalAlignment.Left); new MyLabel(nonAssignedAppCanvas, ActionOnTime.GetNumberDayAgo(titlesAllNotAssignedApplication[i].Date), 100, 30, 13, 466, 0, Color.FromArgb(255, 120, 120, 120), Color.FromArgb(30, 100, 100, 100), horizontalAlignment: HorizontalAlignment.Left); new MyLabel(nonAssignedAppCanvas, "(" + (titlesAllNotAssignedApplication.Count - i) + ")", 100, 30, 9, 420, 0, Color.FromArgb(255, 120, 120, 120), Color.FromArgb(30, 100, 100, 100), horizontalAlignment: HorizontalAlignment.Left); new MyCircle(nonAssignedAppCanvas, 25, 1, (Color.FromArgb(255, 0, 123, 255)), 525, 28, setFill: true); Label buttonAddActivity = ButtonCreator.CreateButton(nonAssignedAppCanvas, "+", 25, 34, 20, 525, 28, Color.FromArgb(255, 255, 255, 255), Color.FromArgb(200, 255, 0, 0), 0, fontWeight: FontWeights.ExtraBold); buttonAddActivity.Margin = new Thickness(0, -8, 0, 0); nonAssignedAppCanvas.Name = "ID_" + titlesAllNotAssignedApplication[i].ID; nonAssignedAppCanvas.Tag = titlesAllNotAssignedApplication[i].IdMembership; buttonAddActivity.MouseLeftButtonDown += buttonAddActivity_MouseLeftButtonDown; nonAssignedApplications.Height += 59; }); } Application.Current.Dispatcher.Invoke(() => { nonAssignedApplications.Height = ((nonAssignedApplications.Height - 300) < 300) ? 300 : nonAssignedApplications.Height - 299; }); loadingWindow.notClose = false; Thread.Sleep(200); backgroundWorkerLoadingWindow.DoWork -= loadingWindow.Load; backgroundWorkerLoadingWindow.DoWork += loadingWindow.Close; backgroundWorkerLoadingWindow.RunWorkerAsync(); }