private void ClearAll() { ClearCurrent(); LastOperator = 0; M.ClearCalcObejcts(); }
/// <summary> /// コンストラクタ処理 /// </summary> /// <param name="priority"></param> /// <param name="message"></param> /// <param name="buttons"></param> public ErrorMessage(int priority, string message, OperationButtons buttons, Action <ErrorMessage> doRemove) { Priority = priority; Message = message; Buttons = buttons; DoRemove = doRemove; }
private void OperationButtonsUISetter(OperationButtons operationButton) { switch (operationButton) { case OperationButtons.Start: this.btnPlay.Background = new SolidColorBrush(Colors.LightGreen); this.btnPause.Background = SystemColors.ControlLightBrush; this.btnResume.Background = SystemColors.ControlLightBrush; break; case OperationButtons.Pause: this.btnPause.Background = new SolidColorBrush(Colors.Orange); this.btnPlay.Background = SystemColors.ControlLightBrush; this.btnResume.Background = SystemColors.ControlLightBrush; break; case OperationButtons.Resume: this.btnResume.Background = new SolidColorBrush(Colors.Yellow); this.btnPlay.Background = SystemColors.ControlLightBrush; this.btnPause.Background = SystemColors.ControlLightBrush; break; default: break; } }
private void ClearCurrent() { HandlingOperator = false; CurrentOperator = 0; CurrentNumber = 0.0; CurrentNumberHasDot = false; CurrentDecimalPlaces = 0; }
/// <summary> /// 移譲 /// </summary> /// <param name="priority">1=高い, 9=低い</param> /// <param name="message"></param> /// <param name="buttons"></param> /// <returns></returns> public ErrorMessage Invoke(int priority, string message, OperationButtons buttons) { lock (MyLock) { var errorMessage = new ErrorMessage(priority, message, buttons, Queue.Remove); Queue.Add(errorMessage); return(errorMessage); } }
/// <summary> /// コンストラクタ処理 /// </summary> /// <param name="priprity"></param> /// <param name="errorCode"></param> public ErrorMessage(int priority, ErrorCode errorCode, Action <ErrorMessage> doRemove) { var field = typeof(ErrorCode).GetField($"{errorCode}"); var attribute = field.GetCustomAttribute <ErrorOperationAttribute>(); Priority = priority; Message = attribute.Message; Buttons = attribute.Buttons; DoRemove = doRemove; }
public void UserPressedThisOperation(OperationButtons operation) { if (HandlingOperator) { CurrentOperator = operation; if (M.Ops == 0) { return; } if (M.PopCalcObject().ObjectType == Model.CalcObject.Type.NUM) { throw new Exception("Expecting operator."); } } else { ClearInputNumberData(); // decimal digit info RefreshSavedOperator(operation); // last operator and current operator M.AddCalcObject(new Model.CalcObject(Model.CalcObject.Type.NUM, this.CurrentNumber)); } if ((int)CurrentOperator >> 4 > (int)LastOperator >> 4) { // operator weight increased // do nothing. this.CurrentNumber = M.LastNumber; } else { if (M.Nums == 1) { // do nothing } else { this.CurrentNumber = M.PreviewCalculate(); } } M.AddCalcObject(new Model.CalcObject((Model.CalcObject.Type)operation, 0)); HandlingOperator = true; }
/// <summary> /// コンストラクタ処理 /// </summary> /// <param name="message"></param> public ErrorOperationAttribute(string message, OperationButtons buttons) { Message = message; Buttons = buttons; }
private void RefreshSavedOperator(OperationButtons operation) { LastOperator = CurrentOperator; CurrentOperator = operation; }