/// <summary> /// /// </summary> private void GetUsersData() { _lstDeleteItems = new List <string>(); ExchangeHelper.Login = TxtLogin.Text; ExchangeHelper.Password = TxtPassword.Text; ExchangeHelper.Url = TxtUrl.Text; ExchangeHelper.User = TxtUser.Text; int.TryParse(TxtBackDays.Text, out int backDays); ExchangeHelper.BackDays = -backDays; GridItems = ExchangeHelper.GetUserAppointments(); LblInfo.Content = "Total records : " + GridItems?.Count; DgData.ItemsSource = GridItems; if (GridItems?.Count > 1) { BtnDelete.IsEnabled = true; } }
private void BtnDelete_Click(object sender, RoutedEventArgs e) { _lstDeleteItems = new List <string>(); foreach (var item in DgData.Items) { if (item is ExchangeHelper.ExchangeData exchangeData && exchangeData.IsSelected) { _lstDeleteItems.Add(exchangeData.UniqueId); } } if (_lstDeleteItems.Any()) { ExchangeHelper.DeleteItems(_lstDeleteItems); LblInfo.Content = "Deleted rows : " + _lstDeleteItems?.Count; GridItems = ExchangeHelper.GetUserAppointments(); DgData.ItemsSource = GridItems; } }