Ejemplo n.º 1
0
        /// <summary>
        /// Tries to finish feedback.
        /// </summary>
        private void TryFinishFeedback(IEnvironmentModel environmentModel = null)
        {
            try
            {
                FeedBackRecorder.StopRecording();
            }
            catch (FeedbackRecordingNoProcessesExcpetion feedbackRecordingNoProcessesExcpetion)
            {
                Popup.Show("A recorded feedback session was ended but wasn't running. Please try start another recorded feedback session.", "No Recorded Feedback Session", MessageBoxButton.OK, MessageBoxImage.Error, null);
                if (_onCompleted != null)
                {
                    _onCompleted(feedbackRecordingNoProcessesExcpetion);
                }
                return;
            }
            catch (FeedbackRecordingTimeoutException feedbackRecordingTimeoutException)
            {
                Popup.Show("A timeout occured waiting for the recorded feedback session to end. Please try finish the recorded feedback session again.", "Recorded Feedback Session Timeout", MessageBoxButton.OK, MessageBoxImage.Error, null);
                if (_onCompleted != null)
                {
                    _onCompleted(feedbackRecordingTimeoutException);
                }
                return;
            }

            var attachedFiles = new Dictionary <string, string> {
                { "RecordingLog", _outputPath }
            };

            if (environmentModel != null)
            {
                attachedFiles.Add("ServerLog", environmentModel.ResourceRepository.GetServerLogTempPath(environmentModel));
            }
            attachedFiles.Add("StudioLog", FileHelper.GetStudioLogTempPath());
            IFeedbackAction emailFeedbackAction = new EmailFeedbackAction(attachedFiles, environmentModel);

            if (_onCompleted != null)
            {
                _onCompleted(null);
            }

            FeedBackInvoker.InvokeFeedback(emailFeedbackAction);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Tries to cancel feedback.
        /// </summary>
        private void TryCancelFeedback()
        {
            Exception completedResult = null;

            try
            {
                FeedBackRecorder.KillAllRecordingTasks();
            }
            catch (FeedbackRecordingTimeoutException feedbackRecordingTimeoutException)
            {
                Popup.Show("A timeout occurred waiting for the recorded feedback session to end. Please try cancel the recorded feedback session again.", "Recorded Feedback Session Timeout", MessageBoxButton.OK, MessageBoxImage.Error, null);
                completedResult = feedbackRecordingTimeoutException;
            }

            if (_onCompleted != null)
            {
                _onCompleted(completedResult);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Tries to start feedback.
        /// </summary>
        private void TryStartFeedback(Action <Exception> onOncompleted)
        {
            _onCompleted = onOncompleted;
            Exception completedResult = null;

            try
            {
                _outputPath = GetOuputPath();
                MessageBoxResult result = Popup.Show("Your actions are now being recorded. When you are ready to send your feedback please click 'Stop recording feedback' in the top right corner.", "Recording In Progress", MessageBoxButton.OK, MessageBoxImage.Information, null);
                if (result == MessageBoxResult.None)
                {
                    if (onOncompleted != null)
                    {
                        onOncompleted(null);
                    }
                    return;
                }
                FeedBackRecorder.StartRecording(_outputPath);
            }
            catch (FeedbackRecordingInprogressException feedbackRecordingInprogressException)
            {
                MessageBoxResult result = Popup.Show("A recording session is already in progress, would you like to try end it?", "Recording In Progress", MessageBoxButton.YesNoCancel, MessageBoxImage.Error, null);
                if (result == MessageBoxResult.Yes)
                {
                    FeedBackRecorder.KillAllRecordingTasks();
                    TryStartFeedback(onOncompleted);
                }
                else
                {
                    completedResult = feedbackRecordingInprogressException;
                }
            }
            //2013.02.06: Ashley Lewis - Bug 8611
            catch (FeedbackRecordingProcessFailedToStartException feedbackRecordingProcessFailedToStartException)
            {
                MessageBoxResult result = Popup.Show("The recording session cannot start at this time, would you like to send a standard email feedback?", "Recording Not Started", MessageBoxButton.YesNoCancel, MessageBoxImage.Error, null);
                if (result == MessageBoxResult.Yes)
                {
                    new FeedbackInvoker().InvokeFeedback(Factory.FeedbackFactory.CreateEmailFeedbackAction(new Dictionary <string, string>(), ServerUtil.GetLocalhostServer()));
                    TryCancelFeedback();
                }
                else
                {
                    completedResult = feedbackRecordingProcessFailedToStartException;
                }
            }
            catch (Exception e)
            {
                if (onOncompleted != null)
                {
                    completedResult = e;
                }
                else
                {
                    throw;
                }
            }

            if (onOncompleted != null && completedResult != null)
            {
                onOncompleted(completedResult);
            }
        }