Added initial implimentation of splash screen

Hid MainWindow
Added Tray Icon
This commit is contained in:
RedShirtMB Mark Linton redshirt linton 2012-08-04 17:10:44 -07:00
parent bf0c6ec182
commit 2321bb23d9
6 changed files with 142 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,8 +1,20 @@
<Window x:Class="MediaBrowser.ServerApplication.MainWindow" <Window x:Class="MediaBrowser.ServerApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 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> <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> </Grid>
</Window> </Window>

View File

@ -13,6 +13,9 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using MediaBrowser.Controller;
using MediaBrowser.Model.Progress;
namespace MediaBrowser.ServerApplication namespace MediaBrowser.ServerApplication
{ {
/// <summary> /// <summary>
@ -20,9 +23,72 @@ namespace MediaBrowser.ServerApplication
/// </summary> /// </summary>
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
protected static Kernel kernel;
public MainWindow() public MainWindow()
{ {
InitializeComponent(); 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
} }
} }

View File

@ -56,6 +56,9 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="SplashScreen.xaml.cs">
<DependentUpon>SplashScreen.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml"> <Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@ -68,6 +71,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon> <DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Page Include="SplashScreen.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
@ -97,6 +104,24 @@
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </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" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -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>

View File

@ -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();
}
}
}