예제 #1
0
        private Scada(IHubConnectionContext <dynamic> clients)
        {
            try {
                Clients = clients;
                zenOn.Application zapp = null;
                Type acType            = Type.GetTypeFromProgID("zenOn.Application");
                zapp = (zenOn.Application)Activator.CreateInstance(acType, true);
                //zapp = (zenOn.Application)Marshal.GetActiveObject("zenOn.Application");
                //zapp = (zenOn.Application)Marshal.GetActiveObject
                proj = zapp.Projects().Item(0);

                //initialize network
                F.proj = proj;
                F.Generate();
                //F.InfoForQGIS();

                //here we initialize the vehicles
                V.InitializeVehicles();

                //initialize claims
                C.InitializeClaims();


                _timer        = new Timer(CheckVariables, null, _updateInterval, _updateInterval);
                _vehicletimer = new Timer(CheckVehicles, null, _updateIntervalVehicle, _updateIntervalVehicle);
                _claimtimer   = new Timer(CheckClaims, null, _updateIntervalClaim, _updateIntervalClaim);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message + ex.InnerException?.Message);
                return;
            }
        }
예제 #2
0
        public void Main(string[] args)
        {
            var         program  = new DebugZenonProgram();
            Application app      = new zenOn.Application();
            Projects    projects = app.Projects();

            program.app     = app;
            program.project = projects.Item(0);

            Console.WriteLine("Project: {0}", program.project.Name);
            program.extractVars();
            //program.dumpVariables();
            Console.WriteLine("Listening to updates");
            program.listenToVergaser();
            Console.ReadLine();
        }