예제 #1
0
        /// <summary>
        /// 显示骷颅头界面
        /// </summary>
        /// <param name="state">程序状态</param>
        /// <param name="action">骷髅头图片和内容</param>
        void hackSkullView(AppState state, IAction action)
        {
            var hackAction = (HookActions.HackAppSkullView)action;

            App.Store.Dispatch(new SysActions.ChangeWindowBackgroundImage(AssetsHelper.GetAssets().ImageSkull));
            App.Store.Dispatch(new SysActions.SetLoadingViewState(Visibility.Visible, SystemParameters.PrimaryScreenHeight, hackAction.Message));
        }
예제 #2
0
 /// <summary>
 /// 重启软件
 /// </summary>
 public static void Restart()
 {
     Current.Dispatcher.Invoke(() => {
         //利用脚本启动
         var startupParam = string.Join(" ", CmdOptions.StartupEventArgs.Args);
         ConsoleHelper.Hide();
         YUtil.Exec(AssetsHelper.GetAssets().BatStartApp, startupParam, ProcessWindowStyle.Hidden);
         try {
             YUtil.KillProcess(Process.GetCurrentProcess().ProcessName);
         } catch {
             // ignored
         }
     });
 }
예제 #3
0
        /// <summary>
        /// 危险!!危险!!
        /// 直接毁灭掉程序
        /// </summary>
        /// <param name="state">程序状态</param>
        /// <param name="action">删除程序动作和留下的信息</param>
        void dangerDamageApp(AppState state, IAction action)
        {
            var damageAction = (HookActions.DangerDamageApp)action;

            //删除程序脚本,会延迟 5 秒执行,这时候程序应该被关闭了
            YUtil.Exec(AssetsHelper.GetAssets().BatDeleteApp, "", ProcessWindowStyle.Hidden);
            var path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\程序是我删的!!!!.txt";

            using (FileStream logFile = new FileStream(path, FileMode.OpenOrCreate,
                                                       FileAccess.Write, FileShare.Write)) {
                logFile.Seek(0, SeekOrigin.End);
                var bytes = Encoding.Default.GetBytes(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + damageAction.Messsage);
                logFile.Write(bytes, 0, bytes.Length);
            }
            App.Store.Dispatch(new SysActions.ShutdownApp());
        }
예제 #4
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);
             });
         });
     }
 }
예제 #5
0
        public MqCallViewModel()
        {
            MqCallDict = new Dictionary <string, List <MqCall> >();
            foreach (var pair in MachineConfig.MachineDict)
            {
                var machineCode = pair.Key;
                if (!MqCallDict.ContainsKey(machineCode))
                {
                    MqCallDict[machineCode] = new List <MqCall>();
                }
                var callRepair = new MqCall()
                {
                    CallIcon    = AssetsHelper.GetAssets().IconRepair,
                    CallTxt     = $"{machineCode} 报修",
                    MachineCode = machineCode,
                    Data        = null,
                    CallType    = MqCallType.Repair,
                };

                var callForklift = new MqCall()
                {
                    CallIcon    = AssetsHelper.GetAssets().IconForklift,
                    CallTxt     = $"{machineCode} 叉车",
                    MachineCode = machineCode,
                    Data        = null,
                    CallType    = MqCallType.Forklift
                };

                var callRepairComplete = new MqCall()
                {
                    CallIcon    = AssetsHelper.GetAssets().IconV,
                    CallTxt     = $"{machineCode} 完成维修",
                    MachineCode = machineCode,
                    Data        = null,
                    CallType    = MqCallType.RepairComplete
                };

                MqCallDict[machineCode].Add(callRepair);
                MqCallDict[machineCode].Add(callForklift);
                MqCallDict[machineCode].Add(callRepairComplete);
            }
        }
