コード例 #1
0
        public static void Show(FrameworkElement Owner, Proto.ProtoProcessDetail list, string net_id)
        {
            WinProcessDetail wid = new WinProcessDetail(Owner, list, net_id);

            wid.ShowDialog();
            return;
        }
コード例 #2
0
        public WinProcessDetail(FrameworkElement Owner, Proto.ProtoProcessDetail list, string net_id)
        {
            InitializeComponent();
            RobotId = Convert.ToInt32(net_id);
            This    = this;

            this.Owner = Tool.MainWindow.This;
            Left       = 0;
            Top        = 0;
            Width      = Tool.MainWindow.This.Width;
            Height     = Tool.MainWindow.This.Height;
            this.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            int i = 0;

            foreach (var info in list.List)
            {
                ProcessObjInfo obj = new ProcessObjInfo();
                obj.ID        = ++i;
                obj.Name      = info.ProcessName.value_;
                obj.Path      = info.ProcessDir.value_;
                obj.Arg       = info.ProcessArg.value_;
                obj.DelayTime = info.ProcessDelayTime.value_;
                List.Add(obj);
            }
            ProcessInfoCollect.GetInstance().AddProcess(List);
            Refresh();
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        private void OnClickedCheck(object sender, RoutedEventArgs e)
        {
            Tool.XControl.XButton Btn = sender as Tool.XControl.XButton;
            string net_id             = Btn.Tag.ToString();

            Int32 retval = -1;

            Proto.ProtoProcessDetail list = new Proto.ProtoProcessDetail();

            this.WaitEvent(() =>
            {
                unsafe
                {
                    void *r_data = null;
                    int r_len    = 0;
                    retval       = NetInterface.NetPostSyncPackage(Convert.ToInt32(net_id), (int)NetInterface.PKTTYPE.kAgvShellProto_ProcessDetail, null, 0, &r_data, &r_len);
                    if (retval < 0 || null == r_data)
                    {
                        return;
                    }

                    byte[] ack_msg = null;

                    ack_msg = new byte[r_len];
                    using (UnmanagedMemoryStream ms = new UnmanagedMemoryStream((byte *)r_data, r_len))
                    {
                        ms.Read(ack_msg, 0, ack_msg.Length);
                    }

                    Tool.Proto.Unpackage <Proto.ProtoProcessDetail> info = new Proto.Unpackage <Proto.ProtoProcessDetail>(ack_msg);
                    if (info.build())
                    {
                        list = info.ob;
                    }
                    NetInterface.FreeDetail(r_data);
                }
            }, true, true);

            WinProcessDetail.Show(this, list, net_id);
        }
コード例 #6
0
 public static void Show(this FrameworkElement Owner, Proto.ProtoProcessDetail list, string net_id)
 {
     WinProcessDetail.Show(Owner, list, net_id);
 }