예제 #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Form.Shown" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.EventArgs" /> that contains the event data.</param>
        protected async override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            Set = new Set();
            FilesGrid.DataSource = Set;

            try
            {
                await LiveView.Initialize();

                CameraLabel.BackColor = Color.Green;
            }
            catch (Exception ex)
            {
                CameraLabel.BackColor = Color.Red;
            }

            try
            {
                _projector = new Projector();
                await _projector.Initialize();

                ProjectorLabel.BackColor = Color.Green;
            }
            catch
            {
                ProjectorLabel.BackColor = Color.Red;
            }
        }
예제 #2
0
 /// <summary>
 /// Handles the 1 event of the ManualButton_Click control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void ManualButton_Click(object sender, EventArgs e)
 {
     try { LiveView.Capture(); }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Capture Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
         CameraLabel.BackColor = Color.Red;
     }
 }
예제 #3
0
        /// <summary>
        /// Sets the transform of the live preview to fill the screen and be aligned
        /// in the landscape direction.
        /// </summary>
        public void SetupPreviewMatrix()
        {
            float width  = mainLayout.Width;
            float height = mainLayout.Height;

            Matrix matrix = new Matrix();

            matrix.PostRotate(0, width / 2.0f, height / 2.0f);
            LiveView.SetTransform(matrix);
        }
예제 #4
0
파일: Program.cs 프로젝트: ekx/LiveViewLib
        public static void OnConnect(LiveView liveView)
        {
            liveView.SetMenuItems(new LiveViewLib.MenuItem[] {
                new LiveViewLib.MenuItem(true, 30, "Menu0", GetPreview()),
                new LiveViewLib.MenuItem(true, 52, "Menu1", GetPreview())
            });

            liveView.deviceStatusListener += OnDeviceStatus;
            liveView.navigationListener   += OnNavigation;
            liveView.alertListener        += OnAlert;
        }
예제 #5
0
 private void LiveViewButton_Click(object sender, EventArgs e)
 {
     if (LiveView.Running)
     {
         LiveView.Stop();
         LiveViewButton.Text = "Live View";
     }
     else
     {
         LiveView.Start();
         LiveViewButton.Text = "Stop";
     }
 }
예제 #6
0
        private async void FocusButton_Checked(object sender, RoutedEventArgs e)
        {
            LiveView.Stretch = Stretch.None;

            if (FocusButton.IsChecked == true)
            {
                LiveView.Start();
                LiveViewButton.IsChecked = false;
            }
            else
            {
                LiveView.Stop();
            }
        }
예제 #7
0
        /// <summary>
        /// Handles the Click event of the LiveViewButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private async void LiveViewButton_Click(object sender, RoutedEventArgs e)
        {
            LiveView.Stretch = Stretch.Uniform;

            if (LiveViewButton.IsChecked == true)
            {
                LiveView.Start();
                FocusButton.IsChecked = false;
            }
            else
            {
                LiveView.Stop();
            }
        }
예제 #8
0
 /// <summary>
 /// Handles the Click event of the LiveViewButton control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void LiveViewButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (LiveViewButton.Checked)
         {
             LiveView.Start();
         }
         else
         {
             LiveView.Stop();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Capture Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        /// <summary>
        /// Sets the transform of the live preview to fill the screen and be aligned
        /// in the landscape direction.
        /// </summary>
        public void SetupPreviewMatrix()
        {
            float landscapeScreenRotation = 0.0f;

            if (windowManager.DefaultDisplay.Rotation == SurfaceOrientation.Rotation270)
            {
                landscapeScreenRotation = 180.0f;
            }

            float width  = mainLayout.Width;
            float height = mainLayout.Height;

            Matrix matrix = new Matrix();

            matrix.PostRotate(360.0f - landscapeScreenRotation - sensorOrientation, width / 2.0f, height / 2.0f);
            if (sensorOrientation != 180)
            {
                matrix.PostScale(width / height, height / width, width / 2.0f, height / 2.0f);
            }
            LiveView.SetTransform(matrix);
        }
예제 #10
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.FrameworkElement.Initialized" /> event. This method is invoked whenever <see cref="P:System.Windows.FrameworkElement.IsInitialized" /> is set to true internally.
        /// </summary>
        /// <param name="e">The <see cref="T:System.Windows.RoutedEventArgs" /> that contains the event data.</param>
        protected async override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);
            try
            {
                Globals.Initialize();
                await Globals.Projector.Initialize();
            }
            catch (RelayBoardException)
            {
                LampToggleButton.IsEnabled = false;
                FanToggleButton.IsEnabled  = false;
                LoadButton.IsEnabled       = false;
            }

            try
            {
                await LiveView.Initialize();
            }
            catch (Exception)
            {
            }
        }
예제 #11
0
 public void Next()
 {
     LiveView.CurrentScreen = LiveView.LiveScouting;
     LiveView.ChangeTransitioningContent();
 }
예제 #12
0
파일: Program.cs 프로젝트: ekx/LiveViewLib
 public static void OnDeviceStatus(LiveView liveView, DeviceStatusMessage message)
 {
 }
예제 #13
0
 public void Previous()
 {
     LiveView.CurrentScreen = LiveView.ChoiceOfEnds;
     LiveView.ChangeTransitioningContent();
 }
예제 #14
0
 public void Next()
 {
     LiveView.CurrentScreen = LiveView.ChoiceOfServiceReceive;
     LiveView.ChangeTransitioningContent();
 }
예제 #15
0
 private void UserControl_Unloaded(object sender, RoutedEventArgs e)
 {
     LiveView.RemoveFromVisualTree();
 }
예제 #16
0
 private void CaptureButton_Click(object sender, EventArgs e)
 {
     LiveView.Capture();
 }
예제 #17
0
        public Test()
        {
            InitializeComponent();
            try { RelayBoard.Initialize(); }
            catch (Exception ex)
            {
                SlideProjectorGroupBox.Enabled = false;
            }
            CameraGroupBox.Enabled = true;
            try
            {
                Camera.Initialize();
                LiveView.Initialize(Camera.GetDevice());

                //  Configure ISO slider
                _isos = Camera.GetIsos();
                IsoBar.SetRange(0, _isos.Length - 1);
                IsoBar.Scroll += (sender, e) => IsoLabel.Text = _isos[IsoBar.Value];
                string iso = Camera.GetIso();
                if (iso != null)
                {
                    IsoBar.Value  = _isos.ToList().IndexOf(iso);
                    IsoLabel.Text = iso;
                }

                // Configure Aperture slider
                _apertures = Camera.GetApertures();
                ApertureBar.SetRange(0, _apertures.Length - 1);
                ApertureBar.Scroll += (sender, e) => ApertureLabel.Text = _apertures[ApertureBar.Value];
                string aperture = Camera.GetAperture();
                if (aperture != null)
                {
                    ApertureBar.Value  = _apertures.ToList().IndexOf(aperture);
                    ApertureLabel.Text = aperture;
                }

                // Configure shutter speed
                _shutters = Camera.GetShutterSpeeds();
                ShutterSpeedBar.SetRange(0, _shutters.Length - 1);
                ShutterSpeedBar.Scroll += (sender, e) => ShutterSpeedLabel.Text = _shutters[ShutterSpeedBar.Value];
                string shutter = Camera.GetShutterSpeed();
                if (shutter != null)
                {
                    ShutterSpeedBar.Value  = _shutters.ToList().IndexOf(shutter);
                    ShutterSpeedLabel.Text = shutter;
                }

                // Configure exposure
                _exposures = Camera.GetExposureCompensations();
                ExposureCompensationBar.SetRange(0, _exposures.Length - 1);
                ExposureCompensationBar.Scroll += (sender, e) => ExposureCompensationLabel.Text = _exposures[ExposureCompensationBar.Value];
                string exposure = Camera.GetExposureCompensation();
                if (exposure != null)
                {
                    ExposureCompensationBar.Value = _exposures.ToList().IndexOf(exposure);
                    ShutterSpeedLabel.Text        = exposure;
                }
            }
            catch (Exception ex)
            {
                CameraGroupBox.Enabled = false;
            }
        }
예제 #18
0
 private void SingleCaptureButton_Click(object sender, RoutedEventArgs e)
 {
     LiveView.Capture();
 }
예제 #19
0
파일: Program.cs 프로젝트: ekx/LiveViewLib
 public static void OnNavigation(LiveView liveView, NavigationMessage message)
 {
     liveView.Send(new NavigationResponse(LiveViewMessage.RESULT_EXIT));
 }
예제 #20
0
파일: Program.cs 프로젝트: ekx/LiveViewLib
 public static void OnAlert(LiveView liveView, GetAlertMessage message)
 {
     liveView.Send(new GetAlertResponse(20, 10, 1, "tst", "ht", "bt", File.ReadAllBytes("test36.png")));
 }
예제 #21
0
 public AppLive()
 {
     MainPage = new LiveView();
 }