示例#1
0
        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);
            }
        }
示例#2
0
        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);
                }
            }
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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();
            }
        }
示例#6
0
        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);
                }
            }
        }
示例#7
0
 public override void Browse(IWin32Window parent)
 {
     value = TextEditForm.ShowDialog(parent, value);
 }
示例#8
0
 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;
 }
示例#9
0
        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;
		}