コード例 #1
0
        void ReleaseDesignerOutlets()
        {
            if (ButtonCapture != null)
            {
                ButtonCapture.Dispose();
                ButtonCapture = null;
            }

            if (ButtonClearEvents != null)
            {
                ButtonClearEvents.Dispose();
                ButtonClearEvents = null;
            }

            if (ColumnDetails != null)
            {
                ColumnDetails.Dispose();
                ColumnDetails = null;
            }

            if (ColumnEventType != null)
            {
                ColumnEventType.Dispose();
                ColumnEventType = null;
            }

            if (TableEvents != null)
            {
                TableEvents.Dispose();
                TableEvents = null;
            }
        }
コード例 #2
0
 private void ButtonStart_Click(object sender, EventArgs e)
 {
     try
     {
         if (Connected == false)
         {
             _spManager.StartListening();
             sendCmd();
             ComboboxCOM.Enabled  = false;
             LabelConnect.Text    = "ĐÃ KẾT NỐI THIẾT BỊ";
             ButtonStartStop.Text = "NGẮT";
             Connected            = true;
             ButtonStartStop.Focus();
             ButtonCapture.Enabled = true;
             ButtonSave.Enabled    = true;
         }
         else
         {
             _spManager.SendData(StopCmd);
             _spManager.SendData(StopCmd);
             _spManager.SendData(StopCmd);
             _spManager.StopListening();
             _spManager.Dispose();
             _spManager.Dispose();
             _spManager.Dispose();
             TextBoxRawData.Clear();
             ComboboxCOM.Enabled   = true;
             LabelConnect.Text     = "CHƯA KẾT NỐI";
             ButtonStartStop.Text  = "KẾT NỐI";
             ButtonCapture.Text    = "LẤY MẪU";
             Connected             = false;
             ButtonCapture.Enabled = false;
             ButtonSave.Enabled    = false;
         }
         ButtonCapture.Focus();
     }
     catch (Exception ex)
     {
         MetroMessageBox.Show(this, "\r\n\r\nKhông kết nối được với cổng COM :\r\n" + ex.Message, "Thử lại", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #3
0
        public void SetupLiveCameraStream()
        {
            captureSession = new AVCaptureSession();

            var viewLayer = CameraView.Layer;

            videoPreviewLayer = new AVCaptureVideoPreviewLayer(captureSession)
            {
                Frame = this.View.Bounds
            };
            videoPreviewLayer.VideoGravity = AVLayerVideoGravity.ResizeAspectFill;
            CameraView.Layer.AddSublayer(videoPreviewLayer);

            var captureDevice = AVCaptureDevice.GetDefaultDevice(AVMediaType.Video);

            ConfigureCameraForDevice(captureDevice);
            captureDeviceInput = AVCaptureDeviceInput.FromDevice(captureDevice);
            captureSession.AddInput(captureDeviceInput);

            var dictionary = new NSMutableDictionary();

            dictionary[AVVideo.CodecKey] = new NSNumber((int)AVVideoCodec.JPEG);
            stillImageOutput             = new AVCaptureStillImageOutput()
            {
                OutputSettings = new NSDictionary()
            };

            captureSession.AddOutput(stillImageOutput);
            captureSession.StartRunning();


            ButtonBack.SetImage(UIImage.FromBundle("arrow_left").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal);
            ButtonFlash.SetImage(UIImage.FromBundle("flash_off").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal);
            ButtonSwitch.SetImage(UIImage.FromBundle("switch_camera").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal);
            ButtonCapture.SetImage(UIImage.FromBundle("capture_camera").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal);

            ButtonFlash.TouchUpInside   += BttFlash_TouchUpInside;
            ButtonCapture.TouchUpInside += BttCapture_TouchUpInside;
            ButtonBack.TouchUpInside    += BttBack_TouchUpInside;
            ButtonSwitch.TouchUpInside  += BttSwitch_TouchUpInside;
        }
コード例 #4
0
        void ReleaseDesignerOutlets()
        {
            if (ButtonBack != null)
            {
                ButtonBack.Dispose();
                ButtonBack = null;
            }

            if (ButtonCapture != null)
            {
                ButtonCapture.Dispose();
                ButtonCapture = null;
            }

            if (ButtonFlash != null)
            {
                ButtonFlash.Dispose();
                ButtonFlash = null;
            }

            if (ButtonSwitch != null)
            {
                ButtonSwitch.Dispose();
                ButtonSwitch = null;
            }

            if (CameraView != null)
            {
                CameraView.Dispose();
                CameraView = null;
            }

            if (ViewTop != null)
            {
                ViewTop.Dispose();
                ViewTop = null;
            }
        }