From fb88e4d5fcd02ada0999a09b68a49617f4a35309 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Mon, 17 Sep 2012 14:09:35 -0400 Subject: Added the ability to reload the server and created a Plugins solution --- MediaBrowser.ServerApplication/MainWindow.xaml | 25 +++++++- MediaBrowser.ServerApplication/MainWindow.xaml.cs | 65 ++++++++++++++++++++- .../MediaBrowser.ServerApplication.csproj | 9 +-- .../Resources/Images/Icon.ico | Bin 32038 -> 146168 bytes .../Resources/Images/icon16.ico | Bin 1150 -> 0 bytes .../Resources/Images/loadingIcon1-16.ico | Bin 1150 -> 0 bytes .../Resources/Images/loadingIcon1.ico | Bin 0 -> 179144 bytes .../Resources/Images/loadingIcon2-16.ico | Bin 1150 -> 0 bytes .../Resources/Images/loadingIcon2.ico | Bin 0 -> 176716 bytes .../Resources/Images/loadingIcon3.ico | Bin 0 -> 175427 bytes .../Resources/Images/loadingIcon4.ico | Bin 0 -> 176666 bytes 11 files changed, 90 insertions(+), 9 deletions(-) delete mode 100644 MediaBrowser.ServerApplication/Resources/Images/icon16.ico delete mode 100644 MediaBrowser.ServerApplication/Resources/Images/loadingIcon1-16.ico create mode 100644 MediaBrowser.ServerApplication/Resources/Images/loadingIcon1.ico delete mode 100644 MediaBrowser.ServerApplication/Resources/Images/loadingIcon2-16.ico create mode 100644 MediaBrowser.ServerApplication/Resources/Images/loadingIcon2.ico create mode 100644 MediaBrowser.ServerApplication/Resources/Images/loadingIcon3.ico create mode 100644 MediaBrowser.ServerApplication/Resources/Images/loadingIcon4.ico (limited to 'MediaBrowser.ServerApplication') diff --git a/MediaBrowser.ServerApplication/MainWindow.xaml b/MediaBrowser.ServerApplication/MainWindow.xaml index e5c8487520..ade1caee92 100644 --- a/MediaBrowser.ServerApplication/MainWindow.xaml +++ b/MediaBrowser.ServerApplication/MainWindow.xaml @@ -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"> - + + - + + + + + diff --git a/MediaBrowser.ServerApplication/MainWindow.xaml.cs b/MediaBrowser.ServerApplication/MainWindow.xaml.cs index 04da97a2b2..3839dc52e2 100644 --- a/MediaBrowser.ServerApplication/MainWindow.xaml.cs +++ b/MediaBrowser.ServerApplication/MainWindow.xaml.cs @@ -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 /// /// Interaction logic for MainWindow.xaml /// - 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 + } } diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 4843f024a5..de20c9256c 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -122,14 +122,15 @@ - + - + + - - + +