Browse Source

Make devtools work again.

pull/10/head
Steven Kirk 11 years ago
parent
commit
7617bbe765
  1. 24
      Perspex.Diagnostics/DevTools.cs
  2. 2
      TestApplication/Program.cs

24
Perspex.Diagnostics/DevTools.cs

@ -10,6 +10,8 @@ namespace Perspex.Diagnostics
using System.Reactive.Linq;
using Perspex.Diagnostics.ViewModels;
using System;
using Perspex.Input;
using System.Reactive.Disposables;
public class DevTools : Decorator
{
@ -79,6 +81,28 @@ namespace Perspex.Diagnostics
set { this.SetValue(RootProperty, value); }
}
public static IDisposable Attach(Window w)
{
w.PreviewKeyDown += WindowPreviewKeyDown;
return Disposable.Create(() => w.PreviewKeyDown -= WindowPreviewKeyDown);
}
private static void WindowPreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.F12)
{
Window window = new Window
{
Content = new DevTools
{
Root = (Window)sender,
},
};
window.Show();
}
}
private static Control CreateDetailsView(ControlDetails i)
{
return new ItemsControl

2
TestApplication/Program.cs

@ -138,6 +138,8 @@ namespace TestApplication
},
};
DevTools.Attach(window);
window.Show();
Application.Current.Run(window);
}

Loading…
Cancel
Save