From 2321bb23d93348a45fbdb4dedbdddf7dc9e31fc3 Mon Sep 17 00:00:00 2001 From: RedShirtMB Mark Linton redshirt linton Date: Sat, 4 Aug 2012 17:10:44 -0700 Subject: [PATCH] Added initial implimentation of splash screen Hid MainWindow Added Tray Icon --- MediaBrowser.ServerApplication/Icons/Icon.ico | Bin 0 -> 10806 bytes .../MainWindow.xaml | 16 ++++- .../MainWindow.xaml.cs | 66 ++++++++++++++++++ .../MediaBrowser.ServerApplication.csproj | 25 +++++++ .../SplashScreen.xaml | 8 +++ .../SplashScreen.xaml.cs | 29 ++++++++ 6 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 MediaBrowser.ServerApplication/Icons/Icon.ico create mode 100644 MediaBrowser.ServerApplication/SplashScreen.xaml create mode 100644 MediaBrowser.ServerApplication/SplashScreen.xaml.cs diff --git a/MediaBrowser.ServerApplication/Icons/Icon.ico b/MediaBrowser.ServerApplication/Icons/Icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..fa612891b877673cb6fae05525d073b053787957 GIT binary patch literal 10806 zcmeHN2UJy8)+RH~{4;-MChbo$#+t+wQ%z!GixG^91se(?_5vuPfMP*F5ClYu^xiv< z-Vvq4qr;;kRjObEv4JM}{(TN5K)@8qTA8(mwe~vq-uLe1`_9?l-uvwP#KfKx`;*w5 zIbt-<6bpPuOzd4TF|ik4>_0y+NldJWuDws!=qqBo$=LUP&%Y;6o^bar+k zFDnJ5MY-tf>%;H)e<$kMcW$(!wN`}Ys(c9CFCzbn07c0HG}V;;;qkXLU&E!?2o$A+ z66O$;WyNspIkBF|OpZfcUELpo!*}0(hsTc}gN=jhR$pI_io9gh6sMuNx)ANn4agB@ zpsF+<*UE(u#(5(HnNGAvTSkBPS&}F8;QLN_5|BA>E~-rYHqZ`X1r?@1Ee%{ciGyE*kIR ze)lc%i-sW%Rm7o$@Yj$pg}a-P51C<)v?OM}@YmnPfa`v^B$YWg|U6{9pG0SQj2IDA;?O7S= z$c*ztLum%h_btNSf|M%>C@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|tGZ?1Un!i_-af?fcy~5#VaedrhprKm0udJ7&F=Pkzn(PlxWeJuZ(x z^Ao(6d1Cz>-Zx`=JhrE2eagyG`b|cOi1#B|ACmQEc1SH7x?fh9tRpK2w7do z_SdWq7f|iW>TXtVv;A9Ipe27sW|-5M_fuUqHS(gmOq`>Z4Ao#VRMX1P|COOVkxX8! zrwr9rGPJ)P^Ipmmzet~hSVxb&x*-y&e-4q*doDymY{1y@n8v>M!hp>Pk + xmlns:tb="http://www.hardcodet.net/taskbar" + Title="MainWindow" Height="350" Width="525" AllowsTransparency="True" Background="Transparent" WindowStyle="None" ShowInTaskbar="False" Closing="MainWindow_Closing" Loaded="MainWindow_Loaded"> - + + + + + + + + + + + + diff --git a/MediaBrowser.ServerApplication/MainWindow.xaml.cs b/MediaBrowser.ServerApplication/MainWindow.xaml.cs index 09f98ff63..688ce19d5 100644 --- a/MediaBrowser.ServerApplication/MainWindow.xaml.cs +++ b/MediaBrowser.ServerApplication/MainWindow.xaml.cs @@ -13,6 +13,9 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using MediaBrowser.Controller; +using MediaBrowser.Model.Progress; + namespace MediaBrowser.ServerApplication { /// @@ -20,9 +23,72 @@ namespace MediaBrowser.ServerApplication /// public partial class MainWindow : Window { + protected static Kernel kernel; + public MainWindow() { InitializeComponent(); + LoadKernel(); } + + private static void LoadKernel() + { + Progress progress = new Progress(); + SplashScreen splash = new SplashScreen(progress); + + try + { + DateTime now = DateTime.Now; + + splash.Show(); + + kernel = new Kernel(); + + kernel.Init(progress); + + var time = DateTime.Now - now; + } + catch + { + } + finally + { + splash.Close(); + } + } + + #region Main Window Events + + private void MainWindow_Loaded(object sender, RoutedEventArgs e) + { + // Don't show the system tray icon until the app has loaded. + this.MbTaskbarIcon.Visibility = System.Windows.Visibility.Visible; + } + + private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + kernel.Dispose(); + } + + #endregion + + #region Context Menu events + + private void cmOpenDashboard_click(object sender, RoutedEventArgs e) + { + + } + + private void cmVisitCT_click(object sender, RoutedEventArgs e) + { + + } + + private void cmExit_click(object sender, RoutedEventArgs e) + { + this.Close(); + } + + #endregion } } diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 4b12db892..18deebfa7 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -56,6 +56,9 @@ MSBuild:Compile Designer + + SplashScreen.xaml + MSBuild:Compile Designer @@ -68,6 +71,10 @@ MainWindow.xaml Code + + Designer + MSBuild:Compile + @@ -97,6 +104,24 @@ + + + {9142eefa-7570-41e1-bfcc-468bb571af2f} + MediaBrowser.Common + + + {17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2} + MediaBrowser.Controller + + + {7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b} + MediaBrowser.Model + + + + + +