private void endServiceBtn_Click(object sender, EventArgs e) { try { DialogResult result = MessageBox.Show("Are you sure you want to abort service?", "Abort Service", MessageBoxButtons.YesNo); if (result == System.Windows.Forms.DialogResult.Yes) { foreach (DataGridViewRow row in scheduleInfoGrid.SelectedRows) { var scheduleData = from s in _scheduledServices where s.Key.GetHashCode() == Convert.ToInt32(row.Cells["shceduledID"].Value) select s.Key; try { _scheduler.AbortRuningService(scheduleData.First()); } catch (Exception ex) { MessageBox.Show(string.Format("You cannot delete service in this state\n{0}", ex.Message)); } } GetScheduleServices(); } } catch (Exception ex) { Easynet.Edge.Core.Utilities.Log.Write("SchedulingControlForm", ex.Message, ex, Easynet.Edge.Core.Utilities.LogMessageType.Error); } }