// Initialize components and some data. public F001_Main(int ID) { InitializeComponent(); this.Icon = Properties.Resources.SoftWorldICO; // Create a material theme manager and add the form to manage (this). MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; // Configure color schema. materialSkinManager.ColorScheme = new ColorScheme( Primary.BlueGrey900, Primary.Grey900, Primary.Blue500, Accent.LightBlue200, TextShade.WHITE ); uID = ID; Console.WriteLine(ID); pMain = new PMain(this); userLabel.Text = "Welcome, " + pMain.GetUser(ID); defaultHeight = this.Height; defaultWidth = this.Width; // Populate the lists. projects = pMain.GetProjects(); performances = pMain.GetPerformances(); // projectBox.DataSource = projects; projectBox.DisplayMember = "ProjectName"; timeBox.DataSource = new string[] { "all time", "last day", "last week", "last month", "last year", "custom" }; }
// Refresh the form. private void RefreshForm() { pMain = new PMain(this); userLabel.Text = "Welcome, " + pMain.GetUser(UserID); Permissions = pMain.GetRights(); if (!Permissions.Contains("r1")) { assignButton.Enabled = false; } else { assignButton.Enabled = true; } projectBox.SelectedIndex = 0; timeBox.SelectedIndex = 0; projects = pMain.GetProjects(); performances = pMain.GetPerformances(); projectBox.SelectedIndex = 0; timeBox.SelectedIndex = 0; projectBox.DataSource = projects; mainData.DataSource = new BindingList <PerformanceData>(performances.OrderBy(x => x.ProjectName).ToList()); }