/// <summary> /// 新建病历出入库单 /// </summary> private void NewCaseBill() { this.operateState = OperateState.NewBill; this.neuSpread1_Sheet1.RowCount = 0; this.InitCaseInfoDisplay(); this.neuTextBoxCardNo.Focus(); }
/// <summary> /// 操作类的构造函数 /// </summary> /// <param name="player">所属玩家</param> public Operation(Player player, PlayerStep steps) { arrow = player.arrow_Prefab; playerID = player.PlayerID; state = player.OpState; commandUI = player.commandUI; clickMap = null; save_Steps = steps; }
public static bool CheckLockState(int state, OperateState op) { if (state > 0) { OperateState np = (OperateState)state; return((np & op) == op); } return(true);//如果是0,默认配置所有权限 }
// Use this for initialization private void Start() { //更新鼠标当前cell Observable.EveryUpdate() .Subscribe(l => { //行为:更新光标位置 CurrentCell = Utils.GetMouseCell(GroundTilemap); }); //按下建设按钮就进入规划状态 BuildButton.OnClickAsObservable().Subscribe(_ => { CurrentOperateState = OperateState.Planning; }); //规划状态下的各种处理 Observable.EveryUpdate() .Where(l => CurrentOperateState == OperateState.Planning) .Subscribe(_ => { if (Input.GetMouseButtonUp(1)) { //右键点击回到待机状态 ClearGroundPreviewCells(); CurrentOperateState = OperateState.Idle; } else if (!Input.GetMouseButton(0)) { //单一块预览(鼠标没按下时) var mouseCell = Utils.GetMouseCell(GroundTilemap); UpdateGroundPreviewCells(mouseCell, mouseCell); } else if (Input.GetMouseButtonDown(0)) { //左键点下时记录起始tile _cellPlanningStart = CurrentCell; } else if (Input.GetMouseButton(0)) { //按住时获取结束tile _cellPlanningEnd = CurrentCell; //基于起始位置更新绘制区方块 UpdateGroundPreviewCells(_cellPlanningStart, _cellPlanningEnd); } //地表预览层更新要绘制的cell GroundPreviewLayer.ClearAllTiles(); foreach (var cell in _groundPreviewCells) { GroundPreviewLayer.SetTile(cell, GroundPreviewTile); } }); }
public bool EnterStopLock() { // State lock (_syncRoot) { if (_operateState != OperateState.Started) return false; _operateState = OperateState.Operating; } // Return return true; }
/// <summary> /// 创建OperateResult的Emit方法 /// </summary> /// <param name="operateType">操作结果类型</param> /// <param name="operateState">操作结果状态</param> /// <param name="msg">操作结果信息</param> /// <returns>OperateResult</returns> public static OperateResult EmitCreate(Type operateType, OperateState operateState, string msg) { var returnType = operateType; if (operateType.BaseType == typeof(Task)) { returnType = operateType.GenericTypeArguments[0]; } var method = _CreateOperateResultCache.GetValue(returnType.TypeHandle, () => { return(EmitMethodCreate(returnType)); }); var fuc = (Func <OperateState, string, OperateResult>)method.CreateDelegate(typeof(Func <OperateState, string, OperateResult>)); return(fuc(operateState, msg)); }
/// <summary> /// 初始化UC /// </summary> private void InitUC() { this.InitCaseInfoDisplay(); this.InitCaseBillTree(); this.InitDeptComboBox(); this.neuSpread1_Sheet1.RowCount = 0; this.operateState = OperateState.NewBill; this.billCode = string.Empty; this.neuTextBoxStatus.Text = this.GetOperateState(this.operateState); this.currentCaseBill = new Neusoft.HISFC.Models.HealthRecord.Case.CaseBill(); this.DisplayCaseCount(); this.currentState = Neusoft.HISFC.Models.HealthRecord.Case.EnumCaseBillState.InRequest; this.neuButtonConfirmApply.Enabled = true; this.neuTextBoxCardNo.Enabled = true; this.neuComboBoxDept.Enabled = true; this.neuTextBoxCardNo.Focus(); }
/// <summary> /// 根据当前操作状态返回状态信息 /// </summary> /// <param name="state">当前操作状态</param> /// <returns>状态信息</returns> private string GetOperateState(OperateState state) { string stateMsg = "无操作单据"; switch (state) { case OperateState.Idle: stateMsg = "无操作单据"; break; case OperateState.NewBill: stateMsg = "新建单据"; break; case OperateState.OldBill: stateMsg = "现有单据"; break; } return(stateMsg); }
public static int GetLockEnum(bool IsLockPost, bool IsLockComment, bool IsLockPraise, bool IsLockReward) { OperateState op = OperateState.none; if (IsLockPost) { op = op | OperateState.post; } if (IsLockComment) { op = op | OperateState.comment; } if (IsLockPraise) { op = op | OperateState.praise; } if (IsLockReward) { op = op | OperateState.reward; } return((int)op); }
/// <summary> /// 病历号回车事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void neuTextBoxCardNo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (this.neuTextBoxCardNo.Text != "") { this.neuTextBoxCardNo.Text = this.neuTextBoxCardNo.Text.PadLeft(10, '0'); this.callReturn = this.QueryByCardNo(this.neuTextBoxCardNo.Text); if (this.callReturn == -1) { return; } switch (this.operateState) { case OperateState.Idle: this.CurrentOperateState = OperateState.NewBill; if (this.currentCaseBill.Memo == "") { this.currentCaseBill.Memo = "New"; } break; case OperateState.NewBill: if (this.currentCaseBill.Memo == "") { this.currentCaseBill.Memo = "New"; } break; case OperateState.OldBill: break; } this.neuComboBoxDept.Focus(); } } }
public void ExitStopLock(bool isFailed = false) { // State lock (_syncRoot) { if (_operateState != OperateState.Operating) return; if (isFailed == true) _operateState = OperateState.Failed; if (isFailed == false) _operateState = OperateState.Stopped; } }
public OperateResult(OperateState state, string msg) : this(state) { Message = msg; }
public OperateResult(OperateState state) : this() { State = state; }
private void ExecuteOperation() { // Operation try { // Execute while (true) { // Detach Action action = _executeActionQueue.Dequeue(); // Execute if (action != null) { action(); } // Exit if (action == null) { lock (_syncRoot) { if (_executeThreadState != OperateState.Started) { return; } } } } } finally { // End lock (_syncRoot) { _executeThreadState = OperateState.Stopped; } _executeThreadEvent.Set(); } }
public void Stop() { // OperateState OperateState operateState = OperateState.Stopped; lock (_syncRoot) { // State operateState = _operateState; if (_operateState == OperateState.Started) { _operateState = OperateState.Stopping; } } // ExecuteThread if (operateState == OperateState.Started) { lock (_syncRoot) { if (_executeThreadState != OperateState.Stopped) { _executeThreadState = OperateState.Stopping; _executeActionQueue.Release(); } } } // Wait if (Thread.CurrentThread == _executeThread) { this.ExecuteOperation(); } _executeThreadEvent.WaitOne(); lock (_syncRoot) { _operateState = OperateState.Stopped; } }
// Methods public void Start() { // OperateState lock (_syncRoot) { // Require if (_operateState != OperateState.Stopped) throw new InvalidOperationException(); // State _operateState = OperateState.Started; } // ExecuteThread lock (_syncRoot) { _executeThreadEvent.Reset(); _executeThreadState = OperateState.Started; } _executeThread = new Thread(this.ExecuteOperation); _executeThread.Name = string.Format("Class:{0}, SubThread:{1}, Id:{2}", "STAThread", "ExecuteThread", _executeThread.ManagedThreadId); _executeThread.IsBackground = false; _executeThread.Start(); }
/// <summary> /// 鼠标单击树结点事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void neuTreeViewBill_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { // 单击的是单据结点 if (e.Node.Level == 2) { try { Neusoft.FrameWork.Models.NeuObject node = e.Node.Tag as Neusoft.FrameWork.Models.NeuObject; this.operateState = OperateState.OldBill; this.billCode = node.ID; TreeNode parentNode = e.Node.Parent; switch (parentNode.Text) { case "已经申请入库": this.currentState = Neusoft.HISFC.Models.HealthRecord.Case.EnumCaseBillState.InRequest; break; case "等待出库审核": this.currentState = Neusoft.HISFC.Models.HealthRecord.Case.EnumCaseBillState.OutAuditing; break; case "等待入库确认": this.currentState = Neusoft.HISFC.Models.HealthRecord.Case.EnumCaseBillState.InConfirm; break; } if (this.currentState != Neusoft.HISFC.Models.HealthRecord.Case.EnumCaseBillState.InRequest) { this.neuButtonConfirmApply.Enabled = false; this.neuTextBoxCardNo.Enabled = false; this.neuComboBoxDept.Enabled = false; } else { this.neuButtonConfirmApply.Enabled = true; this.neuTextBoxCardNo.Enabled = true; this.neuComboBoxDept.Enabled = true; } if (this.currentState == Neusoft.HISFC.Models.HealthRecord.Case.EnumCaseBillState.InConfirm) { this.neuButtonDelete.Enabled = false; } else { this.neuButtonDelete.Enabled = true; } this.QueryByBillCode(node.ID); } catch (Exception exception) { Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show(exception.Message); } } }
/********************************* * 函数说明: 执行更新回调函数 * 返 回 值: void * 注意事项: 无 *********************************/ public void OnUpdate() { // 检查回调的状态(销毁状态的话不处理) if (state == OperateState.None) { // 更新延时帧数 if (delayframe > 1) { delayframe -= 1; return; } // 更新回调 state = OperateState.Handle; delayframe = maxframe; #region 检测回调函数的Target if (isNeedCheckTarget == true) { if ((callback != null && callback.Target == null) || (callbackRepeat != null && callbackRepeat.Target == null)) { state = OperateState.Remove; #if UNITY_EDITOR Debug.LogError("DelayCallManager : Your CallBack Target is Delete or Destroy , Check your script and Try to avoid CallBack Target [" + targetName + "] == null!!!"); #endif // UNITY_EDITOR return; } } #endregion #region 执行回调 try { if (callback != null) { callback(msgArg); state = OperateState.Remove; } else if (callbackRepeat != null) { if (Repeat.Exit == callbackRepeat(msgArg)) { state = OperateState.Remove; } else { // 只有为删除的函数才继续执行 if (state == OperateState.Handle) { state = OperateState.None; } } } else { state = OperateState.Remove; } } catch (System.Exception ex) { state = OperateState.Remove; Debug.LogError("CallBack Exception : " + ex.ToString()); } #endregion } }
/// <summary> /// 加载现有病历出入库单据 /// </summary> private void LoadCaseBill() { this.operateState = OperateState.OldBill; this.InitCaseInfoDisplay(); }