//кнопка личный кабинет. private void pictureBox1_Click(object sender, EventArgs e) { if ((UserData.Login == null) && (UserData.Password == null)) { LogInForm newForm = new LogInForm(); newForm.Left = this.Left; newForm.Top = this.Top; newForm.Show(); this.Hide(); //очистка корзины UserData.Bascket.CountProducts = 0; UserData.Bascket.OrderIdCount.Clear(); UserData.Bascket.sum = 0; UserData.Bascket.OrderString = null; } else { CabinetForm newForm = new CabinetForm(); newForm.Left = this.Left; newForm.Top = this.Top; newForm.Show(); this.Hide(); //очистка корзины UserData.Bascket.CountProducts = 0; UserData.Bascket.OrderIdCount.Clear(); UserData.Bascket.sum = 0; UserData.Bascket.OrderString = null; } }
//кнопка Личный кабинет загружает форму личного кабинета если пользователь авторизован, в ином случае загружает форму авторизации. private void pictureBox1_Click(object sender, EventArgs e) { if ((UserData.Login == null) && (UserData.Password == null)) { LogInForm newForm = new LogInForm(); newForm.Left = this.Left; newForm.Top = this.Top; newForm.Show(); this.Hide(); } else { CabinetForm newForm = new CabinetForm(); newForm.Left = this.Left; newForm.Top = this.Top; newForm.Show(); this.Hide(); } }