1
0
mirror of synced 2024-11-05 09:49:16 +00:00
MassiveKnob/Windows/MassiveKnob.Plugin.CoreAudio/OSD/OSDWindow.xaml.cs

50 lines
1.2 KiB
C#
Raw Normal View History

using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Media.Animation;
namespace MassiveKnob.Plugin.CoreAudio.OSD
{
/// <summary>
/// Interaction logic for OSDWindow.xaml
/// </summary>
public partial class OSDWindow
{
private bool closeStoryBoardCompleted;
public OSDWindow(OSDWindowViewModel viewModel)
{
DataContext = viewModel;
InitializeComponent();
}
private void OSDWindow_OnLoaded(object sender, RoutedEventArgs e)
{
var desktopArea = Screen.PrimaryScreen.WorkingArea;
Left = (desktopArea.Width - Width) / 2;
Top = desktopArea.Bottom - Height - 25;
}
private void OSDWindow_OnClosing(object sender, CancelEventArgs e)
{
if (closeStoryBoardCompleted)
return;
((Storyboard)FindResource("CloseStoryboard")).Begin(this);
e.Cancel = true;
}
private void CloseStoryboard_Completed(object sender, EventArgs e)
{
closeStoryBoardCompleted = true;
Close();
}
}
}