RobotManage.cs 1.2 KB
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DeviceLibrary
{
    public static class RobotManage
    {
        public static MainMachine mainMachine;
        public static Robot_Config Config;
        public static bool IsLoadOk = false;

        static string baseDir = Application.StartupPath;
        static Thread mainThread;
        static RobotManage() {

            CodeManager.LoadConfig();

            string configFile = Path.Combine(baseDir, "config\\Config.csv");
            Config = new Robot_Config(0, "", configFile);
            Config = (Robot_Config)CSVConfigReader.LoadConfig(Config);
           
            mainMachine = new MainMachine(RobotManage.Config);
            if (!IOManager.ConnectionIOList(new List<string>())) {
                IsLoadOk = false;
                return;
            }

            IsLoadOk = true;
        }

        static void Start() {
            mainThread = new Thread(new ThreadStart(mainMachine.Run));
            mainThread.Start();
            GC.KeepAlive(mainThread);
        }
    }
}