예제 #1
0
파일: Program.cs 프로젝트: hkiaipc/yh
        static void Main()
        {
            // preinstance
            //
            if (Diagnostics.HasPreInstance())
            {
                NUnit.UiKit.UserMessage.Display(strings.AppRunning);
                return;
            }

            if (EnableExceptionHandle)
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(
                    Application_ThreadException);
            }

            InternalTrace.Initialize("CommuniServer_%p.log");

            CSDBI csdbi = CSDBI.Instance;
            YeHeCommuniServerApp.Default.CSDBI = csdbi;

            csdbi.VerifyDBInfo(Config.Default.ProjectName, Config.Default.MajorVersion,
                Config.Default.MinorVersion , Config.Default.RevisionVersion );

            DeviceDefineBuilderBase d = new XmlDeviceDefinePathBuild("xml");

            System.Data.DataTable tblStation = YeHeCommuniServerApp.Default.CSDBI.ExecuteStationDataTable();
            System.Data.DataTable tblDevice = YeHeCommuniServerApp.Default.CSDBI.ExecuteDeviceDataTable();
            HardwareBuilderBase h = new DBHardWareBuilder(tblStation, tblDevice);

            TaskFactoryCollectionBuilder t = new XmlTaskFactoryCollectionBuilder("xml\\task.xml");
            ListenBuilderBase l = new XmlListenBuilder("xml\\listenport.xml");

            // create communisoft
            //
            Hashtable settings = new Hashtable();
            settings.Add("TaskTimeout", Config.Default.TaskTimeout);
            //CommuniSoftFactory.get.Create(settings);

            CommuniSoftFactory.Init(h);
            YeHeCommuniServerApp.Default.CommuniSoft = CommuniSoft.Default;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMain());
            Config.Default.Save();

            object obj = XD221ModbusConfigObject.XD221ConfigDefineCollection;
        }
예제 #2
0
파일: Program.cs 프로젝트: hkiaipc/hunb
        static void Main()
        {
            // preinstance
            //
            if (Diagnostics.HasPreInstance())
            {
                NUnit.UiKit.UserMessage.Display(strings.AppRunning);
                return;
            }

            if (EnableExceptionHandle)
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(
                    Application_ThreadException);
            }

            InternalTrace.Initialize("CommuniServer_%p.log");

            //CSDBI csdbi = new CSDBI("Data Source=.;Initial Catalog=YeHeSLDB;Integrated Security=false;uid=sa;pwd=sa");
            CSDBI csdbi = new CSDBI(Config.Default.ConnectionString);
            YeHeCommuniServerApp.Default.CSDBI = csdbi;
            //csdbi.Open();

            //csdbi.VerifyDBInfo(Config.Default.ProjectName, Config.Default.MajorVersion,
            //    Config.Default.MinorVersion , Config.Default.RevisionVersion );

            //
            //DeviceDefineBuilderBase d = new XmlDeviceDefineBuild( "xml\\devicedefine.xml" );
            DeviceDefineBuilderBase d = new XmlDeviceDefinePathBuild("xml");
            //HardwareBuilderBase h = new XmlHardwareBuilder("xml\\hardware.xml");
            //HardwareBuilderBase h = new DBHardWareBuilder(stations);

            //System.Data.DataTable tbl = CommuniServerApp.Default.CSDBI.ExecuteStatinDeviceDataView();
            //HardwareBuilderBase h = new DBHardWareBuilder(tbl);
            System.Data.DataTable tblStation = YeHeCommuniServerApp.Default.CSDBI.ExecuteStationDataTable();
            System.Data.DataTable tblDevice = YeHeCommuniServerApp.Default.CSDBI.ExecuteDeviceDataTable();
            HardwareBuilderBase h = new DBHardWareBuilder(tblStation, tblDevice);

            TaskFactoryCollectionBuilder t = new XmlTaskFactoryCollectionBuilder("xml\\task.xml");
            ListenBuilderBase l = new XmlListenBuilder("xml\\listenport.xml");

            // create communisoft
            //
            Hashtable settings = new Hashtable();
            settings.Add("TaskTimeout", Config.Default.TaskTimeout);
            //CommuniSoftFactory.get.Create(settings);

            //
            //
            //try
            //{
            //    CommuniSoftBuilder b = new CommuniSoftBuilder(d, h, t, l);
            //    b.Build(CommuniSoft.Default);
            //}
            //catch (System.Exception ex)
            //{
                //ExceptionHandler.Handle(ex);
                //return;
            //}

            CommuniSoftFactory.Init(h);
            YeHeCommuniServerApp.Default.CommuniSoft = CommuniSoft.Default;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMain());
            Config.Default.Save();

            //object obj = XD221ModbusConfigObject.XD221ConfigDefineCollection;
        }