PostCrashLog() public method

public PostCrashLog ( string email, string comments ) : bool
email string
comments string
return bool
Example #1
0
    private void on_button_send_log_clicked(object o, EventArgs args)
    {
        string email = entry_send_log.Text.ToString();

        //email can be validated with Util.IsValidEmail(string)
        //or other methods, but maybe there's no need of complexity now

        //1st save email on sqlite
        if (email != null && email != "" && email != "0" && email != emailStored)
        {
            SqlitePreferences.Update("email", email, false);
        }

        //2nd add language as comments
        string language = get_send_log_language();

        SqlitePreferences.Update("crashLogLanguage", language, false);
        string comments = "Answer in: " + language + "\n";

        //3rd if there are comments, add them at the beginning of the file
        comments += textview_comments.Buffer.Text;

        //4th send Json
        Json js      = new Json();
        bool success = js.PostCrashLog(email, comments);

        if (success)
        {
            button_send_log.Label     = Catalog.GetString("Thanks");
            button_send_log.Sensitive = false;

            image_send_log_yes.Show();
            image_send_log_no.Hide();
            LogB.Information(js.ResultMessage);
        }
        else
        {
            button_send_log.Label = Catalog.GetString("Try again");

            image_send_log_yes.Hide();
            image_send_log_no.Show();
            LogB.Error(js.ResultMessage);
        }

        label_send_log_message.Text = js.ResultMessage;
    }
Example #2
0
    private void on_button_send_log_clicked(object o, EventArgs args)
    {
        string email = entry_send_log.Text.ToString();
        //email can be validated with Util.IsValidEmail(string)
        //or other methods, but maybe there's no need of complexity now

        //1st save email on sqlite
        if(email != null && email != "" && email != "0" && email != emailStored)
            SqlitePreferences.Update("email", email, false);

        //2nd if there are comments, add them at the beginning of the file
        string comments = textview_comments.Buffer.Text;

        //2nd send Json
        Json js = new Json();
        bool success = js.PostCrashLog(email, comments);

        if(success) {
            button_send_log.Label = Catalog.GetString("Thanks");
            button_send_log.Sensitive = false;

            image_send_log_yes.Show();
            image_send_log_no.Hide();
            LogB.Information(js.ResultMessage);
        } else {
            button_send_log.Label = Catalog.GetString("Try again");

            image_send_log_yes.Hide();
            image_send_log_no.Show();
            LogB.Error(js.ResultMessage);
        }

        label_send_log_message.Text = js.ResultMessage;
    }