예제 #1
0
파일: Program.cs 프로젝트: viticm/pap2
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // 初始化环境变量
            EV ev = new EV();
            ev.AddToEnvironmentPath(Path.GetDirectoryName(Application.ExecutablePath));

            // 检查用户授权
            DBManager.DataBaseManager dataBaseManager = DBManager.DataBaseManager.GetDataBaseManager();
            Helper helper = Helper.GetHelper();
            string hostName = helper.GetHostName();
            List<string> addressList = helper.GetHostAddresses();
            bool valid = false;

            foreach (string s in addressList)
            {
                if (dataBaseManager.CheckAuthority(hostName, s))
                {
                    valid = true;
                    break;
                }
            }

            if (valid)
            {                
                Application.Run(new MainForm());
            }
            else
            {
                MessageBox.Show(string.Format("权限审核失败!\r\n\r\n用户名:{0}\r\nIP:{1}\r\n", hostName, addressList[0]), "授权检查",
                                              MessageBoxButtons.OK, MessageBoxIcon.Information);
            }            
        }
예제 #2
0
        public DataService()
        {
            EV ev1 = new EV();

            ev1.Id          = 1;
            ev1.Maker       = Maker.Tesla;
            ev1.Model       = "Model 3";
            ev1.BatterySize = 4000;
            lstEV.Add(ev1);

            EV ev2 = new EV();

            ev2.Id          = 2;
            ev2.Maker       = Maker.Nissan;
            ev2.Model       = "Leaf";
            ev2.BatterySize = 2500;
            lstEV.Add(ev2);

            EV ev3 = new EV();

            ev3.Id          = 3;
            ev3.Maker       = Maker.GM;
            ev3.Model       = "EV1";
            ev3.BatterySize = 3000;
            lstEV.Add(ev3);

            EV ev4 = new EV();

            ev4.Id          = 4;
            ev4.Maker       = Maker.Chevrolet;
            ev4.Model       = "Bolt";
            ev4.BatterySize = 2800;
            lstEV.Add(ev4);
        }
예제 #3
0
            /// <summary>
            /// Helper method for invoking kevent with a single argument
            /// </summary>
            /// <param name="kq">The kqueue descriptor.</param>
            /// <param name="handle">The handle to register</param>
            /// <param name="filter">The filter to use</param>
            /// <param name="flags">The flags to use</param>
            /// <param name="fflags">The fflags</param>
            /// <param name="data">The data to associate</param>
            /// <param name="udata">The udata to associate</param>
            /// <returns></returns>
            public static int kevent(int kq,IDENTTYPE handle,EVFILT filter,EV flags,NOTE fflags = 0,INTPTR data = default(INTPTR),INTPTR udata = default(INTPTR))
            {
                var kev = new [] {
                    new struct_kevent()
                    {
                        ident  = new INTPTR((long)handle),
                        filter = filter,
                        flags  = flags,
                        fflags = fflags,
                        data   = data,
                        udata  = udata
                    }
                };

                var timeout = new[] { new Timespec()
                                      {
                                          tv_sec = 10
                                      } };

                var ret = PInvoke.kevent(kq,kev,1,null,0,timeout);

                if (ret < 0)
                {
                    throw new IOException($"Failed to {flags} handle on kqueue: {Stdlib.GetLastError()}");
                }
                if (kev[0].flags.HasFlag(EV.ERROR))
                {
                    throw new IOException($"Failed to {flags} handle on kqueue: {kev[0].data}");
                }

                return(ret);
            }
예제 #4
0
        public void TestCase()
        {
            var injector = new Injector();

            injector.Register(Binding.For <C> ());

            var c = injector.Resolve <C>();

            var expr    = injector.ResolveResolverExpression(BindingKey.Get <C>());
            var visitor = new EV();

            visitor.Visit(expr);
        }
