Esempio n. 1
0
        public void soft()
        {
            //CommuniSoft s = new CommuniSoft();

            DeviceDefineBuilderBase d = new XmlDeviceDefineBuild( "xml\\devicedefine.xml" );
            HardwareBuilderBase h = new XmlHardwareBuilder("xml\\hardware.xml");
            TaskFactoryCollectionBuilder t = new XmlTaskFactoryCollectionBuilder("xml\\task.xml");
            ListenBuilderBase l = new XmlListenBuilder("xml\\listenport.xml");

            CommuniSoftBuilder b = new CommuniSoftBuilder(d, h, t, l);
            b.Build( CommuniSoft.Default);

            CommuniSoft soft = CommuniSoft.Default;

            //Opera op = soft.OperaFactory.Create("vdevicetype", "operaname");
            //Assert.IsNotNull(op);
            //Assert.AreEqual("operaname", op.Name);
            //Assert.AreEqual(1, op.SendPart.DataFieldManager.DataFields.Count);

            //Assert.AreEqual(1, soft.HardwareManager.Stations.Count);
            //Assert.AreEqual(1, soft.HardwareManager.Stations[0].Devices.Count);
            //Assert.AreEqual(100, soft.HardwareManager.Stations[0].Devices[0].Address);
            ////Assert.AreEqual("vdevicetype", soft.HardwareManager.Stations[0].Devices[0].DeviceType);

            //Assert.AreEqual(1, soft.TaskManager.Tasks.Count);
        }
Esempio n. 2
0
        public UITestLogic()
        {
            DeviceDefineBuilderBase d = new XmlDeviceDefineBuild( "xml\\devicedefine.xml" );
            HardwareBuilderBase h = new XmlHardwareBuilder("xml\\hardware.xml");
            TaskFactoryCollectionBuilder t = new XmlTaskFactoryCollectionBuilder("xml\\task.xml");
            ListenBuilderBase l = new XmlListenBuilder("xml\\listenport.xml");

            CommuniSoftBuilder b = new CommuniSoftBuilder(d, h, t, l);
            //Soft = b.Build();
            b.Build(CommuniSoft.Default);
            Soft = CommuniSoft.Default;
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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;
        }