2012-09-17 18:09:35 +00:00
|
|
|
|
using Hardcodet.Wpf.TaskbarNotification;
|
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Threading;
|
2012-08-04 23:54:00 +00:00
|
|
|
|
using System.Windows;
|
2012-08-05 00:10:44 +00:00
|
|
|
|
|
2012-08-04 23:54:00 +00:00
|
|
|
|
namespace MediaBrowser.ServerApplication
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for MainWindow.xaml
|
|
|
|
|
/// </summary>
|
2012-09-17 18:09:35 +00:00
|
|
|
|
public partial class MainWindow : Window, INotifyPropertyChanged
|
2012-08-04 23:54:00 +00:00
|
|
|
|
{
|
|
|
|
|
public MainWindow()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2012-09-17 18:09:35 +00:00
|
|
|
|
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");
|
|
|
|
|
}
|
2012-08-05 00:10:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region Context Menu events
|
|
|
|
|
|
|
|
|
|
private void cmOpenDashboard_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2012-08-05 16:09:45 +00:00
|
|
|
|
App.OpenDashboard();
|
2012-08-04 23:54:00 +00:00
|
|
|
|
}
|
2012-08-05 00:10:44 +00:00
|
|
|
|
|
|
|
|
|
private void cmVisitCT_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2012-09-11 19:37:14 +00:00
|
|
|
|
App.OpenUrl("http://community.mediabrowser.tv/");
|
2012-08-05 00:10:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cmExit_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2012-08-19 22:35:45 +00:00
|
|
|
|
Close();
|
2012-08-05 00:10:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-17 18:09:35 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-05 00:10:44 +00:00
|
|
|
|
#endregion
|
2012-09-17 18:09:35 +00:00
|
|
|
|
|
2012-08-04 23:54:00 +00:00
|
|
|
|
}
|
|
|
|
|
}
|