Exemplo n.º 1
0
        public static void Display(DecompilerTextView textView)
        {
            AvaloniaEditTextOutput output = new AvaloniaEditTextOutput();

            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.Bind(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled")
                {
                    Source = settings
                });
                return(new StackPanel {
                    Margin = new Thickness(0, 4, 0, 0),
                    Cursor = Cursor.Default,
                    Children = { stackPanel, checkBox }
                });
            });
            output.WriteLine();
            foreach (var plugin in App.ExportProvider.GetExportedValues <IAboutPageAddition>())
            {
                plugin.Write(output);
            }
            output.WriteLine();
            var asm = typeof(AboutPage).Assembly;

            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"));
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MS-PL", "resource:MS-PL.txt"));
            textView.ShowText(output);
        }