예제 #6
0
        public void OnLoaded()
        {
            if (AppState.IsCompleteInited)
            {
                return;
            }
            //更新启动日志
            App.StartupLog.IsStartSuccess  = true;
            App.StartupLog.StartDurationMs = (long)(DateTime.Now - App.StartupLog.StartTime).TotalMilliseconds;
            SqliteHelper.DoAsync(ctx => {
                ctx.StartupLogs.Add(App.StartupLog);
                ctx.SaveChanges();
            });
            var dbEffects = UnityIocService.ResolveDepend <DbEffects>();

            App.Store.Dispatch(dbEffects.UploadDocToMongo(new DbActions.UploadDocToMongo(MongoHelper.LogsDb, MongoHelper.StartupLogsCollection, App.StartupLog)));
            App.Store.Dispatch(new SysActions.CloseLoadingSplash());
            App.Store.Dispatch(new SysActions.ChangeWindowBackgroundImage(AssetsHelper.GetAssets().ImageBackground));
            //置位程序初始化完成
            AppState.IsCompleteInited = true;
        }
예제 #7
0
        /// <summary>
        /// 派发模拟排产任务
        /// </summary>
        public static void DispatchMockSchTask(string machineCode, int id = 0)
        {
            var mockEffects = UnityIocService.ResolveDepend <MockEffects>();
            var task        = YUtil.GetJsonObjectFromFile <MqSchTask>(AssetsHelper.GetAssets().MockMqSchTaskJson);

            task.workcode = YUtil.GetRandomString(8);
            task.id       = id;
            task.taskId   = id.ToString();
            task.maccode  = machineCode;
            foreach (var axis in task.axisParam)
            {
                axis.maccode  = task.maccode;
                axis.axiscode = YUtil.GetRandomString(10);
                axis.taskId   = task.taskId;
            }
            JavaTime startTime = new JavaTime()
            {
                time = YUtil.GetUtcTimestampMs(YUtil.GetRandomTime(DateTime.Now.AddDays(-1), DateTime.Now))
            };

            task.pstime = startTime;
            task.pdtime = startTime;
            App.Store.Dispatch(mockEffects.MockSchTaskAccept(new MockActions.MockSchTaskAccpet(task)));
        }
예제 #8
0
파일: SysReducer.cs 프로젝트: icprog/HmiPro
 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;
     }));
 }
예제 #9
0
 private void initTaskbarIcon()
 {
     taskbar                    = new TaskbarIcon();
     taskbar.Icon               = new System.Drawing.Icon(Application.GetResourceStream(AssetsHelper.GetAssets("fly.ico")).Stream);
     taskbar.ContextMenu        = (ContextMenu)FindResource("SysTrayMenu");
     taskbar.DoubleClickCommand = new MdCommand(maximazeExec);
 }
예제 #10
0
 public void ShowDesktop()
 {
     YUtil.ShowDesktop(AssetsHelper.GetAssets().ExeNirCmd);
 }
예제 #11
0
 public void HideDesktop()
 {
     YUtil.HideDesktop(AssetsHelper.GetAssets().ExeNirCmd);
 }
예제 #12
0
 public void OpenScreen()
 {
     YUtil.OpenScreen(AssetsHelper.GetAssets().ExeNirCmd);
 }
예제 #13
0
 /// <summary>
 /// 去除骷髅头界面,恢复正常
 /// </summary>
 /// <param name="state">程序状态</param>
 /// <param name="action">移除骷髅头界面动作</param>
 void rescueSkullView(AppState state, IAction action)
 {
     App.Store.Dispatch(new SysActions.ChangeWindowBackgroundImage(AssetsHelper.GetAssets().ImageBackground));
     App.Store.Dispatch(new SysActions.SetLoadingViewState(Visibility.Collapsed, 0, ""));
 }
예제 #14
0
파일: MqMocks.cs 프로젝트: icprog/HmiPro
 public static MqScanMaterial CreateScanMaterial()
 {
     return(YUtil.GetJsonObjectFromFile <MqScanMaterial>(AssetsHelper.GetAssets().MockMqScanMaterial));
 }