private async void login_btn_Click(object sender, EventArgs e) { music_list.Hide(); if (!account.IsAuthorized) { BassCore.Stop(); PlayerDefaultSet(true); play_btn.Image = Properties.Resources.play_gray; using (var stream = new FileStream(Properties.Resources.UserDataJSONPath, FileMode.Open)) { using (var stream2 = new FileStream(Properties.Resources.SecretUserJSONDataPath, FileMode.Open)) { using (var reader = new StreamReader(stream)) { UserDataJSON = reader.ReadToEnd(); if (string.IsNullOrEmpty(UserDataJSON)) { var form = new Sign_in_form(this); form.Show(); this.Hide(); form.BringToFront(); } else { LoadBar bar = new LoadBar(); this.Hide(); bar.Show(); SecretUserJSON = new StreamReader(stream2).ReadToEnd(); Client = new VKManager(); Task t = new Task(() => { account = Client.AuthentificateFromFile(UserDataJSON, SecretUserJSON); }); t.Start(); await t; this.Show(); RefreshLoginPanel(); bar.Close(); } } } } } if (account.IsAuthorized && closed) { login_btn.Location = new Point(0, 0); userPicture.Location = new Point(5, 0); } Refresh(); }
private void входToolStripMenuItem_Click(object sender, EventArgs e) { Sign_in_form signin = new Sign_in_form(); signin.Show(this); }