async private Task <bool> createDiscussion(string title, Func <string, Task> funcCreator) { NoteEditPanel actions = new NoteEditPanel(); using (TextEditForm form = new TextEditForm(title, "", true, true, actions, _uploadsPrefix)) { actions.SetTextbox(form.TextBox); if (form.ShowDialog() == DialogResult.OK) { if (form.Body.Length == 0) { MessageBox.Show("Body cannot be empty", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } try { string body = StringUtils.ConvertNewlineWindowsToUnix(form.Body); await funcCreator(body); } catch (DiscussionCreatorException) { MessageBox.Show("Cannot create a discussion at GitLab. Check your connection and try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); } return(false); } }
async private Task onEditDiscussionNoteAsync(Control noteControl) { DiscussionNote note = getNoteFromControl(noteControl); if (note == null || !canBeModified(note)) { return; } string currentBody = StringUtils.ConvertNewlineUnixToWindows(note.Body); DiscussionNoteEditPanel actions = new DiscussionNoteEditPanel(); using (TextEditForm form = new TextEditForm("Edit Discussion Note", currentBody, true, true, actions)) { Point locationAtScreen = noteControl.PointToScreen(new Point(0, 0)); form.StartPosition = FormStartPosition.Manual; form.Location = locationAtScreen; actions.SetTextbox(form.TextBox); if (form.ShowDialog() == DialogResult.OK) { if (form.Body.Length == 0) { MessageBox.Show("Note text cannot be empty", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } string proposedBody = StringUtils.ConvertNewlineWindowsToUnix(form.Body); await submitNewBodyAsync(noteControl, proposedBody); } } }
public override bool OnDoubleClick() { base.OnDoubleClick(); var form = new TextEditForm(); form.Text = Name ?? "Edit text"; form.InputText = Text; var result = form.ShowDialog(); if (result == DialogResult.OK) { Text = form.InputText; } return(true); }
public override bool OnDoubleClick(System.Windows.Forms.Control container) { base.OnDoubleClick(container); var form = new TextEditForm(); form.Text = Name ?? "Edit text"; form.InputText = Text; var result = form.ShowDialog(); if (result == DialogResult.OK) { Text = form.InputText; } return(true); }
private void onViewDiscussionNote(Control noteControl) { DiscussionNote note = getNoteFromControl(noteControl); if (note == null) { return; } string currentBody = StringUtils.ConvertNewlineUnixToWindows(note.Body); using (TextEditForm form = new TextEditForm("View Discussion Note", currentBody, false, true, null)) { Point locationAtScreen = noteControl.PointToScreen(new Point(0, 0)); form.StartPosition = FormStartPosition.Manual; form.Location = locationAtScreen; form.ShowDialog(); } }
async private Task onReplyToDiscussionAsync(bool proposeUserToToggleResolveOnReply) { bool isAlreadyResolved = isDiscussionResolved(); string resolveText = String.Format("{0} Thread", (isAlreadyResolved ? "Unresolve" : "Resolve")); DiscussionNoteEditPanel actions = new DiscussionNoteEditPanel(resolveText, proposeUserToToggleResolveOnReply); using (TextEditForm form = new TextEditForm("Reply to Discussion", "", true, true, actions)) { actions.SetTextbox(form.TextBox); if (form.ShowDialog() == DialogResult.OK) { if (form.Body.Length == 0) { MessageBox.Show("Reply text cannot be empty", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } string proposedBody = StringUtils.ConvertNewlineWindowsToUnix(form.Body); await onReplyAsync(proposedBody, actions.IsResolveActionChecked); } } }
public override void Browse(IWin32Window parent) { value = TextEditForm.ShowDialog(parent, value); }
public override bool OnDoubleClick() { base.OnDoubleClick(); var form = new TextEditForm(); form.Text = Name ?? "Edit text"; form.InputText = Text; var result = form.ShowDialog(); if (result == DialogResult.OK) Text = form.InputText; return true; }
public override bool OnDoubleClick(System.Windows.Forms.Control container) { base.OnDoubleClick(container); var form = new TextEditForm(); form.Text = Name ?? "Edit text"; form.InputText = Text; var result = form.ShowDialog(); if (result == DialogResult.OK) Text = form.InputText; return true; }