private void OnClickConfrim(object sender, RoutedEventArgs e) { //检查输入参数 if (!CheckArgs()) { CloseWid(); return; } RobotInfo info = new RobotInfo(); string str = TBIPv4.Text.ToString() + ":" + TBPort.Text.ToString(); info.EndPoint = str; info.Id = Convert.ToInt32(TBName.Text.ToString()); //更新XML文件 if (!Tool.RobotsHome.RobotInfoCollect.GetInstance().UpdateRobotInfo(infoCur, info)) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "修改失败请重试!", "错误"); CloseWid(); return; } TipsMessageEx.ShowTips(Tool.MainWindow.This, "修改成功", 18, 5, Colors.Green); CloseWid(); }
private void OnStopProcess(object sender, RoutedEventArgs e) { if (0 == ProcessCheckObj.Count) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "请选择需要操作的进程", "错误"); return; } string id_list = ""; foreach (var id in ProcessCheckObj) { id_list += id; id_list += "|"; } string netid_list = ""; foreach (var id in RobotList) { netid_list += id; netid_list += "|"; } if (NetInterface.NetPostCodeAgvProcess(netid_list, id_list, Tool.RobotsHome.CmdAgvShell.cmd_stop_process) < 0) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "停止失败", "错误"); } TipsMessageEx.ShowTips(Tool.MainWindow.This, "停止请求发送成功", 18, 3, Colors.Green); RobotList.Clear(); dcRobotInfo.Collection.ToList().ForEach(p => p.IsSelectedProcess = false); AllObj.IsChecked = false; }
private void OnClickConfrim(object sender, RoutedEventArgs e) { //参数检查 if (!CheckArgs()) { return; } //格式化数据 RobotInfo info = new RobotInfo(); info.Id = Convert.ToInt32(TBAddID.Text.ToString()); info.EndPoint = TBIP.Text.ToString() + ":" + TBPort.Text.ToString(); info.NetId = 0; info.NetState = false; info.Fts = TBIP.Text.ToString() + ":" + "4411"; List <RobotInfo> list = new List <RobotInfo>(); list.Add(info); //接口调用写入XML if (!RobotInfoCollect.GetInstance().AppendRobotInfo(list)) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "添加信息失败", "提示"); return; } //刷新界面 Tool.RobotsHome.RobotsHome.This.Refresh(); Tool.CarHouse.CartHousePage.This.Refresh(); TipsMessageEx.ShowTips(Tool.MainWindow.This, "添加信息成功", 18, 5, Colors.Green); CloseWid(); }
private void OnDownLoad(object sender, MouseButtonEventArgs e) { Tool.XControl.ImageButton Btn = sender as Tool.XControl.ImageButton; string net_id = Btn.Tag.ToString(); if (null == net_id) { return; } System.Windows.Forms.FolderBrowserDialog folder = new System.Windows.Forms.FolderBrowserDialog(); folder.ShowDialog(); if ("" == folder.SelectedPath) { return; } if (DownLoadCore(net_id, folder.SelectedPath) < 0) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "请先选择目标文件", "错误"); return; } TipsMessageEx.ShowTips(Tool.MainWindow.This, "正在下载固件。。。", 18, 5, Colors.Green); }
public void SendFile() { if (SelectList.Count <= 0) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "请选择需要发送的IP!", "错误"); return; } if (FileList.Count <= 0) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "请选择需要发送的为文件!", "错误"); return; } int retval = Tool.FileHandle.FTS.PushFiles(SelectList, FileList, ToDir); if (retval < 0) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "发送文件失败!", "错误"); return; } TipsMessageEx.ShowTips(Tool.MainWindow.This, "已经加入传输列表", 20, 5, Colors.Green); dcContent.Collection.ToList().ForEach(p => p.IsSelected = false); SelectList.Clear(); Task.Run(() => { this.Dispatcher.Invoke(() => { Close(); }); }); }
private void OnUpdate(object sender, MouseButtonEventArgs e) { Tool.XControl.ImageButton Btn = sender as Tool.XControl.ImageButton; string fts_ep = Btn.Tag.ToString(); if (null == fts_ep) { return; } var fw = sender as FrameworkElement; if (null == fw) { return; } var info = fw.DataContext as Tool.RobotsHome.RobotInfo; //固件升级中状态进行中或者重启中,直接返回。 if (1 == info.BinStatus || 2 == info.BinStatus) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "正在操作中,请稍后再试", "错误"); return; } if (UpdateCore(fts_ep, false) < 0) { return; } TipsMessageEx.ShowTips(Tool.MainWindow.This, "正在更新固件。。。", 18, 5, Colors.Green); }
//文件重传 private void OnRepeatTransfrom(object sender, RoutedEventArgs e) { if (SelectFileList.Count <= 0) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "请选择需要重传的文件!", "提示"); return; } string dirList = null; foreach (string dir in SelectFileList) { if (dir == null) { continue; } dirList += dir + "|"; } int retval = NetInterface.NetRepeatFilesToRemote(Taskid, dirList, dirList.Length); if (retval < 0) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "重传失败", "错误"); return; } TipsMessageEx.ShowTips(Tool.MainWindow.This, "任务继续,请稍后。。。", 18, 5, Colors.Green); dcContent.Collection.ToList().ForEach(p => p.IsFileSelected = false); SelectFileList.Clear(); FilesCheckBox.IsChecked = false; }
private void OnSaveDHCPAddr(object sender, RoutedEventArgs e) { if (Tool.Setting.ConfigRead.UpdataDHCP(DHCP_IP.Text.ToString(), DHCP_Port.Text.ToString()) < 0) { TipsMessageEx.ShowTips(Tool.MainWindow.This, "设置失败", 18, 5, Colors.Green); return; } TipsMessageEx.ShowTips(Tool.MainWindow.This, "设置成功", 18, 5, Colors.Green); }
private void OnClickSend(object sender, RoutedEventArgs e) { if (0 == ProcessList.Count) { return; } Tool.Proto.ProtoProcessDetail proto = new Proto.ProtoProcessDetail(); foreach (var obj in ProcessList) { Tool.Proto.ProcessDetail info = new Proto.ProcessDetail(); info.ProcessName.value_ = obj.Name; info.ProcessDir.value_ = obj.Path; info.ProcessArg.value_ = obj.Arg; info.ProcessDelayTime.value_ = obj.DelayTime; proto.List.Add(info); } byte[] b_msg = new byte[proto.length()]; Int32 offset = 0; if (!proto.serialize(b_msg, ref offset)) { return; } int retval = -1; this.WaitEvent(() => { foreach (string ep in SelectList) { unsafe { fixed(byte *l_msg = b_msg) { Int32 netid = RobotInfoCollect.GetInstance().FindNetId(ep); if (netid < 0) { continue; } void *data = null; int len = 0; retval = NetInterface.NetPostSyncPackage(netid, (int)NetInterface.PKTTYPE.kAgvShellProto_UpdateProcessDetail, l_msg, proto.length(), &data, &len); NetInterface.FreeDetail(data); } } } }, true, true); Task.Run(() => { this.Dispatcher.Invoke(() => { Close(); }); }); TipsMessageEx.ShowTips(Tool.MainWindow.This, "已发送更新软件配置请求,详情请查看配置页面", 18, 5, Colors.Green); }
private void OnClickChangeBlockSize(object sender, RoutedEventArgs e) { NetInterface.NetSetBlockSize(BlockSize); TipsMessageEx.ShowTips(Tool.MainWindow.This, "设置成功", 18, 5, Colors.Green); ((ComboBoxItem)(ComboxBlockSize.SelectedItem)).IsSelected = true; Task.Run(() => { this.Dispatcher.Invoke(() => { Close(); }); }); }
private void OnResetProcess(object sender, MouseButtonEventArgs e) { Tool.XControl.ImageButton Btn = sender as Tool.XControl.ImageButton; string net_id = Btn.Tag.ToString(); if (null == net_id) { return; } if (ResetProcessCore(net_id) < 0) { return; } TipsMessageEx.ShowTips(Tool.MainWindow.This, "正在重启。。。", 18, 5, Colors.Green); }
public int UpdateProcessInfo() { List <ProcessObjInfo> list = dcProcessInfo.Collection.ToList(); Tool.Proto.ProtoProcessDetail proto = new Proto.ProtoProcessDetail(); foreach (var obj in list) { Tool.Proto.ProcessDetail info = new Proto.ProcessDetail(); info.ProcessName.value_ = obj.Name; info.ProcessDir.value_ = obj.Path; info.ProcessArg.value_ = obj.Arg; info.ProcessDelayTime.value_ = obj.DelayTime; proto.List.Add(info); } byte[] b_msg = new byte[proto.length()]; Int32 offset = 0; if (!proto.serialize(b_msg, ref offset)) { return(-1); } int retval = -1; this.WaitEvent(() => { unsafe { fixed(byte *l_msg = b_msg) { void *data = null; int len = 0; retval = NetInterface.NetPostSyncPackage(RobotId, (int)NetInterface.PKTTYPE.kAgvShellProto_UpdateProcessDetail, l_msg, proto.length(), &data, &len); } } }, true, true); if (retval < 0) { TipsMessageEx.ShowTips(Tool.MainWindow.This, "更新软件配置失败", 18, 5, Colors.Green); return(retval); } TipsMessageEx.ShowTips(Tool.MainWindow.This, "更新软件配置成功", 18, 5, Colors.Green); return(retval); }
public void InitAGV() { if (SelectList.Count <= 0) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "请选择需要发送的IP!", "错误"); return; } string epList = null; foreach (string ep in SelectList) { if (ep == null) { continue; } epList += ep + "|"; } int retval = -1; this.Dispatcher.Invoke(() => { this.WaitEvent(() => { retval = NetInterface.NetInitFactorySetting(epList, fn_init_agv_t_); }); }); if (retval < 0) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "初始化失败", "错误"); return; } dcContent.Collection.ToList().ForEach(p => p.IsSelected = false); SelectList.Clear(); TipsMessageEx.ShowTips(Tool.MainWindow.This, "初始化结束", 20, 5, Colors.Green); this.Dispatcher.Invoke(() => { Close(); }); }
private void OnClickSend(object sender, RoutedEventArgs e) { string msg = TBMSG.Text.ToString(); if (msg == String.Empty) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "请输入脚本", "提示"); return; } Tool.Proto.ProtoMSG protomsg = new Proto.ProtoMSG(); protomsg.MSG.value_ = msg; byte[] b_msg = new byte[protomsg.length()]; Int32 offset = 0; protomsg.serialize(b_msg, ref offset); var array_ip = RobotList.Split('|'); foreach (string robot_id in array_ip) { if (robot_id == String.Empty) { continue; } unsafe { fixed(byte *l_msg = b_msg) { NetInterface.NetPostAsyncPackage(Convert.ToInt32(robot_id), (int)NetInterface.PKTTYPE.kAgvShellProto_RunScript, l_msg, protomsg.length()); } } } TipsMessageEx.ShowTips(Tool.MainWindow.This, "执行脚本完成", 18, 5, Colors.Green); Task.Run(() => { this.Dispatcher.Invoke(() => { Close(); }); }); }
private void OnClickBatchConfrim(object sender, RoutedEventArgs e) { if (0 == listProduce.Count) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "预览列表为空!", "提示"); return; } //接口调用写入XML if (!RobotInfoCollect.GetInstance().AppendRobotInfo(listProduce)) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "批量添加信息失败", "提示"); return; } //刷新界面 Tool.RobotsHome.RobotsHome.This.Refresh(); Tool.CarHouse.CartHousePage.This.Refresh(); TipsMessageEx.ShowTips(Tool.MainWindow.This, "批量添加信息成功", 18, 5, Colors.Green); CloseWid(); }
private void OnClickSend(object sender, RoutedEventArgs e) { Tool.Proto.ProtoVCUEnable proto = new Proto.ProtoVCUEnable(); int status = 0; if (true == RDYes.IsChecked) { status = 1; } else if (true == RDNo.IsChecked) { status = 0; } proto.VCUEnable.value_ = status; byte[] b_msg = new byte[proto.length()]; Int32 offset = 0; proto.serialize(b_msg, ref offset); unsafe { fixed(byte *l_msg = b_msg) { if (NetInterface.NetPostAsyncPackage(RobotID, (int)NetInterface.PKTTYPE.kAgvShellProto_VCUEnable, l_msg, proto.length()) < 0) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "设置失败", "错误"); return; } } } TipsMessageEx.ShowTips(Tool.MainWindow.This, "设置成功", 18, 5, Colors.Green); Task.Run(() => { this.Dispatcher.Invoke(() => { Close(); }); }); }
private void OnUpdateDriver(object sender, MouseButtonEventArgs e) { Tool.XControl.ImageButton Btn = sender as Tool.XControl.ImageButton; string fts_ep = Btn.Tag.ToString(); if (null == fts_ep) { return; } string id = TB_NodeId.Text.ToString(); if (id == string.Empty) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "请输入节点ID", "错误"); return; } if (UpdateDriver(fts_ep, id, false) < 0) { return; } TipsMessageEx.ShowTips(Tool.MainWindow.This, "正在更新自主驱动。。。", 18, 5, Colors.Green); }
//删除车载文件 private void OnClickDeleteFile(object sender, RoutedEventArgs e) { List <TransFilesInfo> tmpList = new List <TransFilesInfo>(); CheckSelFileList(ref tmpList); MessageBoxResult Result = NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "是否删除此文件?", "提示", MessageBoxButton.YesNo); if (Result == MessageBoxResult.No) { return; } int retval = -1; this.Dispatcher.Invoke(() => { this.WaitEvent(() => { unsafe { retval = Tool.FileHandle.FTS.DeleteFile(EP, tmpList); } }, true, true); }); if (retval < 0) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "删除文件失败", "错误"); RefreshList(); dcRemote.Collection.ToList().ForEach(p => p.IsSelectedRemote = false); return; } RefreshList(); dcRemote.Collection.ToList().ForEach(p => p.IsSelectedRemote = false); TipsMessageEx.ShowTips(Tool.MainWindow.This, "删除文件成功", 18, 5, Colors.Green); }
//文件Local to Remote private void OnClickedPushFiles(object sender, RoutedEventArgs e) { if (0 == SelectLocalList.Count) { return; } String dir = null; Tool.Setting.ConfigRead.ReadLocalDir(ref dir); if (dir == null) { return; } int retval = Tool.FileHandle.FTS.PushFile(EP, SelectLocalList, DirRelative); if (retval < 0 && -2 == retval) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "发送文件失败,目标IP已有其他任务正在运行!", "错误"); return; } if (retval < 0 && -1 == retval) { NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "发送文件失败!", "错误"); return; } TipsMessageEx.ShowTips(Tool.MainWindow.This, "已经加入传输列表", 18, 5, Colors.Green); AllLocalFilesCheckBox.IsChecked = false; SelectLocalList.Clear(); dcLocal.Collection.ToList().ForEach(p => p.IsSelectedLocal = false); }