private void tvCategory_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { if (e.Label == null) { if (string.IsNullOrEmpty(SelectNodeViewText)) { //表示没有进行修改 e.Node.Remove(); } else { e.CancelEdit = true; } return; } if (e.Label.ToString().Trim() == "") { e.CancelEdit = true; return; } if (dictList.Where(q => q.CategoryName.Value == e.Label.Trim() && q.CategoryName.Value != SelectNodeViewText).FirstOrDefault() != null) { e.CancelEdit = true; WinFormLib.Core.MessageBoxHelper.ShowError("分类已存在!"); return; } if (!string.IsNullOrEmpty(SelectNodeViewText)) { Dict dicEntity = dictList.Where(q => q.CategoryName.Value == SelectNodeViewText).FirstOrDefault(); if (dicEntity != null) { dicEntity.CategoryName = e.Label.Trim(); } } else { dictList.Add(new Dict() { CategoryName = CDataItem.Instance(e.Label.Trim()), DictItemList = new List <DictItem>() }); } SelectNodeViewText = string.Empty; }
public IEnumerator <Step> StartStep(IEnumerator <Step> iEnumerator) { if (iEnumerator == null) { return(iEnumerator); } if (!iEnumerator.MoveNext()) { return(iEnumerator); } if (mStepGroups == null) { mStepGroups = new DictList <IEnumerator <Step>, StepGroup>(); } var newGroup = new StepGroup(iEnumerator); if (!newGroup.Run()) { mStepGroups.Add(iEnumerator, newGroup); } return(iEnumerator); }
/// <summary> /// 绑定注册 /// </summary> /// <param name="handle"></param> /// <param name="id"></param> public static void BindEventHandler(string command, DriverCmdsEventHandler handle, string cmdtype = "8:其他", string desc = "说明") { string cmd = command.ToLower(); try { DriverCmdsEvent Event = new DriverCmdsEvent() { Cmd = cmd, Desc = desc, }; Event.EventHandler += new DriverCmdsEventHandler(handle); DriverCmdsEventList.TryAdd(cmd, Event); //loger.Info($"注册指令 {cmd} 成功"); if (cmdtype != "") { CmdsTypeList.Add(cmdtype, cmd); } } catch { loger.Warn($"注册指令 {cmd} 失败"); } }