Ejemplo n.º 1
0
        public MainWindow(string[] strArgs)
        {
            InitializeComponent();
            //-----参数的处理-----
            var compareKey = string.Empty;

            foreach (var strArg in strArgs)
            {
                compareKey = "-Mouse=";
                if (strArg.StartsWith(compareKey))
                {
                    //指定Mouse历史文件路径
                    var fileName = strArg.Remove(0, compareKey.Length);
                    var mouseHis = CustomEventLogger.GetHookMouseEventArgses(fileName);
                    MouseHisDataList = new ObservableCollection <HookMouseEventArgs>(mouseHis);
                }
                else
                {
                    compareKey = "-Key=";
                    if (strArg.StartsWith(compareKey))
                    {
                        //指定Key历史文件路径
                        var fileName = strArg.Remove(0, compareKey.Length);
                        var keyHis   = CustomEventLogger.GetHookKeyEventArgses(fileName);
                        KeyHisDataList = new ObservableCollection <HookKeyEventArgs>(keyHis);
                    }
                    else
                    {
                        //设定关键词
                        var keyValueIndex = strArg.IndexOf('=');                    //获取关键词分隔符
                        var key           = strArg.Substring(1, keyValueIndex - 1); //取得关键词
                        var value         = strArg.Substring(keyValueIndex + 1);    //取得替换值
                        foreach (var hookKeyEventArgse in KeyHisDataList)
                        {
                            if (hookKeyEventArgse.InputString == key)
                            {
                                hookKeyEventArgse.InputString = value;
                            }
                        }
                    }
                }
            }
            //-----直接执行-----
            argAction = () =>
            {
                ManagedTask.FactoryStart(() =>
                {
                    SimulateAll();
                    UIThread.Invoke(Close);//执行完关闭
                });
            };
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 执行模拟操作
 /// </summary>
 private void ExcuteSimulateAll()
 {
     ManagedTask.FactoryStart(() =>
     {
         UIThread.Invoke(() => { StatusTip = "开始执行!"; });
         if (IsRepeat)
         {
             while (IsRepeat && RepeatTimes > 0)
             {
                 SimulateAll();
                 UIThread.Invoke(() =>
                 {
                     RepeatTimes--;
                 });
             }
         }
         else
         {
             SimulateAll();
         }
         UIThread.Invoke(() => { StatusTip = "执行完毕!"; });
     });
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 模拟鼠标
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MouseSimulateMenuItem_OnClick(object sender, RoutedEventArgs e)
 {
     ManagedTask.FactoryStart(SimulateMouseBehavior);
 }