aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication/MainWindow.xaml.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.ServerApplication/MainWindow.xaml.cs')
-rw-r--r--MediaBrowser.ServerApplication/MainWindow.xaml.cs69
1 files changed, 63 insertions, 6 deletions
diff --git a/MediaBrowser.ServerApplication/MainWindow.xaml.cs b/MediaBrowser.ServerApplication/MainWindow.xaml.cs
index 2e087a791..3839dc52e 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
/// <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
@@ -23,9 +52,7 @@ namespace MediaBrowser.ServerApplication
private void cmVisitCT_click(object sender, RoutedEventArgs e)
{
- using (Process process = Process.Start("http://community.mediabrowser.tv/"))
- {
- }
+ App.OpenUrl("http://community.mediabrowser.tv/");
}
private void cmExit_click(object sender, RoutedEventArgs e)
@@ -33,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
+
}
}