Ejemplo n.º 1
0
 public static void InitHardware()
 {
     AddRunMessage(">Hardware initialize...", OutputLevel.Trace);
     HardwareManage.InitHardware();
     TableManage.InitTables();
     IOManage.InitDrivers();
     VisionManage.VisionInit();
     AddRunMessage(">System init ok.", OutputLevel.Trace);
 }
Ejemplo n.º 2
0
        private void OpenFile()
        {
            try
            {
                bool           bErr        = false;
                string         strFullPath = "";
                OpenFileDialog dialog      = new OpenFileDialog();
                dialog.Multiselect      = false;
                dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
                dialog.Title            = "配方读取";

                dialog.RestoreDirectory = false;
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                strFullPath = dialog.FileName;
                TableDoc doc = TableDoc.LoadObj(strFullPath, ref bErr);
                if (bErr)
                {
                    MessageBox.Show("不是正确的配方文件!", "", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                    return;
                }

                TableManage.docTable = doc;
                TableManage.InitTables();
                if (null != eventTableDataReLoad)
                {
                    this.eventTableDataReLoad();
                }
                MessageBox.Show("加载成功!", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
            }
            catch (Exception ex)
            {
                TableManage.strConfigFile = string.Empty;
                MessageBox.Show("加载失败!\r\n" + ex.ToString(), "", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
            }
        }