当前位置: 首页>>代码示例>>C#>>正文


C# DecompilerTextView.Show方法代码示例

本文整理汇总了C#中ICSharpCode.ILSpy.TextView.DecompilerTextView.Show方法的典型用法代码示例。如果您正苦于以下问题:C# DecompilerTextView.Show方法的具体用法?C# DecompilerTextView.Show怎么用?C# DecompilerTextView.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICSharpCode.ILSpy.TextView.DecompilerTextView的用法示例。


在下文中一共展示了DecompilerTextView.Show方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: View

		internal override bool View(DecompilerTextView textView)
		{
			AvalonEditTextOutput output = new AvalonEditTextOutput();
			IHighlightingDefinition highlighting = null;
			
			textView.RunWithCancellation(
				token => Task.Factory.StartNew(
					() => {
						try {
							// cache read XAML because stream will be closed after first read
							if (xaml == null) {
								using (var reader = new StreamReader(data)) {
									xaml = reader.ReadToEnd();
								}
							}
							output.Write(xaml);
							highlighting = HighlightingManager.Instance.GetDefinitionByExtension(".xml");
						} catch (Exception ex) {
							output.Write(ex.ToString());
						}
						return output;
					}),
				t => textView.Show(t.Result, highlighting)
			);
			return true;
		}
开发者ID:ThomasZitzler,项目名称:ILSpy,代码行数:26,代码来源:XamlResourceNode.cs

示例2: Display

		public static void Display(DecompilerTextView textView)
		{
			AvalonEditTextOutput output = new AvalonEditTextOutput();
			output.WriteLine("ILSpy version " + RevisionClass.FullVersion);
			output.AddUIElement(
				delegate {
					StackPanel stackPanel = new StackPanel();
					stackPanel.HorizontalAlignment = HorizontalAlignment.Center;
					stackPanel.Orientation = Orientation.Horizontal;
					if (latestAvailableVersion == null) {
						AddUpdateCheckButton(stackPanel, textView);
					} else {
						// we already retrieved the latest version sometime earlier
						ShowAvailableVersion(latestAvailableVersion, stackPanel);
					}
					CheckBox checkBox = new CheckBox();
					checkBox.Margin = new Thickness(4);
					checkBox.Content = "Automatically check for updates every week";
					UpdateSettings settings = new UpdateSettings(ILSpySettings.Load());
					checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled") { Source = settings });
					return new StackPanel {
						Margin = new Thickness(0, 4, 0, 0),
						Cursor = Cursors.Arrow,
						Children = { stackPanel, checkBox }
					};
				});
			output.WriteLine();
			foreach (var plugin in App.CompositionContainer.GetExportedValues<IAboutPageAddition>())
				plugin.Write(output);
			output.WriteLine();
			using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt")) {
				using (StreamReader r = new StreamReader(s)) {
					string line;
					while ((line = r.ReadLine()) != null)
						output.WriteLine(line);
				}
			}
			textView.Show(output);
		}
开发者ID:hlesesne,项目名称:ILSpy,代码行数:39,代码来源:AboutPage.cs

示例3: View

        internal override bool View(DecompilerTextView textView)
        {
            AvalonEditTextOutput output = new AvalonEditTextOutput();
            IHighlightingDefinition highlighting = null;

            if (LoadImage(output)) {
                textView.Show(output, highlighting);
            } else {
                textView.RunWithCancellation(
                    token => Task.Factory.StartNew(
                        () => {
                            try {
                                if (LoadBaml(output))
                                    highlighting = HighlightingManager.Instance.GetDefinitionByExtension(".xml");
                            } catch (Exception ex) {
                                output.Write(ex.ToString());
                            }
                            return output;
                        }),
                    t => textView.Show(t.Result, highlighting)
                );
            }
            return true;
        }
开发者ID:petr-k,项目名称:ILSpy,代码行数:24,代码来源:ResourceEntryNode.cs

示例4: View

		internal override bool View(DecompilerTextView textView)
		{
			EmbeddedResource er = r as EmbeddedResource;
			if (er != null) {
				Stream s = er.GetResourceStream();
				if (s != null && s.Length < DecompilerTextView.DefaultOutputLengthLimit) {
					s.Position = 0;
					FileType type = GuessFileType.DetectFileType(s);
					if (type != FileType.Binary) {
						s.Position = 0;
						AvalonEditTextOutput output = new AvalonEditTextOutput();
						output.Write(FileReader.OpenStream(s, Encoding.UTF8).ReadToEnd());
						string ext;
						if (type == FileType.Xml)
							ext = ".xml";
						else
							ext = Path.GetExtension(DecompilerTextView.CleanUpName(er.Name));
						textView.Show(output, HighlightingManager.Instance.GetDefinitionByExtension(ext));
						return true;
					}
				}
			}
			return false;
		}
开发者ID:tris2481,项目名称:ILSpy,代码行数:24,代码来源:ResourceTreeNode.cs

示例5: AddUpdateCheckButton

		static void AddUpdateCheckButton(StackPanel stackPanel, DecompilerTextView textView)
		{
			Button button = new Button();
			button.Content = "Check for updates";
			button.Cursor = Cursors.Arrow;
			stackPanel.Children.Add(button);
			
			button.Click += delegate {
				button.Content = "Checking...";
				button.IsEnabled = false;
				GetLatestVersionAsync().ContinueWith(
					delegate (Task<AvailableVersionInfo> task) {
						try {
							stackPanel.Children.Clear();
							ShowAvailableVersion(task.Result, stackPanel);
						} catch (Exception ex) {
							AvalonEditTextOutput exceptionOutput = new AvalonEditTextOutput();
							exceptionOutput.WriteLine(ex.ToString());
							textView.Show(exceptionOutput);
						}
					}, TaskScheduler.FromCurrentSynchronizationContext());
			};
		}
开发者ID:arturek,项目名称:ILSpy,代码行数:23,代码来源:AboutPage.cs

示例6: View

		internal override bool View(DecompilerTextView textView)
		{
			try {
				AvalonEditTextOutput output = new AvalonEditTextOutput();
				data.Position = 0;
				BitmapImage image = new BitmapImage();
				image.BeginInit();
				image.StreamSource = data;
				image.EndInit();
				output.AddUIElement(() => new Image { Source = image });
				output.WriteLine();
				output.AddButton(Images.Save, "Save", delegate { Save(null); });
				textView.Show(output, null);
				return true;
			} catch (Exception) {
				return false;
			}
		}
开发者ID:tris2481,项目名称:ILSpy,代码行数:18,代码来源:ResourceEntryNode.cs


注:本文中的ICSharpCode.ILSpy.TextView.DecompilerTextView.Show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。