Added the ability to reload the server and created a Plugins solution

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti
2012-09-17 14:09:35 -04:00
parent f1770605ea
commit fb88e4d5fc
27 changed files with 707 additions and 68 deletions

View File

@@ -4,16 +4,37 @@
xmlns:tb="http://www.hardcodet.net/taskbar"
Title="MainWindow" Height="350" Width="525" AllowsTransparency="True" Background="Transparent" WindowStyle="None" ShowInTaskbar="False">
<Grid>
<tb:TaskbarIcon Name="MbTaskbarIcon" IconSource="/Resources/Images/Icon.ico" ToolTipText="MediaBrowser Server">
<tb:TaskbarIcon Name="MbTaskbarIcon" ToolTipText="MediaBrowser Server">
<tb:TaskbarIcon.ContextMenu>
<ContextMenu Background="White">
<MenuItem Name="cmOpenDashboard" Header="Open Dashboard" Click="cmOpenDashboard_click"/>
<MenuItem Name="cmdReloadServer" Header="Reload Server" Click="cmdReloadServer_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.ContextMenu>
<tb:TaskbarIcon.Style>
<Style TargetType="{x:Type tb:TaskbarIcon}">
<Setter Property="IconSource" Value="/Resources/Images/icon.ico" />
<Style.Triggers>
<DataTrigger Binding="{Binding LoadingImageIndex}" Value="1">
<Setter Property="IconSource" Value="/Resources/Images/loadingIcon1.ico" />
</DataTrigger>
<DataTrigger Binding="{Binding LoadingImageIndex}" Value="2">
<Setter Property="IconSource" Value="/Resources/Images/loadingIcon2.ico" />
</DataTrigger>
<DataTrigger Binding="{Binding LoadingImageIndex}" Value="3">
<Setter Property="IconSource" Value="/Resources/Images/loadingIcon3.ico" />
</DataTrigger>
<DataTrigger Binding="{Binding LoadingImageIndex}" Value="4">
<Setter Property="IconSource" Value="/Resources/Images/loadingIcon4.ico" />
</DataTrigger>
</Style.Triggers>
</Style>
</tb:TaskbarIcon.Style>
</tb:TaskbarIcon>
</Grid>

View File

@@ -1,4 +1,7 @@
using System.Diagnostics;
using Hardcodet.Wpf.TaskbarNotification;
using System;
using System.ComponentModel;
using System.Threading;
using System.Windows;
namespace MediaBrowser.ServerApplication
@@ -6,12 +9,38 @@ namespace MediaBrowser.ServerApplication
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
public partial class MainWindow : Window, INotifyPropertyChanged
{
public MainWindow()
{
InitializeComponent();
//LoadKernel();
Loaded += MainWindow_Loaded;
}
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
DataContext = this;
}
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(String info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
private int _loadingImageIndex;
public int LoadingImageIndex
{
get { return _loadingImageIndex; }
set
{
_loadingImageIndex = value;
OnPropertyChanged("LoadingImageIndex");
}
}
#region Context Menu events
@@ -31,6 +60,36 @@ namespace MediaBrowser.ServerApplication
Close();
}
private async void cmdReloadServer_click(object sender, RoutedEventArgs e)
{
MbTaskbarIcon.ShowBalloonTip("Media Browser is reloading", "Please wait...", BalloonIcon.Info);
LoadingImageIndex = 0;
Timer timer = new Timer(LoadingIconTimerCallback, null, 0, 250);
await (Application.Current as App).ReloadKernel().ConfigureAwait(false);
timer.Dispose();
LoadingImageIndex = 0;
}
private void LoadingIconTimerCallback(object stateInfo)
{
const int numImages = 4;
if (LoadingImageIndex < numImages)
{
LoadingImageIndex++;
}
else
{
LoadingImageIndex = 1;
}
}
#endregion
}
}

View File

@@ -121,15 +121,16 @@
<Name>MediaBrowser.Model</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\icon16.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\icon.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\loadingIcon1-16.ico" />
<Resource Include="Resources\Images\loadingIcon2-16.ico" />
<Resource Include="Resources\Images\loadingIcon1.ico" />
<Resource Include="Resources\Images\loadingIcon2.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\loadingIcon3.ico" />
<Resource Include="Resources\Images\loadingIcon4.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.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB