소스 검색

Added a method in BaseApplication to get the logo image

LukePulverenti Luke Pulverenti luke pulverenti 12 년 전
부모
커밋
ee91096eb0

+ 1 - 1
MediaBrowser.Common/MediaBrowser.Common.csproj

@@ -132,7 +132,7 @@
     </EmbeddedResource>
   </ItemGroup>
   <ItemGroup>
-    <Resource Include="Resources\mblogo.png" />
+    <EmbeddedResource Include="Resources\mblogo.png" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 17 - 0
MediaBrowser.Common/UI/BaseApplication.cs

@@ -1,9 +1,13 @@
 using System;
+using System.IO;
 using System.Threading.Tasks;
 using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media.Imaging;
 using MediaBrowser.Common.Kernel;
 using MediaBrowser.Common.Logging;
 using MediaBrowser.Model.Progress;
+using System.Reflection;
 
 namespace MediaBrowser.Common.UI
 {
@@ -67,5 +71,18 @@ namespace MediaBrowser.Common.UI
 
             Kernel.Dispose();
         }
+
+        public BitmapImage GetLogoImage()
+        {
+            BitmapImage bitmap = new BitmapImage();
+
+            bitmap.CacheOption = BitmapCacheOption.Default;
+
+            bitmap.BeginInit();
+            bitmap.StreamSource = Assembly.GetExecutingAssembly().GetManifestResourceStream("MediaBrowser.Common.Resources.mblogo.png");
+            bitmap.EndInit();
+
+            return bitmap;
+        }
     }
 }

+ 1 - 1
MediaBrowser.Common/UI/Splash.xaml

@@ -17,7 +17,7 @@
         </RadialGradientBrush>
     </Window.Background>
     <Grid Name="splashGrid">
-        <Image HorizontalAlignment="Left" VerticalAlignment="Top" Source="/MediaBrowser.Common;component/Resources/mblogo.png" Stretch="Uniform" Grid.Row="0" Margin="10 10 10 10"/>
+        <Image x:Name="imgLogo" HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="Uniform" Grid.Row="0" Margin="10 10 10 10"/>
         <ProgressBar Name="pbProgress" Minimum="0" Maximum="100" HorizontalAlignment="Left" Height="24" Margin="30,110,30,0" Width="460" Grid.Row="1"/>
         <Label Name="lblProgress" Content="Label" Margin="0,190,10,0" VerticalContentAlignment="Center" HorizontalAlignment="Center" Grid.Row="2"/>
     </Grid>

+ 2 - 0
MediaBrowser.Common/UI/Splash.xaml.cs

@@ -35,6 +35,8 @@ namespace MediaBrowser.Common.UI
         {
             // Setting this in markup throws an exception at runtime
             ShowTitleBar = false;
+
+            imgLogo.Source = (Application.Current as BaseApplication).GetLogoImage();
         }
     }
 }