Exemplo n.º 1
0
        /// <summary>
        /// Get folder and remote recorder user have access to
        /// </summary>
        /// <param name="sender">object invoking this method</param>
        /// <param name="e">argumnets</param>
        private void LoginAction(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker bgw = sender as BackgroundWorker;

            string[] args     = e.Argument as string[];
            int      progress = 0;

            // Get folders
            try
            {
                Dictionary <string, Guid> temp = RemoteRecorderWrapper.GetFolders(args[0], args[1]);
                progress += 50;
                bgw.ReportProgress(progress, new Dictionary <string, Guid>(temp));
            }
            catch (Exception ex)
            {
                bgw.ReportProgress(0, ex.Message);
            }

            // Get remote recorders
            try
            {
                Dictionary <string, Guid> temp = RemoteRecorderWrapper.GetRemoteRecorders(args[0], args[1]);
                progress += 50;
                bgw.ReportProgress(progress, new Dictionary <string, Guid>(temp));
            }
            catch (Exception ex)
            {
                bgw.ReportProgress(0, ex.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Action performed when stopping recording
        /// </summary>
        /// <param name="sender">Object invoked this method</param>
        /// <param name="e">arguments</param>
        private void StopRecording_Click(object sender, RoutedEventArgs e)
        {
            recordingTimer.Stop();
            recordingTimer = null;

            StartStop.IsEnabled = false;

            StartStop.Content = "Start Recording";
            StartStop.Click  -= StopRecording_Click;
            StartStop.Click  += StartRecording_Click;

            // Stop the recording
            RemoteRecorderWrapper.StopSessionRecording(rrMgr, authInfo, recordingResult.SessionIDs[0]);

            Status.Content = "Recording Stopped";

            RecordingRelease();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Action performed when starting recording
        /// </summary>
        /// <param name="sender">Object invoked this method</param>
        /// <param name="e">arguments</param>
        private void StartRecording_Click(object sender, RoutedEventArgs e)
        {
            RecordingLock();
            Status.Content = "Starting Recording...";
            bool   recordingSuccess        = true;
            int    length                  = 0;
            string recordingFailureMessage = "";

            // Get information necessary to start recording
            Guid folderID = Guid.Empty;

            if (Folder.SelectedIndex >= 0)
            {
                string folderName = Folder.Text;
                folderID = folderInfo[folderName];
            }
            else
            {
                recordingSuccess         = false;
                recordingFailureMessage += "Choose a folder to record to";
            }

            Guid rrID = Guid.Empty;

            if (RemoteRecorder.SelectedIndex >= 0)
            {
                string rrName = RemoteRecorder.Text;
                rrID = recorderInfo[rrName];
            }
            else
            {
                recordingSuccess         = false;
                recordingFailureMessage += "Choose a remote recorder to record from; ";
            }

            try
            {
                length = Convert.ToInt32(SessionLength.Text);
                if (length <= 0)
                {
                    recordingSuccess         = false;
                    recordingFailureMessage += "Invalid session length input; ";
                }
            }
            catch (Exception)
            {
                recordingSuccess         = false;
                recordingFailureMessage += "Invalid session length input; ";
            }

            // Start UI if information is correct
            if (recordingSuccess)
            {
                recordingResult = RemoteRecorderWrapper.StartRecordingSession(rrMgr, authInfo, length, SessionName.Text, folderID, rrID);

                if (recordingResult == null || recordingResult.SessionIDs == null || recordingResult.SessionIDs.Length == 0)
                {
                    recordingSuccess         = false;
                    recordingFailureMessage += "Start Recording Failed: Unable to start recording";
                }
            }

            // Change UI to match recording state
            if (recordingSuccess)
            {
                StartStop.Content   = "Stop Recording";
                StartStop.Click    -= StartRecording_Click;
                StartStop.Click    += StopRecording_Click;
                StartStop.IsEnabled = true;

                Status.Content = "Recording...";

                double lengthMilliseconds = length * 60 * 1000;
                recordingTimer          = new Timer(lengthMilliseconds);
                recordingTimer.Elapsed += new ElapsedEventHandler(TimerStop);
                recordingTimer.Start();
            }
            else // Return UI to start recording state since starting recording failed
            {
                Status.Content = "Start Recording Failed: " + recordingFailureMessage;
                RecordingRelease();
            }
        }