diff --git a/samples/TestApplication/Program.cs b/samples/TestApplication/Program.cs index e73850b123..7aa433bfa8 100644 --- a/samples/TestApplication/Program.cs +++ b/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); diff --git a/samples/TestApplication/TestApplication.csproj b/samples/TestApplication/TestApplication.csproj index 887b3f3bfe..86397361e1 100644 --- a/samples/TestApplication/TestApplication.csproj +++ b/samples/TestApplication/TestApplication.csproj @@ -145,14 +145,6 @@ Perspex.Win32 - - - PreserveNewest - - - PreserveNewest - - diff --git a/samples/TestApplicationShared/MainWindow.cs b/samples/TestApplicationShared/MainWindow.cs index dff976f8cb..5df09b0d03 100644 --- a/samples/TestApplicationShared/MainWindow.cs +++ b/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().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, }, diff --git a/samples/TestApplicationShared/TestApplicationShared.projitems b/samples/TestApplicationShared/TestApplicationShared.projitems index 97ca2698b5..cfdaf6ee1f 100644 --- a/samples/TestApplicationShared/TestApplicationShared.projitems +++ b/samples/TestApplicationShared/TestApplicationShared.projitems @@ -18,4 +18,12 @@ + + + Never + + + Never + + \ No newline at end of file diff --git a/samples/TestApplication/github_icon.png b/samples/TestApplicationShared/github_icon.png similarity index 100% rename from samples/TestApplication/github_icon.png rename to samples/TestApplicationShared/github_icon.png diff --git a/samples/TestApplication/pattern.jpg b/samples/TestApplicationShared/pattern.jpg similarity index 100% rename from samples/TestApplication/pattern.jpg rename to samples/TestApplicationShared/pattern.jpg