//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//
// UserWin satellite library | Author: Sergei Y.Kitáev
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Security.Permissions;

using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;

using CommonHelpers;

namespace UserWin {

//**************************************************************************************************
partial class UXWindow: Window {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

protected override void OnPreviewKeyDown(KeyEventArgs e)
{
   if ( IsBusy && BlockKeyboardInputWhenBusy )
      e.Handled = true;
   else
      base.OnPreviewKeyDown( e );
}

protected override void OnPreviewKeyUp(KeyEventArgs e)
{
   if ( IsBusy && BlockKeyboardInputWhenBusy )
      e.Handled = true;
   else
      base.OnPreviewKeyUp( e );
}

//==================================================================================================

protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
{
   if ( IsBusy && BlockMouseInputWhenBusy )
      e.Handled = true;
   else
      base.OnPreviewMouseLeftButtonDown( e );
}

protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e)
{
   if ( IsBusy && BlockMouseInputWhenBusy )
      e.Handled = true;
   else
      base.OnPreviewMouseLeftButtonUp( e );
}

//--------------------------------------------------------------------------------------------------

protected override void OnPreviewMouseRightButtonDown(MouseButtonEventArgs e)
{
   if ( IsBusy && BlockMouseInputWhenBusy )
      e.Handled = true;
   else
      base.OnPreviewMouseRightButtonDown( e );
}

protected override void OnPreviewMouseRightButtonUp(MouseButtonEventArgs e)
{
   if ( IsBusy && BlockMouseInputWhenBusy )
      e.Handled = true;
   else
      base.OnPreviewMouseRightButtonUp( e );
}

//--------------------------------------------------------------------------------------------------

protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
{
   if ( IsBusy && BlockMouseInputWhenBusy )
      e.Handled = true;
   else
      base.OnPreviewMouseDown( e );
}

protected override void OnPreviewMouseUp(MouseButtonEventArgs e)
{
   if ( IsBusy && BlockMouseInputWhenBusy )
      e.Handled = true;
   else
      base.OnPreviewMouseUp( e );
}

//--------------------------------------------------------------------------------------------------

protected override void OnPreviewMouseDoubleClick(MouseButtonEventArgs e)
{
   if ( IsBusy && BlockMouseInputWhenBusy )
      e.Handled = true;
   else
      base.OnPreviewMouseDoubleClick( e );
}

protected override void OnPreviewMouseMove(MouseEventArgs e)
{
   if ( IsBusy && BlockMouseInputWhenBusy )
      e.Handled = true;
   else
      base.OnPreviewMouseMove( e );
}

protected override void OnPreviewMouseWheel(MouseWheelEventArgs e)
{
   if ( IsBusy && BlockMouseInputWhenBusy )
      e.Handled = true;
   else
      base.OnPreviewMouseWheel( e );
}

//==================================================================================================

protected override void OnClosing(CancelEventArgs e)
{
   if ( CancelClosing( this ) )
      e.Cancel = true;
   else
      base.OnClosing( e );
}

//==================================================================================================

void Window_IsBusyChanged(object sender,RoutedPropertyChangedEventArgs<bool> e)
{
   UpdateSystemMenuCloseItem( this );
}

void Window_IsEnabledChanged(object sender,DependencyPropertyChangedEventArgs e)
{
   UpdateSystemMenuCloseItem( this );
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // UXWindow
//**************************************************************************************************

} // UserWin