예제 #5
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Splash Screen init
            SplashScreen.ShowSplashScreen();
            Application.DoEvents();

            SplashScreen.SetStatus("Setting Up Application Path ...");
            EV.SetFindPath(Path.GetDirectoryName(Application.ExecutablePath));

            SplashScreen.SetStatus("Registering COM dll ...");
            bool bSucReg = EV.RegComDll("AtlKG3DEngineProxy.dll");

            if (!bSucReg)
            {
                MessageBox.Show("COM注册失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            SplashScreen.SetStatus("Checking Application Instancing ...");
            if (Helper.ProgramAlreadyRunning())
            {
                MessageBox.Show("此工具不能双开。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            SplashScreen.SetStatus("Initing Editor Config ...");
            EditorLayer.Init();
            SplashScreen.SetStatus("Starting KG3DEngine ...");
            EngineLayer.Init();
            SplashScreen.SetStatus("Loading JX3 Logics ...");
            LogicsLayer.Init();

            // close Splash Screen
            SplashScreen.CheckForIllegalCrossThreadCalls = false;
            if (SplashScreen.SplashForm != null)
            {
                SplashScreen.SplashForm.Owner = EditorLayer.MainFrm;
            }
            SplashScreen.CloseForm();


            EditorLayer.Run();


            LogicsLayer.Uninit();
            EngineLayer.Uninit();
            EditorLayer.Uninit();
        }
예제 #6
0
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            // official trading hours in the US is from 9.30am to 4.00pm
            // 390 minutes == 390 bars, outside pre-market and after-hours

            double high = High[0] > Close[1] ? High[0] : Close[1];
            double low  = Low[0] < Close[1] ? Low[0] : Close[1];
            double PI   = 0.01;

            double closeDiff = Close[1] - Close[0] + PI;
            double spread    = high - low + PI;

            double effectiveVol = closeDiff / spread * Volume[0];

            myDataSeries.Set(effectiveVol + myDataSeries[1]);
            EV.Set(myDataSeries[0]);
        }
예제 #7
0
 public ActionResult Event(EV obj)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.EV.Add(obj);
             db.SaveChanges();
             ModelState.Clear();
             return(View());
         }
         return(View(obj));
     }
     catch (Exception ex)
     {
         return(View(obj));
     }
 }
예제 #8
0
        /// <summary>
        /// config the snapshot
        /// </summary>
        /// <param name="wb">WhiteBalance</param>
        /// <param name="ev">explosure value</param>
        /// <param name="contrast">Contrast</param>
        /// <param name="ce">ColorEffect</param>
        /// <param name="sharp">Sharpness</param>
        /// <returns>True if succeed</returns>
        public bool ConfigSnapshot(WhiteBalance wb, EV ev, Contrast contrast, ColorEffect ce, Sharpness sharp)
        {
            byte[] writeBuffer = new byte[5];

            writeBuffer[0] = (byte)wb;
            writeBuffer[1] = (byte)ev;
            writeBuffer[2] = (byte)contrast;
            writeBuffer[3] = (byte)ce;
            writeBuffer[4] = (byte)sharp;

            CreatCommand(5, CMD_SNAPSHOT_CONFIG);
            CreatCommand(writeBuffer);

            SendCommand(id_cmd);
            SendCommand(para_cmd);

            if (!ReceiveACK(CMD_SNAPSHOT_CONFIG, 100))
            {
                return(false);
            }

            return(true);
        }
예제 #9
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // 初始化环境变量
            EV ev = new EV();

            ev.AddToEnvironmentPath(Path.GetDirectoryName(Application.ExecutablePath));

            // 检查用户授权
            DBManager.DataBaseManager dataBaseManager = DBManager.DataBaseManager.GetDataBaseManager();
            Helper        helper      = Helper.GetHelper();
            string        hostName    = helper.GetHostName();
            List <string> addressList = helper.GetHostAddresses();
            bool          valid       = false;

            foreach (string s in addressList)
            {
                if (dataBaseManager.CheckAuthority(hostName, s))
                {
                    valid = true;
                    break;
                }
            }

            if (valid)
            {
                Application.Run(new MainForm());
            }
            else
            {
                MessageBox.Show(string.Format("权限审核失败!\r\n\r\n用户名:{0}\r\nIP:{1}\r\n", hostName, addressList[0]), "授权检查",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #10
0
 public static void SetEV(Device devnum, EV value)
 {
     throw new NotImplementedException("なにこれ");
 }