コード例 #1
0
        protected override void OnStart(string[] args)
        {
            Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
            Logger.Init();
            MonitorHistory.Init();
            Logger logger = new Logger("service");

            logger.Info("begin start", new object[0]);
            try
            {
                Config          = Config.Load("service.xml");
                Api             = new DnsPodApi(Config, Config.GetLocal());
                Ddns            = new DDns(Config.LastIp, Config.GetLocal());
                Ddns.IPChanged += Ddns_IPChangedNotified;
                Ddns.Start();

                Monitor = new HttpMonitor(Config);
                Monitor.StatusChanged += Monitor_StatusChanged;
                Monitor.Start();

                logger.Info("end start", new object[0]);
            }
            catch (Exception exception)
            {
                logger.Error("start error:{0}", new object[] { exception });
            }
        }
コード例 #2
0
ファイル: Service.cs プロジェクト: wpmyj/AndroidDemo
 public void InsertMonitorHistory(MonitorHistory model)
 {
     try
     {
         using (var context = new BJContext())
         {
             context.Insert <MonitorHistory>(model);
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
コード例 #3
0
        static void Main()
        {
            ControllerDataFile = Different.GetInfoTaskDir() + @"Controller\ControllerData.accdb";
            using (var sys = new SysTabl(ControllerDataFile))
            {
                MonitorHistory = new MonitorHistory
                {
                    Inf = sys.Value("MonitorHistoryProps")
                };
                CheckTime = sys.Value("MonitorHistoryCheckTime").ToDateTime();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(ThreadsForm = new ThreadsForm());
        }