static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            FrmApp pApp = new FrmApp();

            pApp.args = args;
            if (args.Length > 0)
            {
                string strFile = args[0];
                if (strFile.StartsWith("@"))
                {
                    strFile = Application.StartupPath + "\\JS\\" + strFile.Substring(1);
                }
                pApp.strFile = strFile;
                FrmApp.pTreapFrmApp.insert(strFile, pApp);
            }
            else
            {
                string strFile = Application.StartupPath + "/main.js";
                if (S_File.Exists(strFile))
                {
                    pApp.strFile = strFile;
                }
                FrmApp.pTreapFrmApp.insert(strFile, pApp);
            }
            Application.Run(pApp);
        }
Beispiel #2
0
        public void Run_Code(FrmApp pApp, string run_codestr1)
        {
            p_Engine = new Jint.Engine();


            //非静态变量
            p_Engine.SetValue("s_sys", pApp.pSYS);
            p_Engine.SetValue("s_ui", pApp.pUI);


            //静态变量,只有一个
            p_Engine.SetValue("s_tcp", FrmApp.pTCP);
            p_Engine.SetValue("s_index", FrmApp.pIndex);// new C_Index(pApp));

            //其他
            p_Engine.SetValue("s_math", new S_Math());
            p_Engine.SetValue("s_string", new C_String());
            p_Engine.SetValue("s_net", new C_Net(pApp));
            p_Engine.SetValue("s_time", pApp.pTime);
            p_Engine.SetValue("s_xml", new C_XML());
            p_Engine.SetValue("s_file", new C_File(pApp));
            p_Engine.SetValue("s_au3", new C_AU3(pApp));


            try
            {
                p_Engine.Execute(run_codestr1);
            }
            catch (Exception eee)
            {
                MessageBox.Show("error in script run:" + eee.Message + eee.StackTrace);
            }
        }
Beispiel #3
0
        public async Task Execute(IJobExecutionContext context)
        {
            JobDataMap dataMap = context.JobDetail.JobDataMap;
            string     file    = dataMap.GetString("file");


            pFrmApp = FrmApp.pTreapFrmApp.find(file);
            if (pFrmApp != null)
            {
                string function = pFrmApp.pSYS.value_read("event:time_event");

                if ("sys:check_connect".Equals(context.JobDetail.Key.Name))
                {
                    FrmApp.pTCP.check_connect();
                }
                else
                {
                    //"sys_event_alarm"
                    pFrmApp.JS_Function(function, context.JobDetail.Key.Name);
                }
            }
            await Console.Out.WriteLineAsync("Alarm_Job is executing.");
        }
 public C_File(FrmApp pFrmApp)
 {
     this.pFrmApp = pFrmApp;
 }
Beispiel #5
0
 public C_AU3(FrmApp pApp)
 {
     this.pFrmApp = pApp;
 }
 public C_Net(FrmApp FrmApp)
 {
     this.pFrmApp = FrmApp;
 }