Ejemplo n.º 1
0
        public void StartCaptureInit(int type, int camIndex, string filename)
        {
            if (MediaHandler != null)
            {
                Timer.Stop();
                MediaHandler.Dispose();
            }

            try
            {
                if (Connection.IsOpen())
                {
                    Connection.Close();
                    ResultUC.AppendServerMsg("Successfully disconnected from the server [" + NetworkOptionsWindow + "].");
                }

                IPAddress ip = IPAddress.Parse(NetworkOptionsWindow.ServerIp);
                Connection.Open(new IPEndPoint(ip, NetworkOptionsWindow.ServerPort));

                ResultUC.AppendServerMsg("A connection was successfully established with the server [" + NetworkOptionsWindow + "]");
            }
            catch (Exception e)
            {
                ResultUC.AppendServerMsg(e.Message);
            }


            if (type == 0)
            {
                MediaHandler = new MediaHandler(camIndex);

                MultimediaUC.VideoLengthSlider.Value = 0;

                CamZeroMenuItem.Header = "_Stop capture";
                MultimediaUC.StartCaptureButton.Content = "Stop";
                WindowMain.Title = Properties.Resources.MainWindowTitle + " - Webcam #" + camIndex;
            }
            else
            {
                MediaHandler = new MediaHandler(filename);

                MultimediaUC.VideoLengthSlider.Value = 0;

                CamZeroMenuItem.Header = "_Start capture";
                MultimediaUC.StartCaptureButton.Content = "Stop";
                WindowMain.Title = Properties.Resources.MainWindowTitle + " - " + filename;
            }

            Timer.Start();
        }
Ejemplo n.º 2
0
        private void WindowClosing(object sender, CancelEventArgs e)
        {
            if (MediaHandler != null)
            {
                MediaHandler.Dispose();
            }

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

            ProcessOptionsWindow.Close();
        }
Ejemplo n.º 3
0
        public void StopCaptureInit()
        {
            if (MediaHandler != null)
            {
                Timer.Stop();
                MediaHandler.Dispose();
            }

            Connection.Close();
            ResultUC.AppendServerMsg("Successfully disconnected from the server [" + NetworkOptionsWindow + "].");

            CamZeroMenuItem.Header = "_Start capture";
            MultimediaUC.StartCaptureButton.Content = "Start";
            MultimediaUC.VideoLengthSlider.Value    = 0;
            WindowMain.Title = Properties.Resources.MainWindowTitle;

            using (var multimediaBackground = new Image <Bgr, byte>(Properties.Resources.mf))
            {
                MultimediaUC.CurFrame.Source = multimediaBackground.Bitmap.ToWpfBitmap();
            }
        }