Ejemplo n.º 1
0
 public void CloseScreen(object secObj)
 {
     if (secObj == null)
     {
         YUtil.CloseScreen(AssetsHelper.GetAssets().ExeNirCmd);
     }
     else
     {
         int sec = int.Parse(secObj.ToString());
         var ms  = sec * 1000;
         Task.Run(() => {
             YUtil.CloseScreen(AssetsHelper.GetAssets().ExeNirCmd);
             YUtil.SetTimeout(ms, () => {
                 YUtil.OpenScreen(AssetsHelper.GetAssets().ExeNirCmd);
             });
         });
     }
 }
Ejemplo n.º 2
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;
     }));
 }