Ejemplo n.º 1
0
        private void Element_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            Image image = sender as Image;

            if (image == null)
            {
                return;
            }

            editorWindow.textEditor.SelectionLength = 0;

            InlineObjectElementExtended es = image.Tag as InlineObjectElementExtended;

            if (editorWindow == null)
            {
                return;
            }
            if (es == null)
            {
                return;
            }
            if (es.obs != null)
            {
                ISymbol symbol = es.obs as ISymbol;

                if (symbol != null)
                {
                    VSSolution vs = editorWindow.vs;

                    if (vs == null)
                    {
                        return;
                    }

                    var r = vs.GetAllSymbolReferences(symbol, null, null).Result;

                    List <ReferencedSymbol> b = new List <ReferencedSymbol>();
                    foreach (var c in r)
                    {
                        b.Add(c);
                    }

                    MessageBox.Show("Items found ... " + b.Count);
                }
            }
            MessageBox.Show("Clicked ...");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructs an element at the specified offset.
        /// May return null if no element should be constructed.
        /// </summary>
        public override VisualLineElement ConstructElement(int offset)
        {
            //Match m = FindMatch(offset);
            // check whether there's a match exactly at offset
            //if (m.Success && m.Index == 0) {
            ICSharpCode.AvalonEdit.Document.TextDocument document = CurrentContext.Document;
            int start = document.GetLineByOffset(offset).Offset;

            if (frameworkElement == null)
            {
                return(null);
            }

            if (start == offset)
            {
                DocumentLine documentLine = document.GetLineByOffset(offset);

                int height = (int)frameworkElement.Height;// (int)CurrentContext.VisualLine.Height;

                //            BitmapImage bitmap = bitmapImage;// LoadBitmap(m.Groups[1].Value);
                ////if (bitmap != null) {
                //	Image image = new Image();
                //	image.Source = bitmap;
                //	image.Width = bitmap.PixelWidth;
                //            image.Height = height;// bitmap.PixelHeight;
                //                              // Pass the length of the match to the 'documentLength' parameter
                //                              // of InlineObjectElement.

                var es = new InlineObjectElementExtended(1 /*m.Length*/, frameworkElement);

                //es.obs = documentLine.obs;

                //image.Tag = es;

                //es.Element.MouseDown += Element_MouseDown;

                return(es);
            }
            //}
            return(null);
        }