示例#1
0
        /// <summary>
        /// 初始化各个 Effect
        /// </summary>
        /// <param name="mqService"></param>
        public MqEffects(MqService mqService)
        {
            UnityIocService.AssertIsFirstInject(GetType());

            activeMq       = ActiveMqHelper.GetActiveMqService();
            Logger         = LoggerHelper.CreateLogger(GetType().ToString());
            this.mqService = mqService;
            initSchTaskEffect();
            initUploadCpmsEffect();
            initStartUploadCpmsIntervalEffect();
            initStartListenScanMaterial();
            initUploadAlarm();
            initUploadSchTaskManu();
            initStartListenEmpRfid();
            initStartListenAxisRfid();
            initUploadDpms();
            initCallSystem();
            initStartListenCmd();
            initUploadElecPower();
        }
示例#2
0
        /// <summary>
        /// LoggerHelper 和 Assets Helper 已经在 App.xaml.cs 中初始化了,所以这里不必要初始化了
        /// </summary>
        bool globalConfigLoad()
        {
            updateLoadingMessage("正在准备系统资源文件", 0.15);
            Thread.Sleep(CmdOptions.GlobalOptions.WaitSec * 1000);

            updateLoadingMessage("正在检查系统启动环境...", 0.17);
            if (processIsStarted())
            {
                var message = "系统重复启动异常";
                App.Store.Dispatch(new SysActions.SetLoadingMessage(message, 0.18));
                shutdownAppAfterSec(10, 0.18, "重复启动系统异常");
                return(false);
            }

            updateLoadingMessage("正在初始化异常配置...", 0.20);
            ExceptionHelper.Init();

            updateLoadingMessage("正在加载系统配置...", 0.23);
            GlobalConfig.Load(YUtil.GetAbsolutePath(".\\Profiles\\Global.xls"));

            updateLoadingMessage("正在初始化 ActiveMq...", 0.27);
            ActiveMqHelper.Init(HmiConfig.MqConn, HmiConfig.MqUserName, HmiConfig.MqUserPwd);

            updateLoadingMessage("正在初始化 MongoDb...", 0.30);
            MongoHelper.Init(HmiConfig.MongoConn);

            updateLoadingMessage("正在初始化 InfluxDb...", 0.33);
            InfluxDbHelper.Init($"http://{HmiConfig.InfluxDbIp}:8086", HmiConfig.InfluxCpmDbName);

            updateLoadingMessage("正在同步时间...", 0.35);
            syncTime(!HmiConfig.IsDevUserEnv);

            Logger.Debug("当前操作系统:" + YUtil.GetOsVersion());
            Logger.Debug("当前版本:" + YUtil.GetAppVersion(Assembly.GetExecutingAssembly()));
            Logger.Debug("是否为开发环境:" + HmiConfig.IsDevUserEnv);
            Logger.Debug("浮点精度:" + HmiConfig.MathRound);

            return(true);
        }
示例#3
0
 public static SimpleReducer <State> Create()
 {
     return(new SimpleReducer <State>(() => new State()
     {
         IsScreenLight = true, MarqueeMessagesDict = new SortedDictionary <string, string>(), LoadingWindow = new LoadingWindow()
         {
             Topmost = true, WindowStartupLocation = WindowStartupLocation.CenterOwner
         }
     })
            .When <SysActions.StartHttpSystemSuccess>((state, action) => {
         state.HttpSystemIsStarted = true;
         return state;
     }).When <SysActions.StartHttpSystemFailed>((state, action) => {
         state.HttpSystemIsStarted = false;
         return state;
     }).When <SysActions.StartHttpSystem>((state, action) => {
         state.HttpSystemIsStarted = false;
         return state;
     }).When <SysActions.OpenScreen>((state, action) => {
         YUtil.OpenScreen(AssetsHelper.GetAssets().ExeNirCmd);
         state.IsScreenLight = true;
         return state;
     }).When <SysActions.CloseScreen>((state, action) => {
         YUtil.CloseScreen(AssetsHelper.GetAssets().ExeNirCmd);
         state.IsScreenLight = false;
         return state;
     }).When <SysActions.StartCloseScreenTimer>((state, action) => {
         if (state.IsStartOpenScreenTimer)
         {
             throw new Exception("请勿重复启动息屏定时器");
         }
         state.IsStartOpenScreenTimer = true;
         return state;
     }).When <SysActions.StopCloseScreenTimer>((state, action) => {
         state.IsStartOpenScreenTimer = false;
         return state;
     }).When <SysActions.ShowNotification>((state, action) => {
         state.NotificationMsg = action.Message;
         return state;
     }).When <SysActions.ShutdownApp>((state, action) => {
         App.Shutdown();
         return state;
     }).When <SysActions.RestartApp>((state, action) => {
         ActiveMqHelper.GetActiveMqService().Close();
         App.Restart();
         return state;
     }).When <SysActions.HideDesktop>((state, action) => {
         YUtil.Exec(AssetsHelper.GetAssets().ExeNirCmd, "win hide class progman ");
         return state;
     }).When <SysActions.ShowDesktop>((state, action) => {
         YUtil.Exec(AssetsHelper.GetAssets().ExeNirCmd, "win show class progman ");
         return state;
     }).When <SysActions.ReturnDesktop>((state, action) => {
         //通过快捷键的方式来显示桌面
         //http://inputsimulator.codeplex.com/
         InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.VK_D);
         return state;
     }).When <SysActions.HideTaskBar>((state, action) => {
         YUtil.HideTaskBar();
         return state;
     }).When <SysActions.ShowTaskBar>((state, action) => {
         YUtil.ShowTaskBar();
         return state;
     }).When <SysActions.CloseLoadingSplash>((state, action) => {
         Application.Current.Dispatcher.Invoke(() => {
             try {
                 //DXSplashScreen.Close();
                 //state.LoadingWindow.Hide();
             } catch {
                 Console.WriteLine("隐藏加载框失败");
             }
         });
         return state;
     }).When <SysActions.ShowLoadingSplash>((state, action) => {
         Application.Current.Dispatcher.Invoke(() => {
             try {
                 //DXSplashScreen.Show<LoadingWindow>();
                 //state.LoadingWindow.Show();
             } catch {
                 Console.WriteLine(Resources.Show_Loading_View_Failed);
             }
         });
         return state;
     }));
 }