/// <summary> /// Initializes a new instance of the <see cref="MainWindow" /> class. /// </summary> public MainWindow() { InitializeComponent(); ListBox.Items = this.Examples = this.GetExamples(this.GetType().Assembly).OrderBy(e => e.Title).ToArray(); this.DataContext = this; DevTools.Attach(this); }
public static void AttachDevTools(Window window) { #if DEBUG #pragma warning disable GU0011 DevTools.Attach(window); #pragma warning restore GU0011 #endif }
private static void Main(string[] args) { // The version of ReactiveUI currently included is for WPF and so expects a WPF // dispatcher. This makes sure it's initialized. System.Windows.Threading.Dispatcher foo = System.Windows.Threading.Dispatcher.CurrentDispatcher; new App(); MainWindow.RootNamespace = "TestApplication"; var wnd = MainWindow.Create(); DevTools.Attach(wnd); Application.Current.Run(wnd); }
/// <summary> /// Attaches DevTools to a window, to be opened with the F12 key. /// </summary> /// <param name="root">The window to attach DevTools to.</param> public static void AttachDevTools(this TopLevel root) { DevTools.Attach(root, new DevToolsOptions()); }
public static void AttachDevTools(Window window) { #if DEBUG DevTools.Attach(window); #endif }
private void InitializeComponent() { AvaloniaXamlLoader.Load(this); DevTools.Attach(this, KeyGesture.Parse("F12")); }
/// <summary> /// Attaches DevTools to a window, to be opened with the F12 key. /// </summary> /// <param name="root">The window to attach DevTools to.</param> public static void AttachDevTools(this TopLevel root) { DevTools.Attach(root, new KeyGesture(Key.F12)); }
public static void AttachDevTools(Window window) { #if DEBUG DevTools.Attach(window, new KeyGesture(Key.F12, KeyModifiers.Control)); #endif }
/// <summary> /// Attaches DevTools to a Application, to be opened with the specified options. /// </summary> /// <param name="application">The Application to attach DevTools to.</param> public static void AttachDevTools(this Application application) { DevTools.Attach(application, new DevToolsOptions()); }
private static void Main(string[] args) { // The version of ReactiveUI currently included is for WPF and so expects a WPF // dispatcher. This makes sure it's initialized. System.Windows.Threading.Dispatcher foo = System.Windows.Threading.Dispatcher.CurrentDispatcher; new App { DataTemplates = new DataTemplates { new FuncTreeDataTemplate <Node>( x => new TextBlock { Text = x.Name }, x => x.Children, x => true), }, }; TabControl container; Window window = new Window { Title = "Perspex Test Application", Width = 900, Height = 480, Content = new Grid { ColumnDefinitions = new ColumnDefinitions { new ColumnDefinition(1, GridUnitType.Star), new ColumnDefinition(1, GridUnitType.Star), }, RowDefinitions = new RowDefinitions { new RowDefinition(GridLength.Auto), new RowDefinition(1, GridUnitType.Star), new RowDefinition(GridLength.Auto), }, Children = new Controls { (container = new TabControl { Padding = new Thickness(5), Items = new[] { ButtonsTab(), TextTab(), HtmlTab(), ImagesTab(), ListsTab(), LayoutTab(), AnimationsTab(), }, Transition = new CrossFade(TimeSpan.FromSeconds(0.25)), [Grid.RowProperty] = 1, [Grid.ColumnSpanProperty] = 2, }) } }, }; container.Classes.Add(":container"); DevTools.Attach(window); window.Show(); Application.Current.Run(window); }
static void Main(string[] args) { //LogManager.Enable(new TestLogger()); //LogManager.Instance.LogLayoutMessages = true; App application = new App { DataTemplates = new DataTemplates { new TreeDataTemplate <Node>( x => new TextBlock { Text = x.Name }, x => x.Children, x => true), }, }; TextBlock fps; Window window = new Window { Title = "Perspex Test Application", Content = new Grid { ColumnDefinitions = new ColumnDefinitions { new ColumnDefinition(1, GridUnitType.Star), new ColumnDefinition(1, GridUnitType.Star), }, RowDefinitions = new RowDefinitions { new RowDefinition(1, GridUnitType.Star), new RowDefinition(GridLength.Auto), }, Children = new Controls { new TabControl { Items = new[] { ButtonsTab(), TextTab(), ImagesTab(), ListsTab(), SlidersTab(), LayoutTab(), AnimationsTab(), }, [Grid.ColumnSpanProperty] = 2, }, (fps = new TextBlock { HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(2), [Grid.RowProperty] = 1, }), new TextBlock { Text = "Press F12 for Dev Tools", HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(2), [Grid.ColumnProperty] = 1, [Grid.RowProperty] = 1, }, } }, }; DevTools.Attach(window); var renderer = ((IRenderRoot)window).Renderer; var last = renderer.RenderCount; DispatcherTimer.Run(() => { fps.Text = "FPS: " + (renderer.RenderCount - last); last = renderer.RenderCount; return(true); }, TimeSpan.FromSeconds(1)); window.Show(); Application.Current.Run(window); }
private static void Main(string[] args) { //Log.Logger = new LoggerConfiguration() // .Filter.ByIncludingOnly(Matching.WithProperty("Area", "Layout")) // .MinimumLevel.Verbose() // .WriteTo.Trace(outputTemplate: "[{Id:X8}] [{SourceContext}] {Message}") // .CreateLogger(); // The version of ReactiveUI currently included is for WPF and so expects a WPF // dispatcher. This makes sure it's initialized. System.Windows.Threading.Dispatcher foo = System.Windows.Threading.Dispatcher.CurrentDispatcher; App application = new App { DataTemplates = new DataTemplates { new TreeDataTemplate <Node>( x => new TextBlock { Text = x.Name }, x => x.Children, x => true), }, }; TextBlock fps; var testCommand = ReactiveCommand.Create(); testCommand.Subscribe(_ => System.Diagnostics.Debug.WriteLine("Test command executed.")); Window window = new Window { Title = "Perspex Test Application", SizeToContent = SizeToContent.WidthAndHeight, Content = new Grid { ColumnDefinitions = new ColumnDefinitions { new ColumnDefinition(1, GridUnitType.Star), new ColumnDefinition(1, GridUnitType.Star), }, RowDefinitions = new RowDefinitions { new RowDefinition(GridLength.Auto), new RowDefinition(1, GridUnitType.Star), new RowDefinition(GridLength.Auto), }, Children = new Controls { new Menu { Items = new[] { new MenuItem { Header = "_File", Items = new[] { new MenuItem { Header = "_Open...", Icon = new Image { Source = new Bitmap("github_icon.png"), }, }, new MenuItem { Header = "_Save", Items = new[] { new MenuItem { Header = "Sub Item _1", }, new MenuItem { Header = "Sub Item _2", }, } }, new MenuItem { Header = "Save _As", Items = new[] { new MenuItem { Header = "Sub Item _1", }, new MenuItem { Header = "Sub Item _2", }, } }, new MenuItem { Header = "E_xit", Command = testCommand, }, } }, new MenuItem { Header = "_Edit", Items = new[] { new MenuItem { Header = "Cu_t", }, new MenuItem { Header = "_Copy", }, new MenuItem { Header = "_Paste", }, } } }, [Grid.ColumnSpanProperty] = 2, }, new TabControl { Items = new[] { ButtonsTab(), TextTab(), HtmlTab(), ImagesTab(), ListsTab(), LayoutTab(), AnimationsTab(), }, Transition = new PageSlide(TimeSpan.FromSeconds(0.25)), [Grid.RowProperty] = 1, [Grid.ColumnSpanProperty] = 2, }, (fps = new TextBlock { HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(2), [Grid.RowProperty] = 2, }), new TextBlock { Text = "Press F12 for Dev Tools", HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(2), [Grid.ColumnProperty] = 1, [Grid.RowProperty] = 2, }, } }, }; DevTools.Attach(window); //var renderer = ((IRenderRoot)window).Renderer; //var last = renderer.RenderCount; //DispatcherTimer.Run(() => //{ // fps.Text = "FPS: " + (renderer.RenderCount - last); // last = renderer.RenderCount; // return true; //}, TimeSpan.FromSeconds(1)); window.Show(); Application.Current.Run(window); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow" /> class. /// </summary> public MainWindow() { InitializeComponent(); DevTools.Attach(this); }
/// <summary> /// Attaches DevTools to a window, to be opened with the specified key gesture. /// </summary> /// <param name="root">The window to attach DevTools to.</param> /// <param name="gesture">The key gesture to open DevTools.</param> public static void AttachDevTools(this TopLevel root, KeyGesture gesture) { DevTools.Attach(root, gesture); }
public MainWindow() { InitializeComponent(); DataContext = new MainWindowViewModel(); DevTools.Attach(this); }
/// <summary> /// Attaches DevTools to a window, to be opened with the specified options. /// </summary> /// <param name="root">The window to attach DevTools to.</param> /// <param name="options">Additional settings of DevTools.</param> public static void AttachDevTools(this TopLevel root, DevToolsOptions options) { DevTools.Attach(root, options); }
public static void AttachDevTools(Window window) { DevTools.Attach(window); }
/// <summary> /// Attaches DevTools to a Application, to be opened with the specified options. /// </summary> /// <param name="application">The Application to attach DevTools to.</param> /// <param name="options">Additional settings of DevTools.</param> /// <remarks> /// Attach DevTools should only be called after application initialization is complete. A good point is <see cref="Application.OnFrameworkInitializationCompleted"/> /// </remarks> /// <example> /// <code> /// public class App : Application /// { /// public override void OnFrameworkInitializationCompleted() /// { /// if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime) /// { /// desktopLifetime.MainWindow = new MainWindow(); /// } /// else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewLifetime) /// singleViewLifetime.MainView = new MainView(); /// /// base.OnFrameworkInitializationCompleted(); /// this.AttachDevTools(new Avalonia.Diagnostics.DevToolsOptions() /// { /// StartupScreenIndex = 1, /// }); /// } /// } /// </code> /// </example> public static void AttachDevTools(this Application application, DevToolsOptions options) { DevTools.Attach(application, options); }
public static void AttachDevTools(Window window) { DevTools.Attach(window, KeyGesture.Parse("CTRL+F12")); }