Browse Source

Cleaning up TestApplication

pull/156/head
Nelson Carrillo 11 years ago
parent
commit
13c3f00b87
  1. 8
      samples/TestApplication/Item.cs
  2. 16
      samples/TestApplication/Node.cs
  3. 136
      samples/TestApplication/Program.cs
  4. 2
      samples/TestApplication/TestApplication.csproj

8
samples/TestApplication/Item.cs

@ -0,0 +1,8 @@
namespace TestApplication
{
internal class Item
{
public string Name { get; set; }
public string Value { get; set; }
}
}

16
samples/TestApplication/Node.cs

@ -0,0 +1,16 @@
using Perspex.Collections;
namespace TestApplication
{
internal class Node
{
public Node()
{
Children = new PerspexList<Node>();
}
public string Name { get; set; }
public PerspexList<Node> Children { get; set; }
}
}

136
samples/TestApplication/Program.cs

@ -23,23 +23,6 @@ using ReactiveUI;
namespace TestApplication namespace TestApplication
{ {
internal class Item
{
public string Name { get; set; }
public string Value { get; set; }
}
internal class Node
{
public Node()
{
Children = new PerspexList<Node>();
}
public string Name { get; set; }
public PerspexList<Node> Children { get; set; }
}
internal class Program internal class Program
{ {
private static readonly PerspexList<Node> s_treeData = new PerspexList<Node> private static readonly PerspexList<Node> s_treeData = new PerspexList<Node>
@ -94,12 +77,6 @@ namespace TestApplication
private static void Main(string[] args) 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 // The version of ReactiveUI currently included is for WPF and so expects a WPF
// dispatcher. This makes sure it's initialized. // dispatcher. This makes sure it's initialized.
System.Windows.Threading.Dispatcher foo = System.Windows.Threading.Dispatcher.CurrentDispatcher; System.Windows.Threading.Dispatcher foo = System.Windows.Threading.Dispatcher.CurrentDispatcher;
@ -120,10 +97,13 @@ namespace TestApplication
var testCommand = ReactiveCommand.Create(); var testCommand = ReactiveCommand.Create();
testCommand.Subscribe(_ => System.Diagnostics.Debug.WriteLine("Test command executed.")); testCommand.Subscribe(_ => System.Diagnostics.Debug.WriteLine("Test command executed."));
TabControl container;
Window window = new Window Window window = new Window
{ {
Title = "Perspex Test Application", Title = "Perspex Test Application",
SizeToContent = SizeToContent.WidthAndHeight, Width = 800,
Height = 300,
Content = new Grid Content = new Grid
{ {
ColumnDefinitions = new ColumnDefinitions ColumnDefinitions = new ColumnDefinitions
@ -139,84 +119,9 @@ namespace TestApplication
}, },
Children = new Controls Children = new Controls
{ {
new Menu (container = new TabControl
{
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
{ {
Padding = new Thickness(5),
Items = new[] Items = new[]
{ {
ButtonsTab(), ButtonsTab(),
@ -227,38 +132,15 @@ namespace TestApplication
LayoutTab(), LayoutTab(),
AnimationsTab(), AnimationsTab(),
}, },
Transition = new PageSlide(TimeSpan.FromSeconds(0.25)), Transition = new CrossFade(TimeSpan.FromSeconds(0.25)),
[Grid.RowProperty] = 1, [Grid.RowProperty] = 1,
[Grid.ColumnSpanProperty] = 2, [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); container.Classes.Add(":container");
//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(); window.Show();
Application.Current.Run(window); Application.Current.Run(window);

2
samples/TestApplication/TestApplication.csproj

@ -73,6 +73,8 @@
<ItemGroup> <ItemGroup>
<Compile Include="App.cs" /> <Compile Include="App.cs" />
<Compile Include="GalleryStyle.cs" /> <Compile Include="GalleryStyle.cs" />
<Compile Include="Item.cs" />
<Compile Include="Node.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>

Loading…
Cancel
Save