private void OnToggleClickerState(ClickerEventArgs args) { if (args.Data.ToString() == BindedKey) { if (!IsClickerWorking) { if (Start.CanExecute(null)) { Start.Execute(null); } return; } if (Stop.CanExecute(null)) { Stop.Execute(null); } } }
} // end HandleAction public static bool HandleAction(Connection connection, string sUserId, ActionTypes actionType, string sArg3) { int iArg3; switch (actionType) { case SandsOfTime.Actions.ActionTypes.Start: return (Start.Execute(connection, sUserId, sArg3) > 0); case SandsOfTime.Actions.ActionTypes.Stop: return (Stop.Execute(connection, sUserId) > 0); case SandsOfTime.Actions.ActionTypes.Resume: return (Resume.Execute(connection, sUserId, sArg3) > 0); case SandsOfTime.Actions.ActionTypes.Rename: return (Rename.Execute(connection, sUserId, sArg3) > 0); case SandsOfTime.Actions.ActionTypes.List: return (List.Execute(connection, sUserId, int.TryParse(sArg3, out iArg3) ? iArg3 : 0) > 0); default: return (false); } // end switch } // end HandleAction
} // end ResumeTask #endregion #endregion #region Stop Task #region StopTask private void StopTask(object sender, EventArgs e) { int iResult; iResult = Stop.Execute(_connection, _sUserId); if (iResult == 0) { MessageBox.Show(this, "There are currently no tasks started.", "Stop Task Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } // end if else if (iResult == -1) { MessageBox.Show(this, "There was an error stopping the task.", "Stop Task Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } // end else if else { RefreshReportView(null, null); _toolBtnTasks_Stop.Enabled = _mnItmTools_StopTask.Enabled = false; } // end else } // end StopTask