Exemplo n.º 1
0
        public override void OnBackPressed()
        {
            SlidingDrawer menuSlider = FindViewById <SlidingDrawer>(Resource.Id.menuSlider);

            if (menuSlider.IsOpened)
            {
                menuSlider.AnimateClose();
            }
            else
            {
                base.OnBackPressed();
            }
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            /*PlotView view = FindViewById<PlotView>(Resource.Id.plot_view);
             *
             * GraphFactory<int> graphFactory = new GraphFactory<int>();
             * view.Model = graphFactory.createGraph(GraphType.Line, new GraphEffect(), new List<int>());*/
            SlidingDrawer menuSlider = FindViewById <SlidingDrawer>(Resource.Id.menuSlider);

            Button MenuButton1 = FindViewById <Button>(Resource.Id.MenuButton1);

            MenuButton1.Click += delegate {
                StartActivity(typeof(Question1));
                menuSlider.Close();
            };
        }
Exemplo n.º 3
0
        //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv全局参数声明vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv


        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);


            //保持屏幕常亮
            Window.AddFlags(WindowManagerFlags.KeepScreenOn);

            //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^控件实例化^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            // Get our UI controls from the loaded layout
            textView1    = FindViewById <TextView>(Resource.Id.textView1);
            textView2    = FindViewById <TextView>(Resource.Id.textView2);
            textView3    = FindViewById <TextView>(Resource.Id.textView3);
            textView4    = FindViewById <TextView>(Resource.Id.textView4);
            textView5    = FindViewById <TextView>(Resource.Id.textView5);
            textView_Ver = FindViewById <TextView>(Resource.Id.textView_Ver);
            //textView6 = FindViewById<TextView>(Resource.Id.textView6);
            IPText = FindViewById <EditText>(Resource.Id.IPText1);

            btnConnect = FindViewById <Button>(Resource.Id.Connect);
            Throttle   = FindViewById <Button>(Resource.Id.ThrottleButton);
            Brake      = FindViewById <Button>(Resource.Id.BrakeButton);
            btnSet     = FindViewById <Button>(Resource.Id.btnSet);
            btnReset   = FindViewById <Button>(Resource.Id.btnReset);
            btnSetSrd  = FindViewById <Button>(Resource.Id.btnSetSrd);
            btnSetSru  = FindViewById <Button>(Resource.Id.btnSetSru);


            btnGearUp         = FindViewById <Button>(Resource.Id.btnGearUp);
            btnGearDown       = FindViewById <Button>(Resource.Id.btnGearDown);
            btnClearAngle     = FindViewById <Button>(Resource.Id.btnClearAngle);
            SteerEnableSwitch = FindViewById <Switch>(Resource.Id.SteerEnableSwitch);

#pragma warning disable  CS0618 // Type or member is obsolete
            sldBrake    = FindViewById <SlidingDrawer>(Resource.Id.sldBrake);
            sldThrottle = FindViewById <SlidingDrawer>(Resource.Id.sldThrottle);
#pragma warning restore CS0618 // Type or member is obsolete
            cntBrake    = FindViewById <LinearLayout>(Resource.Id.cntBrake);
            cntThrottle = FindViewById <LinearLayout>(Resource.Id.cntThrottle);

            RunOnUiThread(() => textView1.Text = "");
            RunOnUiThread(() => textView2.Text = "");
            //RunOnUiThread(() => textView3.Text = "");
            RunOnUiThread(() => textView4.Text = "");
            RunOnUiThread(() => textView5.Text = "");

            btnGearDown.Text  = "<<<<<-DOWN-<<<<<";
            btnGearUp.Text    = ">>>>>- UP ->>>>>";
            textView_Ver.Text = PackageManager.GetPackageInfo(this.PackageName, 0).VersionName;
            //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv控件实例化vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv



            //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^事件接口设置^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            btnConnect.Click += delegate
            {
                ThreadPool.QueueUserWorkItem(o => BtnConnect_OnClick());
            };

            btnClearAngle.Click += delegate
            {
                ThreadPool.QueueUserWorkItem(o => BtnClearAngle_OnClick());
            };

            SteerEnableSwitch.Click += delegate
            {
                ThreadPool.QueueUserWorkItem(o => SteerEnableSwitch_OnClick());
            };

            //Sensor
            Accelerometer.ReadingChanged += Accelerometer_ReadingChanged;


            //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv事件接口设置vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv



            //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^其他事件委托^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

            //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv其他事件委托vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
        }