using ProgramLib.GUI.ViewModel;
using System;
using System.Windows;
using System.Windows.Media.Imaging;

namespace ProgramLib.GUI.View
{
   /// <summary>
   /// Interaction logic for MainWindow.xaml
   /// </summary>
   internal partial class LiveDataWindow : Window
   {
      internal LiveDataWindowViewModel LiveDataWindowViewModel { get; set; }

      public LiveDataWindow()
      {
         InitializeComponent();

         Uri iconUri = new Uri("pack://application:,,,/Program;component/Resources/Icons/app.ico");
         this.Icon = BitmapFrame.Create(iconUri);

         WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

         LiveDataWindowViewModel = new LiveDataWindowViewModel(this);
         DataContext = LiveDataWindowViewModel;
      }

      private void btnClose_Click(object sender, RoutedEventArgs e)
      {
         this.Hide();
      }

      private void btnMax_Click(object sender, RoutedEventArgs e)
      {
         if (this.WindowState == WindowState.Maximized)
         {
            this.WindowState = WindowState.Normal;
            imgMax.Source = new BitmapImage(new System.Uri("pack://application:,,,/Resources/Images/Title_Bar_Buttons/maximize.png"));
         }
         else
         {
            this.WindowState = WindowState.Maximized;
            imgMax.Source = new BitmapImage(new System.Uri("pack://application:,,,/Resources/Images/Title_Bar_Buttons/restore.png"));
         }
      }

      private void btnMin_Click(object sender, RoutedEventArgs e)
      {
         this.WindowState = WindowState.Minimized;
      }

      private void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
      {
         DragMove();
      }
   }
}
