diff options
| author | RedShirtMB Mark Linton redshirt linton <RedShirtMB Mark Linton redshirt.linton@gmail.com> | 2012-08-04 17:10:44 -0700 |
|---|---|---|
| committer | RedShirtMB Mark Linton redshirt linton <RedShirtMB Mark Linton redshirt.linton@gmail.com> | 2012-08-04 17:10:44 -0700 |
| commit | 2321bb23d93348a45fbdb4dedbdddf7dc9e31fc3 (patch) | |
| tree | 3ab50eb95650bda8e75e8ae43c74f3636cbabd91 | |
| parent | bf0c6ec182134cb2b13ac8ffabc6e1d6397c61e6 (diff) | |
Added initial implimentation of splash screen
Hid MainWindow
Added Tray Icon
| -rw-r--r-- | MediaBrowser.ServerApplication/Icons/Icon.ico | bin | 0 -> 10806 bytes | |||
| -rw-r--r-- | MediaBrowser.ServerApplication/MainWindow.xaml | 16 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/MainWindow.xaml.cs | 66 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj | 25 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/SplashScreen.xaml | 8 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/SplashScreen.xaml.cs | 29 |
6 files changed, 142 insertions, 2 deletions
diff --git a/MediaBrowser.ServerApplication/Icons/Icon.ico b/MediaBrowser.ServerApplication/Icons/Icon.ico Binary files differnew file mode 100644 index 000000000..fa612891b --- /dev/null +++ b/MediaBrowser.ServerApplication/Icons/Icon.ico diff --git a/MediaBrowser.ServerApplication/MainWindow.xaml b/MediaBrowser.ServerApplication/MainWindow.xaml index 71b28937e..9b851fae3 100644 --- a/MediaBrowser.ServerApplication/MainWindow.xaml +++ b/MediaBrowser.ServerApplication/MainWindow.xaml @@ -1,8 +1,20 @@ <Window x:Class="MediaBrowser.ServerApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- Title="MainWindow" Height="350" Width="525">
+ 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">
<Grid>
-
+ <tb:TaskbarIcon Name="MbTaskbarIcon" IconSource="/Icons/Icon.ico" ToolTipText="MediaBrowser Server" Visibility="Hidden">
+
+ <tb:TaskbarIcon.ContextMenu>
+ <ContextMenu Background="White">
+ <MenuItem Name="cmOpenDashboard" Header="Open Dashboard" Click="cmOpenDashboard_click"/>
+ <MenuItem Name="cmVisitCT" Header="Visit Community Tracker" Click="cmVisitCT_click"/>
+ <Separator/>
+ <MenuItem Name="cmExit" Header="Exit" Click="cmExit_click"/>
+ </ContextMenu>
+ </tb:TaskbarIcon.ContextMenu>
+
+ </tb:TaskbarIcon>
</Grid>
</Window>
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
{
/// <summary>
@@ -20,9 +23,72 @@ namespace MediaBrowser.ServerApplication /// </summary>
public partial class MainWindow : Window
{
+ protected static Kernel kernel;
+
public MainWindow()
{
InitializeComponent();
+ LoadKernel();
+ }
+
+ private static void LoadKernel()
+ {
+ Progress<TaskProgress> progress = new Progress<TaskProgress>();
+ 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 @@ <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
+ <Compile Include="SplashScreen.xaml.cs">
+ <DependentUpon>SplashScreen.xaml</DependentUpon>
+ </Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -68,6 +71,10 @@ <DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
+ <Page Include="SplashScreen.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@@ -97,6 +104,24 @@ <ItemGroup>
<None Include="App.config" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
+ <Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project>
+ <Name>MediaBrowser.Common</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj">
+ <Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project>
+ <Name>MediaBrowser.Controller</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
+ <Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
+ <Name>MediaBrowser.Model</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup />
+ <ItemGroup>
+ <Resource Include="Icons\Icon.ico" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/MediaBrowser.ServerApplication/SplashScreen.xaml b/MediaBrowser.ServerApplication/SplashScreen.xaml new file mode 100644 index 000000000..c5dcbab61 --- /dev/null +++ b/MediaBrowser.ServerApplication/SplashScreen.xaml @@ -0,0 +1,8 @@ +<Window x:Class="MediaBrowser.ServerApplication.SplashScreen"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Title="SplashScreen" Height="300" Width="600">
+ <Grid>
+
+ </Grid>
+</Window>
diff --git a/MediaBrowser.ServerApplication/SplashScreen.xaml.cs b/MediaBrowser.ServerApplication/SplashScreen.xaml.cs new file mode 100644 index 000000000..03bfb8eab --- /dev/null +++ b/MediaBrowser.ServerApplication/SplashScreen.xaml.cs @@ -0,0 +1,29 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+using MediaBrowser.Model.Progress;
+
+namespace MediaBrowser.ServerApplication
+{
+ /// <summary>
+ /// Interaction logic for SplashScreen.xaml
+ /// </summary>
+ public partial class SplashScreen : Window
+ {
+ public SplashScreen(IProgress<TaskProgress> progress)
+ {
+ InitializeComponent();
+ }
+ }
+}
|
