Ejemplo n.º 1
0
        public void Reset()
        {
            int    a = 0;
            Action b = () =>
            {
                a = 2;
            };
            Action <object> ba = (o) =>
            {
                b();
            };

            var h = EventsBuiltin.RegisterEvent(EventID.TEST2);

            EventsBuiltin.RegisterListener(EventID.TEST2, ba);

            h.Notify();
            Thread.Sleep(10);

            Assert.IsTrue(pass);
            Assert.AreEqual(2, a);

            b = () =>
            {
                a = 4;
            };
            h.Notify();
            Thread.Sleep(10);
            Assert.AreEqual(4, a);
        }
Ejemplo n.º 2
0
        public MacrosView()
        {
            InitializeComponent();

            EventsBuiltin.RegisterListener <Recording>(EventID.REC,
                                                       (r) =>
            {
                this.Dispatcher.Invoke(() => { onRec(r); });
            });

            recLoaded = EventsBuiltin.RegisterEvent <Recording>(EventID.REC_LOADED);

            //test
            //model = new RecordingModel();
            //keyframesControl.DataContext = model;
            //var n1 = new OpenLinkedListNode<Recording.KeyFrame>(new Recording.KeyFrameK(KeyActions.PRESS, System.Windows.Forms.Keys.A, 1200));
            //var n2 = new OpenLinkedListNode<Recording.KeyFrame>(new Recording.KeyFrameK(KeyActions.PRESS, System.Windows.Forms.Keys.B, 1300));
            //n1.Next = n2;
            //var container = new RecordingModel.FocusContainer();
            //var t1 = new InfoTray(n1, null, focusedTray: container);
            //var t2 = new InfoTray(n2, t1.Model, focusedTray: container);
            //model.Keyframes.Add(t1);
            //model.Keyframes.Add(t2);

            //Recording rec = new Recording();
            ////rec.AddKeyFrame(new Recording.KeyFrameK(KeyActions.PRESS, System.Windows.Forms.Keys.A, 1200));
            ////rec.AddKeyFrame(new Recording.KeyFrameK(KeyActions.PRESS, System.Windows.Forms.Keys.B, 1300));
            //rec.AddKeyframe(MouseAction.WM_LBUTTONDOWN, 25, 1, 1200);
            //rec.AddKeyframe(MouseAction.WM_LBUTTONUP, 35, 2, 1300);
            //onRec(rec);
        }
Ejemplo n.º 3
0
            public InfoTrayM(Recording.Keyframe kf, RecordingModel.FocusContainer f) : base(kf, f)
            {
                kfM = (Recording.KeyframeM)kf;
                selectMouseLocationHandle = EventsBuiltin.RegisterEvent <Overlay.Callbacks>(EventID.SELECT_MOUSE_LOCATION);
                kfM.OnUpdateLoc((x, y) => { Model.Description = convertDesc(x, y); });
                kfM.OnUpdateMA((ma) => { Model.Info = convertInfo(ma); });

                int[] loc = kfM.GetLoc();
                Model.Description = convertDesc(loc[0], loc[1]);
                Model.Info        = convertInfo(kfM.GetMA());
            }
Ejemplo n.º 4
0
        public EventsTests()
        {
            setPass = (o) =>
            {
                pass = true;
            };
            handle = EventsBuiltin.RegisterEvent(EventID.TEST);
            EventsBuiltin.RegisterListener(EventID.TEST, setPass);
            handle.Notify();

            Thread.Sleep(10);
        }
Ejemplo n.º 5
0
        public RecordingManager()
        {
            hook.AddKeyHook(onKeyDown, onKeyUp);
            hook.AddMouseHook(onMouse);
            currState.Set(State.IDLE);

            rec = new Recording();

            newRecordingHandle = EventsBuiltin.RegisterEvent <Recording>(EventID.REC);
            newRecordingHandle.Notify(rec);

            showOverlayHandle = EventsBuiltin.RegisterEvent <MyColors>(EventID.BORDER_SHOW);
            hideOverlayHandle = EventsBuiltin.RegisterEvent(EventID.BORDER_HIDE);
            ExternalKeyMonitor.Monitor(Key.Escape, () => { rec?.Stop(); });

            EventsBuiltin.RegisterListener <Recording>(EventID.REC_LOADED, (r) =>
            {
                rec = r;
                //Console.WriteLine("here");
            });
        }
Ejemplo n.º 6
0
 public Robot() : base()
 {
     handle = EventsBuiltin.RegisterEvent <Key>(EventID.KEY_SENT);
 }