zoukankan      html  css  js  c++  java
  • Halcon_Gocator_VisualStudio

    代码中启动另一个exe程序:

    ProcessStartInfo info = new ProcessStartInfo();
                info.FileName = @"D:KitaSOFT_WAREqqBinQQ.exe";
                info.Arguments = "";
                info.WindowStyle = ProcessWindowStyle.Minimized;
                Process pro = Process.Start(info);
                //pro.WaitForExit();
    

      Gocator Sdk获取数据:

     dataSet = system.ReceiveData(30000000);
                for (int i = 0; i < dataSet.Count; i++)
                {
                    GoDataMsg dataFrame = (GoDataMsg)dataSet.Get(i);
                    if (dataFrame.MessageType==GoDataMessageType.UniformSurface)
                    {
                        GoSurfaceMsg dataSurface = (GoSurfaceMsg)dataFrame;
                        long width = dataSurface.Width;
                        long length = dataSurface.Length;
                        long bufferSize = width * length;
    
                        IntPtr bufferPointer = dataSurface.Data;
    
                        //Console.WriteLine("Whole Part Height Map received:");
                        //Console.WriteLine(" Buffer  {0}", width);
                        //Console.WriteLine(" Buffer length: {0}", length);
    
                        
                        short[] ranges = new short[bufferSize];
                        Marshal.Copy(bufferPointer, ranges, 0, ranges.Length);
                        RecSurfData.Add(ranges);
    

      其中用到Marshal类的copy函数,需要using System.Runtime.InteropServices;

    打开选择文件窗口,并返回选中文件绝对路径

    using Microsoft.Win32;
    
      OpenFileDialog dialog = new OpenFileDialog();
      dialog.ShowDiag(); //返回一个可空的布尔值
        
        Console.Write(dialog.Filename);  //路径保存在这里
    

      

    切换空间字体颜色;

      StateConnect.Foreground = Brushes.Green;
    

      

     TextBox作为InfoLog使用

    VerticalScrollBarVisibility="Auto" Foreground="Green"
    
    
     public void StateBox(string txt)
            {
                string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff");
                string str = time + "->"+"
    "+txt+"
    ";
                WindowStateLog.AppendText(str);
                WindowStateLog.ScrollToEnd();
            }
    

      

    打开文件选择对话框,选择文件获取路径

    using Microsoft.Win32;
    
    private void BtnOpenFile_Click(object sender, RoutedEventArgs e)
            {
                OpenFileDialog op = new OpenFileDialog();
                //op.InitialDirectory = "D:/3D";
                op.Title = "请选择导入csv文件";
                op.Filter = "csv文件|*.csv";
               
                if (op.ShowDialog() ==true)
                {
                    SingleDataPath = op.FileName;
                    TextBoxPath.Text = op.FileName;
                }
                else {
                    MessageBox.Show("未选中任何文件");
                }
            }
    OpenFileDialog 也可直接返回Stream对象,直接进行读写操作;


     OutPutFile = new StreamWriter("D:/3D/output.csv",true);
    //查看构造函数重载,采用覆盖,末尾添加等模式
    

      

    textbox作为状态log输出框
    VerticalScrollBarVisibility="Auto"
    
    WPF里面 自动显示滚动条
    
                WindowStateLog.AppendText(str);
                WindowStateLog.ScrollToEnd();
    末尾添加新log并把焦点聚焦在最后一排
    

      



  • 相关阅读:
    [uiautomator篇] UiWatcher的使用
    [android开发篇]安装android sdk的时候请注意
    Oracle to_char格式化函数
    SharePoint2010主题和样式揭秘
    场解决方案添加webpart(Create Webpart to page using code)
    SharePoint Site Pages & Application Pages
    Sharepoint的网页(Page),网页解析(Parsing)与解析安全处理(Security)
    用PowerShell批量部署wsp包
    用PowerShell批量收回wsp包
    SharePoint 2010 PowerShell 系列 之 备份、还原、部署 .WSP
  • 原文地址:https://www.cnblogs.com/kita/p/11374628.html
Copyright © 2011-2022 走看看