コード例 #1
0
        private void AWBEditor_DoubleClick(object sender, MouseEventArgs e)
        {
            Guid result;
            String attributeValue = "";
            //MessageBox.Show(result.ToString());
            attributeValue = GetAttributeValueFromPosition(Selection.Text);

            if (ModifierKeys == Keys.Control )//e.Control && e.KeyCode == Keys.O)
            {
                if (Guid.TryParse(Selection.Text, out result))
                {
                    var form = new DocumentForm();
                    Document document = DocumentManager.GetDocument(attributeValue);
                    if (document == null)
                    {
                        MessageBox.Show(string.Format("The document with id \"{0}\" does not exist in the database.",
                                                      attributeValue));
                    }
                    else
                    {
                        form.Document = document;
                        form.StartPosition = FormStartPosition.WindowsDefaultLocation;
                        form.ShowDialog();
                    }
                }
                //from current position go back upto 32 chars to see if there is a quote
            }
        }
コード例 #2
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            try
            {
                if (e.Alt && e.KeyCode == Keys.F2)
                {
                    ToggleBookmark();
                }
                else if (e.KeyCode == Keys.F2)
                {
                    GotoNextBookmark();
                }
                else if (e.KeyCode == Keys.Up
                         || e.KeyCode == Keys.Down
                         || e.KeyCode == Keys.Left
                         || e.KeyCode == Keys.Right
                         || e.Control)
                {
                    //Check if valid guid
                    Guid result;
                    String attributeValue = "";

                    if (e.Control && e.KeyCode == Keys.O)
                    {
                        if (Guid.TryParse( Selection.Text, out result ))
                        {
                            attributeValue = GetAttributeValueFromPosition( Selection.Text );
                            var form = new DocumentForm();
                            form.Document = DocumentManager.GetDocument( attributeValue );
                            form.StartPosition = FormStartPosition.WindowsDefaultLocation;
                            form.ShowDialog();
                        }
                        //from current position go back upto 32 chars to see if there is a quote
                    }
                    else if (e.Control && e.Alt && e.KeyCode == Keys.Space)
                    {
                        Line line = Lines.Current;
                        if (line != null)
                            line.ToggleFoldExpanded();
                    }
                    else if (e.Control && e.Alt && e.KeyCode == Keys.M)
                    {
                        Commands.Execute( BindableCommand.ShowFind );
                    }
                    else if (e.Control && e.KeyCode == Keys.W)
                    {
                        ToggleWordWrap();
                    }
                    else
                    {
                        base.OnKeyDown( e );
                    }
                }
                else
                {
                    base.OnKeyDown( e );
                }
            }
            catch (Exception exception)
            {
                LogManager.Error( exception );
            }
        }