public HamsterDayCare() { InitializeComponent(); bool hasData; hamsterDay.InitilizeDatabase(out hasData); //vid uppstart så initialiseras databasen om det behövs string path = @"..\..\..\..\config.txt"; if (!File.Exists(path)) //kollar om config filen finns, gör den inte det så skapas den { using (File.Create(path)) { } string[] data = { "#Simulation", "days,1", "speed,3" }; File.WriteAllLines(path, data); } Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 25, 25)); //för att runda hörnen på programmet if (!Directory.Exists(@"..\..\..\..\Logs")) //kollar om log foldern finns, gör den inte det så skapas den { Directory.CreateDirectory(@"..\..\..\..\Logs"); } lblTitle.Text = "Welcome to the best Hamster Daycare, in the world"; //laddar in dashboard sidan vid uppstart this.PnlFormLoader.Controls.Clear(); FrmDashBoard frmDashBoard = new FrmDashBoard() { Dock = DockStyle.Fill, TopLevel = false, TopMost = true }; frmDashBoard.FormBorderStyle = FormBorderStyle.None; this.PnlFormLoader.Controls.Add(frmDashBoard); frmDashBoard.Show(); string userName = Environment.UserName; UserName.Text = "Welcome " + userName; }
private void Dashboard_button_Click(object sender, EventArgs e) { //vid klick på dashboard knappen laddas daschboard formuleret in och en panel visar att man är på dashboard Nav_Pnl.Height = Dashboard_button.Height; Nav_Pnl.Top = Dashboard_button.Top; Nav_Pnl.Left = Dashboard_button.Left; Dashboard_button.BackColor = Color.FromArgb(46, 51, 73); lblTitle.Text = "Dashboard"; this.PnlFormLoader.Controls.Clear(); //rensar föregående forms FrmDashBoard frmDashBoard = new FrmDashBoard() { Dock = DockStyle.Fill, TopLevel = false, TopMost = true }; frmDashBoard.FormBorderStyle = FormBorderStyle.None; this.PnlFormLoader.Controls.Add(frmDashBoard); //laddar in det nya formset frmDashBoard.Show(); }