public static Singleton GetInstance() { lock (singletonLock) { if (me == null) { me = new Singleton(); } return me; } }
public void ProcesarEventoJoy(Singleton.EventosJoy evento) { Joystick_WMM.JOYINFOEX joyinfo; switch (evento) { case Singleton.EventosJoy.None: // break; case Singleton.EventosJoy.AutoPltON: // modem_autopilot = WflyUplink.Autopilot.Autopilot; break; case Singleton.EventosJoy.AutoPilotOFF: // modem_autopilot = WflyUplink.Autopilot.Manual; break; case Singleton.EventosJoy.AutoPltCo: modem_autopilot = WflyUplink.Autopilot.Copilot; break; case Singleton.EventosJoy.AutoPilotSWnext: // modem_autopilot = (WflyUplink.Autopilot)(((int)modem_autopilot + 1) % 3); break; case Singleton.EventosJoy.AutoPilotSWprev: if ((int)modem_autopilot == 0) modem_autopilot = (WflyUplink.Autopilot) 2; else modem_autopilot = (WflyUplink.Autopilot)((int)modem_autopilot - 1); break; case Singleton.EventosJoy.CamA: // modem_cam = false; break; case Singleton.EventosJoy.CamB: // modem_cam = true; break; case Singleton.EventosJoy.CamSW: // modem_cam = !modem_cam; break; case Singleton.EventosJoy.HudCL: // modem_hud = 0; break; case Singleton.EventosJoy.Hud1: // modem_hud = 1; break; case Singleton.EventosJoy.Hud2: // modem_hud = 2; break; case Singleton.EventosJoy.Hud3: // modem_hud = 3; break; case Singleton.EventosJoy.HudSWnext: // modem_hud = (modem_hud + 1) % 4; break; case Singleton.EventosJoy.HudSWprev: if (modem_hud == 0) modem_hud = 3; else modem_hud = modem_hud - 1; break; case Singleton.EventosJoy.GoHome: // modem_ruta = WflyUplink.Ruta.Casa; break; case Singleton.EventosJoy.GoWptRuta: // modem_ruta = WflyUplink.Ruta.Ruta; break; case Singleton.EventosJoy.GoUplink: // modem_ruta = WflyUplink.Ruta.Modem; break; case Singleton.EventosJoy.GoHold: modem_ruta = WflyUplink.Ruta.Hold; break; case Singleton.EventosJoy.GoSWnext: // modem_ruta = (WflyUplink.Ruta)(((int)modem_ruta + 1) % 4); break; case Singleton.EventosJoy.GoSWprev: // if ((int)modem_ruta == 0) modem_ruta = (WflyUplink.Ruta)3; else modem_ruta = (WflyUplink.Ruta)((int)modem_ruta - 1); break; case Singleton.EventosJoy.PanTiltCenter: pan = 0; tilt = 0; break; case Singleton.EventosJoy.FlapsOff: flaps = 0; break; case Singleton.EventosJoy.FlapsFull: flaps = singleton.full_flap; break; case Singleton.EventosJoy.FlapsInc: flaps += singleton.step_flap * singleton.full_flap; if (flaps > singleton.full_flap) flaps = singleton.full_flap; break; case Singleton.EventosJoy.FlapsDec: flaps -= singleton.step_flap * singleton.full_flap; if (flaps < 0) flaps = 0; break; case Singleton.EventosJoy.TrimAil: joyinfo = Joystick_WMM.getJoyPosEx((uint)0); TrimAil = -AdjustaValor((2 * (joyinfo.dwXpos / 65535.0f) - 1), TrimAil); break; case Singleton.EventosJoy.TrimEle: joyinfo = Joystick_WMM.getJoyPosEx((uint)0); TrimEle = -AdjustaValor((2 * (joyinfo.dwYpos / 65535.0f) - 1), TrimEle); break; case Singleton.EventosJoy.TrimTail: joyinfo = Joystick_WMM.getJoyPosEx((uint)0); TrimTail = -AdjustaValor((2 * (joyinfo.dwRpos / 65535.0f) - 1), TrimTail); break; case Singleton.EventosJoy.TrimAll: joyinfo = Joystick_WMM.getJoyPosEx((uint)0); TrimEle = -AdjustaValor((2 * (joyinfo.dwYpos / 65535.0f) - 1), TrimEle); TrimAil = -AdjustaValor((2 * (joyinfo.dwXpos / 65535.0f) - 1), TrimAil); TrimTail = -AdjustaValor((2 * (joyinfo.dwRpos / 65535.0f) - 1), TrimTail); break; case Singleton.EventosJoy.Picture: formIkarusMain.Capturar_Foto(); break; default: break; } }