private void RibbonButtonEnableCalibration_Click_1(object sender, RoutedEventArgs e) { if (LastSelected == null) { return; } if (LastSelected.IsEnabled == false) { EnableCalibrationResult result = EnableCalibrationResult.Failed; try { result = channel.EnableCalibration(LastSelected.CalibrationId); } catch (System.Exception ex) { logger.LogException(LogLevel.Info, string.Format("WindowCalibration.RibbonButtonEnableCalibration_Click_1"), ex); } if (result == EnableCalibrationResult.Successful) { BindGridAsync(); } else if (result == EnableCalibrationResult.AlreadyEnabledForThisId) { DialogBoxOk dialogBoxOk = new DialogBoxOk(); dialogBoxOk.Message = string.Format("برای {0} گزینه فعال وجود دارد،ابتدا آن را غیر فعال کنید", LastSelected.Title); dialogBoxOk.Width = 300; dialogBoxOk.Height = 120; dialogBoxOk.ShowDialog(); } } }