Browse Source

testapp refactoring

pull/327/head
Nikita Tsukanov 11 years ago
parent
commit
30ebe5d148
  1. 1
      samples/TestApplication/Program.cs
  2. 8
      samples/TestApplication/TestApplication.csproj
  3. 16
      samples/TestApplicationShared/MainWindow.cs
  4. 8
      samples/TestApplicationShared/TestApplicationShared.projitems
  5. 0
      samples/TestApplicationShared/github_icon.png
  6. 0
      samples/TestApplicationShared/pattern.jpg

1
samples/TestApplication/Program.cs

@ -32,6 +32,7 @@ namespace TestApplication
// 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);

8
samples/TestApplication/TestApplication.csproj

@ -145,14 +145,6 @@
<Name>Perspex.Win32</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="github_icon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="pattern.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="..\TestApplicationShared\TestApplicationShared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\src\Shared\perspex.platform.targets" />

16
samples/TestApplicationShared/MainWindow.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reactive.Linq;
using System.Text;
using Perspex;
@ -14,6 +15,7 @@ using Perspex.Diagnostics;
using Perspex.Layout;
using Perspex.Media;
using Perspex.Media.Imaging;
using Perspex.Platform;
using TestApplication;
namespace TestApplication
@ -367,6 +369,12 @@ namespace TestApplication
};
}
public static string RootNamespace;
static Stream GetImage(string path)
{
return PerspexLocator.Current.GetService<IAssetLoader>().Open(new Uri("res:///" + RootNamespace + "." + path));
}
private static TabItem ListsTab()
{
@ -392,7 +400,7 @@ namespace TestApplication
Orientation = Orientation.Horizontal,
Children = new Controls
{
new Image { Width = 50, Height = 50, Source = new Bitmap("github_icon.png") },
new Image { Width = 50, Height = 50, Source = new Bitmap(GetImage("github_icon.png")) },
new TextBlock { Text = x.Name, FontSize = 18 }
}
})
@ -458,8 +466,8 @@ namespace TestApplication
Transition = new PageSlide(TimeSpan.FromSeconds(0.25)),
Items = new[]
{
new Image { Source = new Bitmap("github_icon.png"), Width = 400, Height = 400 },
new Image { Source = new Bitmap("pattern.jpg"), Width = 400, Height = 400 },
new Image { Source = new Bitmap(GetImage("github_icon.png")), Width = 400, Height = 400 },
new Image { Source = new Bitmap(GetImage("pattern.jpg")), Width = 400, Height = 400 },
}
};
@ -773,7 +781,7 @@ namespace TestApplication
Background = Brushes.Coral,
Child = new Image
{
Source = new Bitmap("github_icon.png"),
Source = new Bitmap(GetImage("github_icon.png")),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
},

8
samples/TestApplicationShared/TestApplicationShared.projitems

@ -18,4 +18,12 @@
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)html.htm" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)github_icon.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)pattern.jpg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
</Project>

0
samples/TestApplication/github_icon.png → samples/TestApplicationShared/github_icon.png

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

0
samples/TestApplication/pattern.jpg → samples/TestApplicationShared/pattern.jpg

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

Loading…
Cancel
Save