ICSharpCode.ILSpy.TextView.AvalonEditTextOutput.AddUIElement C# (CSharp) Метод

AddUIElement() публичный Метод

public AddUIElement ( Func element ) : void
element Func
Результат void
        public void AddUIElement(Func<UIElement> element)
        {
            if (element != null)
            {
                if (this.UIElements.Count > 0 && this.UIElements.Last().Key == this.TextLength)
                    throw new InvalidOperationException("Only one UIElement is allowed for each position in the document");
                this.UIElements.Add(new KeyValuePair<int, Lazy<UIElement>>(this.TextLength, new Lazy<UIElement>(element)));
            }
        }

Usage Example

Пример #1
0
		public override bool View(DecompilerTextView textView)
		{
			try {
				AvalonEditTextOutput output = new AvalonEditTextOutput();
				Data.Position = 0;
				BitmapImage image = new BitmapImage();

				//HACK: windows imaging does not understand that .cur files have the same layout as .ico
				// so load to data, and modify the ResourceType in the header to make look like an icon...
				byte[] curData = ((MemoryStream)Data).ToArray();
				curData[2] = 1;
				using (Stream stream = new MemoryStream(curData)) {
					image.BeginInit();
					image.StreamSource = stream;
					image.EndInit();
				}

				output.AddUIElement(() => new Image { Source = image });
				output.WriteLine();
				output.AddButton(Images.Save, "Save", delegate {
					Save(null);
				});
				textView.ShowNode(output, this, null);
				return true;
			}
			catch (Exception) {
				return false;
			}
		}
All Usage Examples Of ICSharpCode.ILSpy.TextView.AvalonEditTextOutput::AddUIElement