protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ControllerSettings); m_RgControlMethod = FindViewById <RadioGroup>(Resource.Id.rgControlMethod); m_RbThrottleLeft = FindViewById <RadioButton>(Resource.Id.rbThrottleLeft); m_RbThrottleRight = FindViewById <RadioButton>(Resource.Id.rbThrottleRight); m_TvDescription = FindViewById <TextView>(Resource.Id.tvDescription); m_BtStart = FindViewById <Button>(Resource.Id.btStart); m_BtShowLog = FindViewById <Button>(Resource.Id.btShowLog); m_SbYawTrim = FindViewById <SeekBar>(Resource.Id.sbYawTrim); m_SbPitchTrim = FindViewById <SeekBar>(Resource.Id.sbPitchTrim); m_SbRollTrim = FindViewById <SeekBar>(Resource.Id.sbRollTrim); m_TvYawTrim = FindViewById <TextView>(Resource.Id.tvYawTrim); m_TvYawTrim.Text = "Yaw Trim ( " + ((m_SbYawTrim.Progress * 2 / 10f) - 10) + " )"; m_TvPitchTrim = FindViewById <TextView>(Resource.Id.tvPitchTrim); m_TvPitchTrim.Text = "Pitch Trim ( " + ((m_SbPitchTrim.Progress * 2 / 10f) - 10) + " )"; m_TvRollTrim = FindViewById <TextView>(Resource.Id.TvRollTrim); m_TvRollTrim.Text = "Roll Trim ( " + ((m_SbRollTrim.Progress * 2 / 10f) - 10) + " )"; m_Settings = new ControllerSettings(); m_SbYawTrim.ProgressChanged += (sender, e) => { m_TvYawTrim.Text = "Yaw Trim ( " + ((m_SbYawTrim.Progress * 2 / 10f) - 10) + " )"; m_Settings.TrimYaw = (int)(m_SbYawTrim.Progress * 2 / 10f) - 10; }; m_SbPitchTrim.ProgressChanged += (sender, e) => { m_TvPitchTrim.Text = "Pitch Trim ( " + ((m_SbPitchTrim.Progress * 2 / 10f) - 10) + " )"; m_Settings.TrimPitch = (int)(m_SbPitchTrim.Progress * 2 / 10f) - 10; }; m_SbRollTrim.ProgressChanged += (sender, e) => { m_TvRollTrim.Text = "Roll Trim ( " + ((m_SbRollTrim.Progress * 2 / 10f) - 10) + " )"; m_Settings.TrimRoll = (int)(m_SbRollTrim.Progress * 2 / 10f) - 10; }; m_RbThrottleLeft.Click += OnThrottleLeftClick; m_RbThrottleRight.Click += OnThrottleRightClick; m_BtStart.SetBackgroundColor(Android.Graphics.Color.DeepSkyBlue); m_BtStart.SetTextColor(Android.Graphics.Color.White); m_BtShowLog.SetBackgroundColor(Android.Graphics.Color.DeepSkyBlue); m_BtShowLog.SetTextColor(Android.Graphics.Color.White); m_BtStart.Click += OnStartController; //m_Filter = new IntentFilter(); // m_Receiver = new CallReciver(); // m_Filter.AddAction("android.intent.action.PHONE_STATE"); // m_Filter.AddAction("INCOMING_CALL"); // m_Filter.AddAction(SipSession.State.IncomingCall.ToString()); // Registering events and forwarding them to the broadcast object // RegisterReceiver(m_Receiver, m_Filter); }
public ControllerView(Context context, ControllerSettings settings) : base(context) { m_Settings = settings; SetOnTouchListener(this); SetBackgroundColor(Color.White); ScreenWidth = Resources.DisplayMetrics.WidthPixels; ScreenHeight = Resources.DisplayMetrics.HeightPixels; //m_Transfer = new BluetoothController.DataTransfer (this); InitShapes(); InitJoysticks(); m_WriteTimer = new System.Timers.Timer(); m_WriteTimer.Interval = 50; //10 m_WriteTimer.AutoReset = true; //m_WriteTimer.Elapsed += Write; //m_WriteTimer.Start(); }