Beispiel #1
0
        private static void OnZeroNetEvent(object sender, ZeroNetEventArgument e)
        {
            switch (e.Event)
            {
            case ZeroNetEventType.AppRun:
                OnZeroNetRuning();
                break;

            case ZeroNetEventType.AppStop:
                OnZeroNetClose();
                break;

            case ZeroNetEventType.CenterStationJoin:
            case ZeroNetEventType.CenterStationResume:
            case ZeroNetEventType.CenterStationUpdate:
                StationJoin(e.EventConfig);
                break;

            case ZeroNetEventType.CenterStationLeft:
            case ZeroNetEventType.CenterStationPause:
            case ZeroNetEventType.CenterStationClosing:
            case ZeroNetEventType.CenterStationRemove:
                StationLeft(e.EventConfig);
                break;
            }
        }
Beispiel #2
0
        private void StationEvent(ZeroNetEventArgument e)
        {
            switch (e.Event)
            {
            case ZeroNetEventType.CenterStationJoin:
            case ZeroNetEventType.CenterStationLeft:
            case ZeroNetEventType.CenterStationPause:
            case ZeroNetEventType.CenterStationResume:
            case ZeroNetEventType.CenterStationClosing:
            case ZeroNetEventType.CenterStationInstall:
            case ZeroNetEventType.CenterStationUpdate:
            case ZeroNetEventType.CenterStationRemove:
                PublishConfig(e.EventConfig);
                return;

            case ZeroNetEventType.AppStop:
            case ZeroNetEventType.AppRun:
                NewBaseTime();
                ZeroApplication.Config.Foreach(cfg =>
                {
                    PublishConfig(cfg);
                    if (!KLines.ContainsKey(cfg.StationName))
                    {
                        KLines.Add(cfg.StationName, new List <KLine>());
                    }
                    var nLine = new KLine
                    {
                        Time = GetTime(BaseLine)
                    };
                    if (minuteLine.ContainsKey(cfg.StationName))
                    {
                        minuteLine[cfg.StationName] = nLine;
                    }
                    else
                    {
                        minuteLine.Add(cfg.StationName, nLine);
                    }
                });
                return;

            case ZeroNetEventType.AppEnd:
                File.WriteAllText(Path.Combine(ZeroApplication.Config.DataFolder, "kline_station.json"),
                                  JsonConvert.SerializeObject(KLines));
                return;

            case ZeroNetEventType.CenterStationState:
                if (e.EventConfig == null || e.Context == null)
                {
                    return;
                }
                Collect(e.EventConfig, e.Context);
                return;
            }
        }
Beispiel #3
0
        public static void OnZeroEvent(object sender, ZeroNetEventArgument e)
        {
            switch (e.Event)
            {
            case ZeroNetEventType.AppRun:
                ZeroTrace.SystemLog("RpcTest", "Test is start");
                var test = IocHelper.Create <Tester>();
                test.StartTest();
                break;

            case ZeroNetEventType.AppStop:
                ZeroTrace.SystemLog("RpcTest", "Test is stop");
                test = IocHelper.Create <Tester>();
                test.Cancel.Cancel();
                break;
            }
        }
Beispiel #4
0
        private static void OnZeroNetEvent(object sender, ZeroNetEventArgument e)
        {
            switch (e.Event)
            {
            case ZeroNetEventType.AppRun:
                OnZeroNetRuning();
                return;

            case ZeroNetEventType.AppStop:
                OnZeroNetClose();
                return;

            case ZeroNetEventType.CenterStationJoin:
            case ZeroNetEventType.CenterStationResume:
            case ZeroNetEventType.CenterStationUpdate:
            case ZeroNetEventType.CenterClientJoin:
                if (e.EventConfig.IsBaseStation)
                {
                    return;
                }
                StationJoin(e.EventConfig);
                break;

            case ZeroNetEventType.CenterStationLeft:
            case ZeroNetEventType.CenterStationPause:
            case ZeroNetEventType.CenterStationClosing:
            case ZeroNetEventType.CenterStationRemove:
            case ZeroNetEventType.CenterClientLeft:
                if (e.EventConfig.IsBaseStation)
                {
                    return;
                }
                StationLeft(e.EventConfig);
                break;
            }

            if ((DateTime.Now - preUpdate).TotalMinutes > 5)
            {
                OnZeroNetRuning();
            }
        }
Beispiel #5
0
 private void SystemMonitor_StationEvent(object sender, ZeroNetEventArgument e)
 {
     Task.Factory.StartNew(() => StationEvent(e));
 }