示例#1
0
        public void doAction(DataRec dr)
        {
            Method WhatTodo = CombineActionAndManuset;

            var r = WhatTodo.BeginInvoke(dr, MyAsyncCallback, null);

            isGetSignal = manu.WaitOne(timeout);

            if (isGetSignal)
            {
                return;
            }
            else
            {
                dr.missingflag = true;
                Process[] p_arry = Process.GetProcesses();            //得到系统所有进程
                for (int i = 0; i < p_arry.Length; i++)               //遍历每个进程
                {
                    if (p_arry[i].ProcessName == "CarDetect" + CamID) //发现进程
                    {
                        p_arry[i].Kill();                             //就结束它。
                        break;
                    }
                }

                RebootPipe(dr);
            }
        }
 private void HToolPage_Loaded(object sender, RoutedEventArgs e)
 {
     Method.DoEvents();
     Method.BeginInvoke(this, () =>
     {
         if (hWindowTool.HalconWindow.Handle != (IntPtr)0)
         {
             Method.BeginInvoke(this, () => { hWindowTool.Repaint(); });
         }
     });
 }
示例#3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "")
     {
         textBox2.Text = "";
         method        = new Method(Transcription.GetData);
         method.BeginInvoke(textBox1.Text.Trim(), CallBack, null);
     }
     else
     {
         MessageBox.Show("文件oss地址不能为空");
     }
 }
示例#4
0
 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     Method.Progress(this, () =>
     {
         try
         {
             DataService.Default.Load();
             Config.Camera = new HKCamera()
             {
                 CameraName       = Config.Admin.CameraName,
                 InitExposureTime = Config.Admin.ExposureTime
             };
             Config.MacId                 = HardWareHelper.GetCpuId() + HardWareHelper.GetMainHardDiskId();
             Config.MacId                 = EncryptHelper.MD5(Config.MacId + TConfig.Suffix);
             Config.IListener             = Config.Admin.Listener == EncryptHelper.MD5(Config.MacId + TConfig.Suffix);
             Config.Manager               = new DeviceManager(Config.Admin);
             Config.Manager.ConnectEvent += host =>
             {
                 Messenger.Default.Send(new StatuMessage($"{host}{(Config.Manager.Connected ? "已连接" : "已断开")}"));
             };
             if (!Config.IListener)
             {
                 Method.Toast(this, "未注册", true);
             }
             Method.BeginInvoke(this, () =>
             {//预加载
              //new HWindowControlWPF();
             });
         }
         catch (Exception ex)
         {
             ex.Log();
             Messenger.Default.Send(new StatuMessage(ex.Message()));
             Method.Show(this, ex.Message(), LeveType.Error);
         }
     }, () =>
     {
         Messenger.Default.Send(new StatuMessage("加载完成"));
         frame.Content = ViewlLocator.GetViewInstance <MonitorPage>();
     });
 }
示例#5
0
        protected override void Selectioned(ListViewEXT listView1, IListView item)
        {
            switch (item.Text)
            {
            case "查询":
                var query = new HistroyQueryWindow();
                if (Method.Show(listView1, query) == true)
                {
                    DateTime?start = null;
                    DateTime?end   = null;
                    if (ViewModelLocator.Default.HistroyQuery.IStart)
                    {
                        start = ViewModelLocator.Default.HistroyQuery.Start.Date;
                    }
                    if (ViewModelLocator.Default.HistroyQuery.IEnd)
                    {
                        end = ViewModelLocator.Default.HistroyQuery.End.AddDays(1).Date;
                    }

                    var find = $"1=1";
                    if (start != null)
                    {
                        find += $" and {nameof(HistroyInfo.CreateOn)}>=@start";
                    }
                    if (end != null)
                    {
                        find += $" and {nameof(HistroyInfo.CreateOn)}<@end";
                    }
                    {
                        find += $" order by {nameof(HistroyInfo.CreateOn)} desc";
                        Method.Progress(listView1, () =>
                        {
                            var list = server.Find <HistroyInfo>(find, new { start, end });
                            Method.BeginInvoke(listView1, () =>
                            {
                                base.List.Clear();
                                foreach (var temp in list)
                                {
                                    base.List.Add(temp);
                                }
                            });
                        });
                    }
                }
                break;

            case "清空":
                if (Method.Ask(listView1, $"确认清空所有记录:共 {List.Count} 项"))
                {
                    server.Delete(List.ToList());
                    foreach (var temp in List)
                    {
                        File.Delete(Path.Combine(Config.Images, $"{temp.Id}.bmp"));
                    }
                    List.Clear();
                }
                break;

            case "测试":
                if (SelectedItem is HistroyInfo infoTest)
                {
                    var file = Path.Combine(Config.Images, $"{infoTest.Id}.bmp");
                    if (File.Exists(file))
                    {
                        this.MessengerInstance.Send(new TestMessage(file)
                        {
                            Obj = listView1
                        });
                    }
                    else
                    {
                        Method.Toast(listView1, "图片不存在");
                    }
                }
                break;
            }
            base.Selectioned(listView1, item);
        }