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

public AddVisualLineElementGenerator ( ICSharpCode.AvalonEdit.Rendering.VisualLineElementGenerator elementGenerator ) : void
elementGenerator ICSharpCode.AvalonEdit.Rendering.VisualLineElementGenerator
Результат void
Пример #1
0
		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);
					}
				}
			}
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("SharpDevelop", "http://www.icsharpcode.net/opensource/sd/"));
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MIT License", "resource:license.txt"));
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("LGPL", "resource:LGPL.txt"));
			textView.ShowText(output);
			
			//reset icon bar
			textView.manager.Bookmarks.Clear();
		}
Пример #2
0
		public static void Display(DecompilerTextView textView) {
			AvalonEditTextOutput output = new AvalonEditTextOutput();
			output.WriteLine(string.Format("dnSpy version {0}", currentVersion.ToString()), TextTokenType.Text);
			var decVer = typeof(ICSharpCode.Decompiler.Ast.AstBuilder).Assembly.GetName().Version;
			output.WriteLine(string.Format("ILSpy Decompiler version {0}.{1}.{2}", decVer.Major, decVer.Minor, decVer.Build), TextTokenType.Text);
			if (checkForUpdateCode)
				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(DNSpySettings.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 }
						};
					});
			if (checkForUpdateCode)
				output.WriteLine();
			foreach (var plugin in App.CompositionContainer.GetExportedValues<IAboutPageAddition>())
				plugin.Write(output);
			output.WriteLine();
			using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(dnSpy.StartUpClass), "README.txt")) {
				using (StreamReader r = new StreamReader(s)) {
					string line;
					while ((line = r.ReadLine()) != null) {
						output.WriteLine(line, TextTokenType.Text);
					}
				}
			}
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("SharpDevelop", "http://www.icsharpcode.net/opensource/sd/"));
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MIT License", "resource:license.txt"));
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("LGPL", "resource:LGPL.txt"));
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("COPYING", "resource:COPYING"));
			textView.ShowText(output);
			MainWindow.Instance.SetTitle(textView, "About");
		}
Пример #3
0
 public static void Display(DecompilerTextView textView)
 {
     AvalonEditTextOutput avalonEditTextOutput = new AvalonEditTextOutput();
     avalonEditTextOutput.WriteLine("ILSpy 版本 2.1.0.1603");
     avalonEditTextOutput.AddUIElement(delegate
     {
         StackPanel stackPanel = new StackPanel();
         stackPanel.HorizontalAlignment = HorizontalAlignment.Center;
         stackPanel.Orientation = Orientation.Horizontal;
         if (AboutPage.latestAvailableVersion == null)
         {
             AboutPage.AddUpdateCheckButton(stackPanel, textView);
         }
         else
         {
             AboutPage.ShowAvailableVersion(AboutPage.latestAvailableVersion, stackPanel);
         }
         CheckBox checkBox = new CheckBox();
         checkBox.Margin = new Thickness(4.0);
         checkBox.Content = "每周自动检查更新";
         AboutPage.UpdateSettings source = new AboutPage.UpdateSettings(ILSpySettings.Load());
         checkBox.SetBinding(ToggleButton.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled")
         {
             Source = source
         });
         return new StackPanel
         {
             Margin = new Thickness(0.0, 4.0, 0.0, 0.0),
             Cursor = Cursors.Arrow,
             Children =
             {
                 stackPanel,
                 checkBox
             }
         };
     });
     avalonEditTextOutput.WriteLine();
     foreach (IAboutPageAddition current in App.CompositionContainer.GetExportedValues<IAboutPageAddition>())
     {
         current.Write(avalonEditTextOutput);
     }
     avalonEditTextOutput.WriteLine();
     using (Stream manifestResourceStream = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt"))
     {
         using (StreamReader streamReader = new StreamReader(manifestResourceStream))
         {
             string text;
             while ((text = streamReader.ReadLine()) != null)
             {
                 avalonEditTextOutput.WriteLine(text);
             }
         }
     }
     avalonEditTextOutput.AddVisualLineElementGenerator(new AboutPage.MyLinkElementGenerator("SharpDevelop", "http://www.icsharpcode.net/opensource/sd/"));
     avalonEditTextOutput.AddVisualLineElementGenerator(new AboutPage.MyLinkElementGenerator("MIT License", "resource:license.txt"));
     avalonEditTextOutput.AddVisualLineElementGenerator(new AboutPage.MyLinkElementGenerator("LGPL", "resource:LGPL.txt"));
     avalonEditTextOutput.AddVisualLineElementGenerator(new AboutPage.MyLinkElementGenerator("iFish(木鱼)", "http://www.fishlee.net/about/"));
     textView.ShowText(avalonEditTextOutput);
     textView.manager.Bookmarks.Clear();
 }