private async void Btn_delete_Click(object sender, RoutedEventArgs e) { try {//delete HelpClass.StartAwait(grid_main); if (version.verId != 0) { if ((!version.canDelete) && (version.isActive == 0)) { #region Window.GetWindow(this).Opacity = 0.2; wd_acceptCancelPopup w = new wd_acceptCancelPopup(); w.contentText = MainWindow.resourcemanager.GetString("trMessageBoxActivate"); w.ShowDialog(); Window.GetWindow(this).Opacity = 1; #endregion if (w.isOk) { await activate(); } } else { #region Window.GetWindow(this).Opacity = 0.2; wd_acceptCancelPopup w = new wd_acceptCancelPopup(); if (version.canDelete) { w.contentText = MainWindow.resourcemanager.GetString("trMessageBoxDelete"); } if (!version.canDelete) { w.contentText = MainWindow.resourcemanager.GetString("trMessageBoxDeactivate"); } w.ShowDialog(); Window.GetWindow(this).Opacity = 1; #endregion if (w.isOk) { string popupContent = ""; if (version.canDelete) { popupContent = MainWindow.resourcemanager.GetString("trPopDelete"); } if ((!version.canDelete) && (version.isActive == 1)) { popupContent = MainWindow.resourcemanager.GetString("trPopInActive"); } int s = await version.Delete(version.verId, MainWindow.userLogin.userId, version.canDelete); if (s <= 0) { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn); } else { version.verId = 0; Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopDelete"), animation: ToasterAnimation.FadeIn); await RefreshVersionsList(); await Search(); Clear(); } } } } HelpClass.EndAwait(grid_main); } catch (Exception ex) { HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }