Exemplo n.º 1
0
        private void barButtonRegion_ItemClick(object sender, ItemClickEventArgs e)
        {
            RegionForm xform1 = new RegionForm(_FlexSys)
            {
                MdiParent = this
            };

            xform1.Show();
        }
        private void stopButton_Click(object sender, EventArgs e)
        {
            logger.Debug("stopButton_Click(...) ");

            mainForm.Cursor = Cursors.WaitCursor;
            this.Enabled    = false;

            Task.Run(() =>
            {
                StopStreaming();
            }).ContinueWith(t =>
            {
                //logger.Info(SharpDX.Diagnostics.ObjectTracker.ReportActiveObjects());

                UpdateControls();

                mainForm.Cursor = Cursors.Default;
                this.Enabled    = true;

                if (statisticForm != null)
                {
                    statisticForm.Stop();
                    statisticForm.Visible = false;
                }

                if (previewForm != null && !previewForm.IsDisposed)
                {
                    previewForm.Close();
                    previewForm = null;
                }

                regionForm?.Close();
                regionForm = null;

                var ex = t.Exception;
                if (ex != null)
                {
                    var iex = ex.InnerException;
                    MessageBox.Show(iex.Message);
                }
                else
                {
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
Exemplo n.º 3
0
        public override void EditSelectedItem()
        {
            RegionForm frm = new RegionForm(GetSelectedRegion(), MdiParentForm);

            frm.ShowDialog();
        }
Exemplo n.º 4
0
        private void lbtAddnew_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            RegionForm frm = new RegionForm(new ForlabRegion(), MdiParentForm);

            frm.ShowDialog();
        }
Exemplo n.º 5
0
        private void OnStreamStopped()
        {
            infoButton.Enabled = true;

            networkSettingsLayoutPanel.Enabled     = true;
            videoSourceSettingsLayoutPanel.Enabled = true;
            audioSourceSettingsLayoutPanel.Enabled = true;

            switchStreamingStateButton.Enabled = true;
            switchStreamingStateButton.Text    = "Start Streaming";

            startToolStripMenuItem.Text = "Start";

            contextMenu.Enabled = true;

            captureStatusLabel.Text = "Ready to stream";

            captureStatusDescriptionLabel.Text = "";

            this.Cursor = Cursors.Default;

            if (statisticForm != null)
            {
                statisticForm.Stop();
                statisticForm.Visible = false;
            }

            if (debugBorderForm != null)
            {
                debugBorderForm.Close();
                debugBorderForm = null;
            }


            if (selectAreaForm != null)
            {
                selectAreaForm.Capturing = false;
            }

            var errorMessage = "";
            var ex           = mediaStreamer.ExceptionObj;

            if (ex != null)
            {
                errorMessage = ex.Message;
                var iex = ex.InnerException;
                if (iex != null)
                {
                    errorMessage = iex.Message;
                }
            }

            if (mediaStreamer != null)
            {
                mediaStreamer.Shutdown();
            }

            if (!string.IsNullOrEmpty(errorMessage))
            {
                MessageBox.Show(errorMessage);
            }
        }
Exemplo n.º 6
0
        private void OnStreamStarted()
        {
            this.Cursor = Cursors.Default;

            infoButton.Enabled = true;

            networkSettingsLayoutPanel.Enabled     = false;
            videoSourceSettingsLayoutPanel.Enabled = false;
            audioSourceSettingsLayoutPanel.Enabled = false;

            switchStreamingStateButton.Enabled = true;
            switchStreamingStateButton.Text    = "Stop Streaming";

            contextMenu.Enabled         = true;
            startToolStripMenuItem.Text = "Stop";

            var ex = mediaStreamer.ExceptionObj;

            if (ex != null)
            {
                captureStatusLabel.Text = "Streaming attempt has failed";

                var errorMessage = ex.Message;
                var iex          = ex.InnerException;
                if (iex != null)
                {
                    errorMessage = iex.Message;
                }

                MessageBox.Show(errorMessage);


                return;
            }

            var videoSettings = currentSession.VideoSettings;

            if (videoSettings.Enabled)
            {
                var captureDescr = videoSettings?.CaptureDevice;
                if (captureDescr.CaptureMode == CaptureMode.Screen)
                {
                    var screenDescr = (ScreenCaptureDevice)captureDescr;

                    if (screenDescr.Properties.ShowDebugBorder)
                    {
                        debugBorderForm         = new RegionForm(screenDescr.CaptureRegion);
                        debugBorderForm.Visible = true;
                    }

                    if (screenDescr.Properties.ShowDebugInfo)
                    {
                        if (statisticForm == null)
                        {
                            statisticForm = new StatisticForm();
                        }
                        statisticForm.Location = screenDescr.CaptureRegion.Location;

                        var stats = mediaStreamer.Stats;

                        statisticForm.Start(stats);
                    }

                    //if (selectAreaForm != null)
                    //{
                    //    selectAreaForm.Capturing = true;
                    //}
                }
            }

            captureStatusLabel.Text = "";
            var statusDescription = "";
            var _port             = currentSession.CommunicationPort;

            if (currentSession.CommunicationPort >= 0)
            {
                var listenUri = mediaStreamer.ListenUri;
                statusDescription = "Stream running on: " + listenUri.Host + ":" + listenUri.Port;
            }

            //"Waiting for connection at " + _port + " port";
            captureStatusDescriptionLabel.Text = statusDescription;
        }
Exemplo n.º 7
0
        private void newRegionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            RegionForm frm = new RegionForm(new ForlabRegion(), this);

            frm.ShowDialog();
        }
        private void startButton_Click(object sender, EventArgs e)
        {
            logger.Debug("startButton_Click(...) ");

            try
            {
                UpdateSettings();

                mainForm.Cursor = Cursors.WaitCursor;
                this.Enabled    = false;

                Task.Run(() =>
                {
                    try
                    {
                        SetupStreaming(communicationAddress);

                        StartStreaming();
                    }
                    catch (Exception ex)
                    {
                        StopStreaming();
                        throw;
                    }
                }).ContinueWith(t =>
                {
                    UpdateControls();

                    mainForm.Cursor = Cursors.Default;
                    this.Enabled    = true;

                    var ex = t.Exception;
                    if (ex != null)
                    {
                        var iex = ex.InnerException;
                        MessageBox.Show(iex.Message);
                    }
                    else
                    {
                        if (videoSettings.Enabled)
                        {
                            var captureDescr = videoSettings?.CaptureDescription;
                            if (captureDescr.CaptureMode == CaptureMode.Screen)
                            {
                                var screenDescr = (ScreenCaptureDeviceDescription)captureDescr;

                                regionForm         = new RegionForm(screenDescr.CaptureRegion);
                                regionForm.Visible = true;

                                statisticForm.Location = screenDescr.CaptureRegion.Location;
                                if (showStatistic)
                                {
                                    statisticForm.Start();
                                }
                            }
                        }
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
            catch (Exception ex)
            {
                logger.Error(ex);

                MessageBox.Show(ex.Message);
            }
        }