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); }
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); }