예제 #1
0
파일: MainActivity.cs 프로젝트: UMI64/-LED-
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            CircleBarView = FindViewById <CircleBarView>(Resource.Id.circle_view);
            HumantextView = FindViewById <TextView>(Resource.Id.HumantextView);
            PWMText       = FindViewById <TextView>(Resource.Id.PWMText);
            LEDButton     = FindViewById <ImageButton>(Resource.Id.LEDButton);
            SetLEDButton(false);
            TextView ScanedDevice = FindViewById <TextView>(Resource.Id.ScanedDevice);

            deviceManager    = new DeviceManager(this, ScanedDevice);
            LEDButton.Click += (object sender, EventArgs e) =>
            {
                CircleBarView.SetProgressNum(1000, 47);//设置动画时间为3000毫秒,即3秒
                ScanedDevice.Text += "正在搜索设备";
                deviceManager.ScanDevice();
            };
            LXTextView = FindViewById <TextView>(Resource.Id.LXTextView);
            Button JoinWifiButton = FindViewById <Button>(Resource.Id.JoinWifiButton);

            JoinWifiButton.Click += (object sender, EventArgs e) =>
            {
                Android.Support.V7.App.AlertDialog.Builder customizeDialog = new Android.Support.V7.App.AlertDialog.Builder(this);
                View     dialogView       = LayoutInflater.From(this).Inflate(Resource.Layout.JoinWIFI, null);
                EditText WIFIPWDEditText  = dialogView.FindViewById <EditText>(Resource.Id.WIFIPWDEditText);
                EditText WIFINameEditText = dialogView.FindViewById <EditText>(Resource.Id.WIFINameEditText);
                TextView StateTextView    = dialogView.FindViewById <TextView>(Resource.Id.StateTextView);
                dialogView.FindViewById <Button>(Resource.Id.OkButton).Click += (object bsender, EventArgs be) =>
                {
                    JoinWIFI joinWIFI = new JoinWIFI();
                    if (joinWIFI.DeviceJoinWIFI(WIFINameEditText.Text, WIFIPWDEditText.Text))
                    {//成功继续监听
                        if (joinWIFI.WaitingConnectResout() == false)
                        {
                            StateTextView.Text = "WIFI信息发送失败";
                        }
                    }
                    else
                    {//失败则要求用户处理
                        StateTextView.Text = "WIFI信息发送失败";
                    }
                };
                customizeDialog.SetView(dialogView);
                customizeDialog.Show();
            };
        }
예제 #2
0
 public CircleBarAnim(CircleBarView View)
 {
     this.View = View;
 }