private void btnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { gvFragment.CloseEditor(); if (bsRouteLine.Count <= 0) { return; } if (MsgBox.ShowQuestion("确认删除当前行吗?") == DialogResult.Yes) { RouteFragmentConfigInfo frag = bsRouteLine.Current as RouteFragmentConfigInfo; if (frag != null) { OperateReturnInfo opr = AGVDAccess.AGVClientDAccess.del_RouteFragment(frag); if (opr.ReturnCode == OperateCodeEnum.Success) { this.bsRouteLine.DataSource = AGVDAccess.AGVClientDAccess.get_RouteFragmentByFragment(); bsRouteLine.ResetBindings(false); } MsgBox.Show(opr); } } } catch (Exception ex) { MsgBox.ShowError(ex.Message); } }
/// <summary> /// 显示页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected internal void FrmFragmentSet_Shown(object sender, EventArgs e) { try { CenterToParent(); this.bsCmd.DataSource = AGVDAccess.AGVClientDAccess.get_Cmd(); RouteFragmentConfigInfo routefrag = new RouteFragmentConfigInfo(); bsCmd.ResetBindings(false); if (Set == 1) { routefrag.Fragment = Fragment; txtFragment.Text = Fragment; txtFragment.ReadOnly = true; IList <RouteFragmentConfigInfo> RouteFragmentConfigList = AGVDAccess.AGVClientDAccess.load_OtherByFragment(Fragment); IList <string> landmarks = new List <string>(); foreach (var item in RouteFragmentConfigList) { if (!landmarks.Contains(item.ActionLandMark)) { landmarks.Add(item.ActionLandMark); } } IList <LandmarkToActionsInfo> LandmarkToActionsList = new List <LandmarkToActionsInfo>(); foreach (var landmark in landmarks) { LandmarkToActionsInfo item = new LandmarkToActionsInfo(); item.LandCode = landmark; foreach (var action in RouteFragmentConfigList) { if (action.ActionLandMark == landmark) { IList <CmdInfo> cmd = this.bsCmd.List as List <CmdInfo>; foreach (var cmdName in cmd) { if (action.CmdCode == cmdName.CmdCode) { action.CmdName = cmdName.CmdName; } } item.ActionList.Add(action); } } LandmarkToActionsList.Add(item); } this.bsAction.DataSource = LandmarkToActionsList; } this.gvActionLandMark.RefreshData(); } catch (Exception ex) { MsgBox.ShowError(ex.Message); } }
private void btnNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { RouteFragmentConfigInfo frag = bsRouteLine.Current as RouteFragmentConfigInfo; using (FrmFragmentSet frm = new FrmFragmentSet("", 0)) { if (frm.ShowDialog() == DialogResult.OK) { this.bsRouteLine.DataSource = AGVDAccess.AGVClientDAccess.get_RouteFragmentByFragment(); bsRouteLine.ResetBindings(false); bsRouteLine.MoveLast(); } } }
private void gvFragment_DoubleClick(object sender, EventArgs e) { RouteFragmentConfigInfo frag = bsRouteLine.Current as RouteFragmentConfigInfo; if (frag == null) { return; } using (FrmFragmentSet frm = new FrmFragmentSet(frag.Fragment, 1)) { if (frm.ShowDialog() == DialogResult.OK) { this.bsRouteLine.DataSource = AGVDAccess.AGVClientDAccess.get_RouteFragmentByFragment(); bsRouteLine.ResetBindings(false); } } }
/// <summary> /// 删除一条动作指令 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDel_Click(object sender, EventArgs e) { try { gvCmdSet.CloseEditor(); RouteFragmentConfigInfo currFrag = bsFragment.Current as RouteFragmentConfigInfo; if (currFrag == null) { return; } bsFragment.Remove(currFrag); bsFragment.ResetBindings(false); } catch (Exception ex) { MsgBox.ShowError(ex.Message); } }
/// <summary> /// 右键删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCmDel_Click(object sender, EventArgs e) { try { RouteFragmentConfigInfo fragconfig = bsFragment.Current as RouteFragmentConfigInfo; if (fragconfig == null) { return; } bsAction.Remove(fragconfig); bsAction.ResetBindings(false); gvActionLandMark_FocusedRowChanged(null, null); } catch (Exception ex) { MsgBox.ShowError(ex.Message); } }
/// <summary> /// 向上移动一行 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUp_Click(object sender, EventArgs e) { try { if (gvCmdSet.IsFirstRow) { return; } RouteFragmentConfigInfo frag = bsFragment.Current as RouteFragmentConfigInfo; if (frag == null) { return; } IList <RouteFragmentConfigInfo> listfrag = bsFragment.List as IList <RouteFragmentConfigInfo>; if (listfrag == null) { return; } if (listfrag.Count <= 0) { return; } int selectIndex = listfrag.IndexOf(frag); RouteFragmentConfigInfo pre = DataToObject.CreateDeepCopy <RouteFragmentConfigInfo>(listfrag[selectIndex - 1]); frag.CmdIndex = frag.CmdIndex - 1; listfrag[selectIndex - 1] = frag; pre.CmdIndex = pre.CmdIndex + 1; listfrag[selectIndex] = pre; bsFragment.DataSource = listfrag; bsFragment.ResetBindings(false); gvCmdSet.MovePrev(); } catch (Exception ex) { MsgBox.ShowError(ex.Message); } }/// <summary>