示例#1
0
        private IEnumerator SendBugReportAsync()
        {
            WWWForm form = new WWWForm();

            form.AddField(m_googleFormSettings.FeedbackTypeFieldID, FeedbackType.ToString());
            form.AddField(m_googleFormSettings.EmailFieldID, SanitiseString(Email));
            form.AddField(m_googleFormSettings.SubjectFieldID, SanitiseString(Subject));
            form.AddField(m_googleFormSettings.FeedbackFieldID, SanitiseString(Feedback));
            form.AddField(m_googleFormSettings.SystemInfoFieldID, SanitiseString(SystemInfo));

            if (Screenshot != null)
            {
                yield return(StartCoroutine(UploadScreenshotToImgur(result =>
                {
                    form.AddField(m_googleFormSettings.ScreenshotFieldID, SanitiseString(result));
                })));
            }
            else
            {
                form.AddField(m_googleFormSettings.ScreenshotFieldID, NOT_ASSIGNED);
            }

            WWW www = new WWW(m_googleFormSettings.FormURL, form.data);

            yield return(www);

            if (m_onDone != null)
            {
                m_onDone(new FeedbackFormResult(www.error));
                m_onDone = null;
            }
        }
示例#2
0
        /// <summary>
        /// Loads the given user's feedback characterisation for the given feedback type.
        /// </summary>
        /// <param name="userID">The ID of the user to load the data for.</param>
        ///  <param name="feedbackType">The type of feedback to load the characterization data for.</param>
        /// <returns>The UserData for the requested user.</returns>
        public static FeedbackCharacterization LoadFeedbackCharacterization(string userID, FeedbackType feedbackType)
        {
            FeedbackCharacterization loadedfeedbackCharacterization;
            // Get the folder for the given user ID
            string userPath     = dataFolder + "/UserData/" + userID;
            string loadFilePath = userPath + "/FeedbackCharacterizations/" + feedbackType.ToString() + ".json";

            if (File.Exists(loadFilePath))
            {
                // Load data
                string feedbackCharacterizationAsJson = File.ReadAllText(loadFilePath);
                // Check type of feedback to be loaded
                switch (feedbackType)
                {
                case FeedbackType.BoneConduction:
                    loadedfeedbackCharacterization = JsonUtility.FromJson <BoneConductionCharacterization>(feedbackCharacterizationAsJson);
                    break;

                default:
                    throw new System.NotImplementedException("Feedback type not yet supported.");
                }
            }
            else
            {
                throw new System.Exception("The file :" + loadFilePath + ", could not be found.");
            }

            return(loadedfeedbackCharacterization);
        }
示例#3
0
        private IEnumerator SendEnhancementAsync()
        {
            WWWForm form = new WWWForm();

            form.AddField(m_googleFormSettings.FeedbackTypeFieldID, FeedbackType.ToString());
            form.AddField(m_googleFormSettings.EmailFieldID, SanitiseString(Email));
            form.AddField(m_googleFormSettings.SubjectFieldID, SanitiseString(Subject));
            form.AddField(m_googleFormSettings.FeedbackFieldID, SanitiseString(Feedback));
            form.AddField(m_googleFormSettings.ScreenshotFieldID, NOT_ASSIGNED);
            form.AddField(m_googleFormSettings.SystemInfoFieldID, NOT_ASSIGNED);

            WWW www = new WWW(m_googleFormSettings.FormURL, form.data);

            yield return(www);

            if (m_onDone != null)
            {
                m_onDone(new FeedbackFormResult(www.error));
                m_onDone = null;
            }
        }
示例#4
0
        public SiteUrl FeedbackPage(FeedbackType feedback, string localizationKey, SiteUrl redirect)
        {
            var parameters = new Dictionary <string, string>
            {
                { "key", localizationKey },
                { "url", redirect }
            };

            return(new SiteUrl(this.Domain, this.HttpPort, false, "Dxt-Admin", "Feedback", feedback.ToString(), null, parameters));
        }
        public SiteUrl FeedbackPage(FeedbackType feedback, string localizationKey, SiteUrl redirect)
        {
            var parameters = new Dictionary<string, string>
                                 {
                                     { "key", localizationKey },
                                     { "url", redirect }
                                 };

            return new SiteUrl(this.Domain, this.HttpPort, false, "Dxt-Admin", "Feedback", feedback.ToString(), null, parameters);
        }
示例#6
0
        private async void sendButton_Click(object sender, RoutedEventArgs e)
        {
            string _email = email.Text;

            if (!string.IsNullOrEmpty(_email))
            {
                if (!await Task.Factory.StartNew <bool>(() => { return((new RegexUtilities()).IsValidEmail(_email)); }))
                {
                    TaskDialog td = new TaskDialog(this, "Invalid Email", "The email address you entered is not valid.", MessageType.Error);
                    td.ShowDialog();

                    email.Focus();

                    return;
                }
            }

            string trimmedDetails = details.Text.Trim();

            switch (_type)
            {
            case FeedbackType.Error:
                if (string.IsNullOrEmpty(trimmedDetails))
                {
                    TaskDialog td = new TaskDialog(this, "Error Details",
                                                   "Please tell us what you were doing when you encountered the problem. It will make debugging much easier on our side.",
                                                   MessageType.Information, "_OK", "_No Thanks");

                    if (td.ShowDialog() == true)
                    {
                        details.Focus();
                        return;
                    }
                }
                break;

            case FeedbackType.Frown:
                if (trimmedDetails.Split(new char[] { ' ' }, 10, StringSplitOptions.RemoveEmptyEntries).Length < 10)
                {
                    TaskDialog td = new TaskDialog(this, "Insufficient Data",
                                                   "Please give a detailed (10 words or more) description of the problem.", MessageType.Error);
                    td.ShowDialog();

                    details.Focus();

                    return;
                }
                break;

            case FeedbackType.Smile:
                if (string.IsNullOrEmpty(trimmedDetails))
                {
                    TaskDialog td = new TaskDialog(this, "Data Missing",
                                                   "You forgot to tell us what you like about " + GlobalAssemblyInfo.AssemblyName + ".", MessageType.Error);
                    td.ShowDialog();

                    details.Focus();

                    return;
                }
                break;

            default:
                break;
            }

            sendButton.Visibility = Visibility.Hidden;
            cancelButton.IsCancel = false;
            email.IsEnabled       = false;
            details.IsEnabled     = false;

            IndeterminateProgressBar animation = new IndeterminateProgressBar();

            animation.Margin = new Thickness(0, 0, 100, 0);
            footer.Children.Add(animation);

            string typeString = _type.ToString().ToLower();

            trimmedDetails = "This message is a" + (IsVowel(typeString[0]) ? "n" : "") + " " + typeString
                             + ".<br/><br/>" + ConvertToHtml(trimmedDetails)
                             + "<br/><br/>Additional information:<br/>"
                             + ConvertToHtml(_addend)
                             + "<br/><br/>" + ConvertToHtml(GetStats());

            sendThread              = new Thread(() => { SendReport(_email, trimmedDetails); });
            sendThread.Priority     = ThreadPriority.BelowNormal;
            sendThread.IsBackground = true;
            sendThread.Start();
        }