/// <summary> /// 构造函数 /// </summary> /// <param name="controller">通讯 IO 控制器。</param> /// <param name="boardNo"></param> /// <param name="portNo"></param> /// <param name="ioMode">通讯模式<see cref="IoModes" /></param> public IoPoint(ISwitchController controller, int boardNo, int portNo, IoModes ioMode) { Controller = controller; BoardNo = boardNo; PortNo = portNo; IoMode = ioMode; }
public SwitchEventsProcessor(ISwitchController switchController, IEventSource source, ILogger log) { Guard.DebugAssertArgumentNotNull(switchController, nameof(switchController)); Guard.DebugAssertArgumentNotNull(source, nameof(source)); _switchController = switchController; _source = source; _log = log; }
public static void PressAndRelease(this ISwitchController controller, ButtonType button, int duration, int wait = 0) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } controller.PressButton(button); Thread.Sleep(duration); controller.ReleaseButton(button); Thread.Sleep(wait); }
public static void MoveAndRelease(this ISwitchController controller, StickType stick, byte x, byte y, int duration, int wait = 0) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } controller.MoveStick(stick, x, y); Thread.Sleep(duration); controller.ReleaseStick(stick); Thread.Sleep(wait); }
public static void PressAndRelease(this ISwitchController controller, DPadCommand dPad, int duration, int wait = 0) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } controller.PressDPad(dPad); Thread.Sleep(duration); controller.ReleaseDPad(); Thread.Sleep(wait); }
public MacroPool(ISwitchClock clock, ISwitchController controller, ICancellationRequest cancelRequest, IGameCapture gameCapture) { var param = new MacroParameter() { Clock = clock, Controller = controller, CancellationRequest = cancelRequest, GameCapture = gameCapture, }; Add <DrawLotoIdMacro>(param); Add <BattleMaxRaidMacro>(param); Add <GainWattsMacro>(param); //Add<SeekPokemonMacro>(param); Add <RapidTimeTravelMacro>(param); Add <ThreeDaysTravelMacro>(param); Add <MashAButtonMacro>(param); }
public ControllerPanelViewModel(ISwitchController controller, ISerialPortService serialPort, IWorkSituation work) { m_switchController = controller; IsConnected = serialPort.ObserveProperty(p => p.IsOpen).ToReactiveProperty().AddTo(Disposables); IsBusy = work.ObserveProperty(w => w.IsBusy).ToReactiveProperty().AddTo(Disposables); PushButtonCommand = new[] { IsConnected, IsBusy }.CombineLatest(x => x[0] && !x[1]).ToReactiveCommand <ButtonType?>().AddTo(Disposables); PushButtonCommand.Subscribe(PushButton).AddTo(Disposables); PushDPadCommand = new[] { IsConnected, IsBusy }.CombineLatest(x => x[0] && !x[1]).ToReactiveCommand <DPadCommand?>().AddTo(Disposables); PushDPadCommand.Subscribe(PushDPad).AddTo(Disposables); MoveStickCommand = new[] { IsConnected, IsBusy }.CombineLatest(x => x[0] && !x[1]).ToReactiveCommand <StickParameter>().AddTo(Disposables); MoveStickCommand.Subscribe(MoveStick).AddTo(Disposables); }
public static ISwitchController Open(int deviceNo) { if (instance == null) { if (!GUI.Program.Debug) { IntPtr handle = AC6651.OpenDevice(deviceNo); if (handle == AC6651.InvalidHandle) { throw Helper.NewCustomException("³õʼ»¯AC6651´íÎó"); } SwitchController c = new SwitchController(deviceNo); c.Handle = handle; instance = c; } else { instance = new SwitchControllStub(); } } return(instance); }
public static ISwitchController Open(int deviceNo) { if (instance == null) { if (!GUI.Program.Debug) { IntPtr handle = AC6651.OpenDevice(deviceNo); if (handle == AC6651.InvalidHandle) { throw Helper.NewCustomException("��ʼ��AC6651����"); } SwitchController c = new SwitchController(deviceNo); c.Handle = handle; instance = c; } else { instance = new SwitchControllStub(); } } return instance; }