public void ChangePage(MainFormPage page) { BasePanel oldPage = CurrPage; switch (page) { case MainFormPage.Scheduler: CurrPage = SchedulerPage; break; case MainFormPage.Settings: CurrPage = SettingsPage; break; } if (oldPage != CurrPage) { contentPanel.SuspendLayout(); if (oldPage != null) oldPage.Visible = false; if (CurrPage.Dock == DockStyle.None) { CurrPage.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; CurrPage.Left = 0; CurrPage.Top = 0; CurrPage.Width = contentPanel.Width; } CurrPage.Visible = true; CurrPage.BringToFront(); contentPanel.ResumeLayout(); } }
public void ChangePage(MainFormPage page) { BasePanel oldPage = CurrPage; switch (page) { case MainFormPage.Scheduler: CurrPage = SchedulerPage; break; case MainFormPage.Settings: CurrPage = SettingsPage; break; } if (oldPage != CurrPage) { contentPanel.SuspendLayout(); contentPanel.Controls.Remove(oldPage); contentPanel.Controls.Add(CurrPage); if (CurrPage.Dock == DockStyle.None) { CurrPage.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; CurrPage.Left = 0; CurrPage.Top = 0; CurrPage.Width = contentPanel.Width; } contentPanel.ResumeLayout(); } }
protected void HandleSignIn(string Username, string Password, string RememberMe) { Username = Uri.UnescapeDataString(Username); SystemUserSession session = SystemUser.SignInSystemUser(Username, Password); if (session == null) { MasterPage master = mainHandlers.GetMaster(); string message = "Invalid username or password!"; if (master.SignInPage != null) { master.SignInPage.Message = message; } if (master.Partial is MainFormPage) { MainFormPage page = (MainFormPage)master.Partial; if (page.CurrentForm is SignInFormPage) { SignInFormPage form = (SignInFormPage)page.CurrentForm; form.Message = message; } } if (master.Partial is SignInFormPage) { SignInFormPage page = master.Partial as SignInFormPage; page.Message = message; } } else { if (RememberMe == "true") { Db.Transact(() => { session.Token.Expires = DateTime.UtcNow.AddDays(cookieHelper.rememberMeDays); session.Token.IsPersistent = true; }); } cookieHelper.SetAuthCookie(session.Token); } }
/// <summary> /// Changes the active page displayed in the form. /// </summary> /// <param name="page">The new page to change to. No action is done when the /// current page is the same as the new page requested</param> public void ChangePage(MainFormPage page) { BasePanel oldPage = CurrPage; switch (page) { case MainFormPage.Scheduler: CurrPage = SchedulerPage; break; case MainFormPage.Settings: CurrPage = SettingsPage; break; } if (oldPage != CurrPage) { contentPanel.SuspendLayout(); //Hide the old page before showing the new one if (oldPage != null) { oldPage.Visible = false; } //If the page is not set to dock, we need to specify the dimensions of the page //so it fits properly. if (CurrPage.Dock == DockStyle.None) { CurrPage.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; CurrPage.Left = 0; CurrPage.Top = 0; CurrPage.Width = contentPanel.Width; } //Show the new page then bring it to the top of the z-order. CurrPage.Visible = true; CurrPage.BringToFront(); contentPanel.ResumeLayout(); } }