private void BtnRemove_Click(object sender, RoutedEventArgs e) { if (!(dgShow.SelectedItem is PlayerFullInfo)) { dgShow.SelectedItem = null; return; } PlayerFullInfo playerFull = dgShow.SelectedItem as PlayerFullInfo; dgShow.SelectedItem = null; string url = _hostUrl + $"/api/jsstudygame/player?login={playerFull.Login}&password={playerFull.Password}"; if (ServerWorker.DeletePlayer(url) == true) { if (playerFull.Login == MainWindow.playerLogin && playerFull.Password == MainWindow.playerPassword) { MainWindow.playerLogin = "******"; MainWindow.playerPassword = "******"; this.Close(); return; } else { Window_Loaded(sender, e); } } }
private void BtnDelete_Click(object sender, RoutedEventArgs e) { string url = _hostUrl + $"/api/jsstudygame/player?login={MainWindow.playerLogin}&password={MainWindow.playerPassword}"; if (ServerWorker.DeletePlayer(url) == true) { MainWindow.playerLogin = "******"; MainWindow.playerPassword = "******"; this.Close(); } }