ErrorWindow.on_button_send_log_clicked C# (CSharp) Method

on_button_send_log_clicked() private method

private on_button_send_log_clicked ( object o, EventArgs args ) : void
o object
args EventArgs
return void
    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;
    }