示例#1
0
        private void AddTagAndClear()
        {
            string        tag  = TagsTextBox.Text.Trim();
            bool          flag = false;
            List <string> list = new List <string>();

            foreach (string i in ChoosedTagsListBox.Items)
            {
                list.Add(i);
            }
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].Contains(tag))
                {
                    flag = true;
                }
            }
            if (flag)
            {
                MyMessages.WarningMessage("Ви вже обрали ключове слово " + tag + " для закріплення за документом");
            }
            else
            {
                ChoosedTagsListBox.Items.Add(tag);
            }
            TagsTextBox.Text = String.Empty;
            TagsForm_Resize();
            TagsTextErrorProvider.SetError(TagsTextBox, String.Empty);
            TagsTextBox.Focus();
            TagsListBox_Fill(TagsTextBox.Text.Trim());
        }
示例#2
0
 //Вибір ключового слова зі списку
 private void TagsListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         TagsTextBox.Text = TagsListBox.SelectedItem.ToString();
         TagsTextBox.Focus();
     }
     catch (Exception e1)
     {
         MyMessages.ErrorMessage(e1.Message);
     }
 }
示例#3
0
        void RichTextBoxMouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            //if cloned via ctrl+click the self is now hidden
            //and we don't want the nodebrowser to vanish yet
            if (Visible)
            {
                //hack: called only to re-focus active patch
                //after this mouseup set the focus to the already hidden NodeBrowser window
                OnCreateNodeFromString("");

                TagsTextBox.Focus();
            }
        }
示例#4
0
        void TagPanelVisibleChanged(object sender, EventArgs e)
        {
            //TagsTextBox not assigned during designtime
            if (TagsTextBox != null)
            {
                TagsTextBox.Text = TagsTextBox.Text.Trim();
                TagsTextBox.Focus();
            }
            FToolTip.Hide(FRichTextBox);

            if (PendingRedraw)
            {
                Redraw();
            }
        }
示例#5
0
 //Встановлення початкових розмірів форми
 private void TagsFormInitialSize()
 {
     TagsTextBox.Focus();
     Height = 365;
     Width  = 344;
     ClearTagsControls();
     TagsCancelButton.Enabled       = false;
     TagsConfirmButton.Enabled      = false;
     ChooseTagButton.Enabled        = false;
     TagsUserStatusLabel.Text       = _user.Fio;
     TagsDisciplineStatusLabel.Text = Discipline.Discipline_name;
     TagsDocumentStatusLabel.Text   = Materials.Documentname;
     TagsListBox_Fill(TagsTextBox.Text.Trim());
     if (Materials.Tags.Count > 0)
     {
         Materials.Tags.Clear();
     }
 }
示例#6
0
        void RichTextBoxMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (FHoverLine < 0 || FHoverLine >= FRichTextBox.Lines.Length)
            {
                return;
            }

            string username = FRichTextBox.Lines[FHoverLine].Trim();

            FRichTextBox.SelectionStart = FRichTextBox.GetFirstCharIndexFromLine(FHoverLine) + 1;
            TagsTextBox.Focus();

            //as plugin in its own window
            if (AllowDragDrop)
            {
                var selNode = FSelectionList[FHoverLine + ScrolledLine];
                TagsTextBox.DoDragDrop(string.Format("{0}||{1}", selNode.Systemname, selNode.Filename), DragDropEffects.All);
                return;
            }
            //else popped up on doubleclick
            else if (e.Button == MouseButtons.Left)
            {
                CreateNodeFromHoverLine();
            }
            else
            {
                try
                {
                    var selNode = FSelectionList[FHoverLine + ScrolledLine];
                    if (e.Button == MouseButtons.Middle)
                    {
                        OnShowNodeReference(selNode);
                    }
                    else
                    {
                        TagsTextBox.Text = "";
                        OnShowHelpPatch(selNode);
                    }
                }
                catch //username is a filename..do nothing
                {}
            }
        }
示例#7
0
        public void Initialize(string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                TagsTextBox.Text = "";
            }
            else
            {
                TagsTextBox.Text = text.Trim();
            }

            TagsTextBox.SelectAll();

            FHoverLine   = -1;
            ScrolledLine = 0;

            //            if (NeedsUpdate)
            //                Redraw();
            RedrawSelection();
        }
示例#8
0
        public void DoKeyDown(KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
            {
                if (!e.Shift)
                {
                    CreateNodeFromHoverLine();
                }
            }
            else if (e.KeyCode == Keys.Escape)
            {
                OnCreateNode(null);
            }
            else if ((TagsTextBox.Lines.Length < 2) && (e.KeyCode == Keys.Down))
            {
                FHoverLine += 1;
                //if this is exceeding the FSelectionList.Count -> jump to line 0
                if (FHoverLine + ScrolledLine >= FSelectionList.Count)
                {
                    FHoverLine   = 0;
                    ScrolledLine = 0;
                }
                //if this is exceeding the currently visible lines -> scroll down a line
                else if (FHoverLine >= FVisibleLines)
                {
                    ScrolledLine += 1;
                    FHoverLine    = FVisibleLines - 1;
                }

                RedrawSelection();
                ShowToolTip(0);
            }
            else if ((TagsTextBox.Lines.Length < 2) && (e.KeyCode == Keys.Up))
            {
                FHoverLine -= 1;
                //if this is exceeding the currently visible lines -> scroll up a line
                if ((FHoverLine == -1) && (ScrolledLine > 0))
                {
                    ScrolledLine -= 1;
                    FHoverLine    = 0;
                }
                //if we are now < 0 -> jump to last entry
                else if (FHoverLine < 0)
                {
                    FHoverLine   = Math.Min(FSelectionList.Count, FVisibleLines) - 1;
                    ScrolledLine = FSelectionList.Count;
                }

                RedrawSelection();
                ShowToolTip(0);
            }
            else if ((e.KeyCode == Keys.Left) || (e.KeyCode == Keys.Right))
            {
                if (FHoverLine != -1)
                {
                    FHoverLine = -1;
                    TagsTextBox.SelectionStart = TagsTextBox.Text.Length;
                    RedrawSelection();
                }
            }
            else if ((e.Control) && (e.KeyCode == Keys.A))
            {
                TagsTextBox.SelectAll();
            }
        }
示例#9
0
 public void AfterShow()
 {
     this.FRichTextBox.Resize += this.HandleRichTextBoxResize;
     TagsTextBox.Focus();
 }