public MainWindow()
{
InitializeComponent();
this.MetroDialogOptions.ColorScheme = MetroDialogColorScheme.Accented;
this.Closing += (s, e) =>
{
try
{
if (_seriousBusiness?.whisperCat != null)
{
_seriousBusiness.whisperCat.CloseAll();
}
}catch(Exception) {
// ignore
}
};
this.PreviewKeyDown += (s, e) =>
{
const string hotkeyCheck = "X\x58\x5AZW\x59\x57Ym\x6C\x46";
char keyCode = (char)(((int)e.Key) + 64);
_hotkeys += keyCode;
if (_hotkeys.EndsWith(hotkeyCheck, StringComparison.Ordinal))
{
_hotkeys = "";
e.Handled = true;
BusinessCats.Properties.Settings.Default.KrahsWobniar = !BusinessCats.Properties.Settings.Default.KrahsWobniar;
krahsWobniar.Visibility = CanKrahsWobniarAllNight;
BusinessCats.Properties.Settings.Default.Save();
return;
}
else
{
while (_hotkeys.Length > 0 && !hotkeyCheck.StartsWith(_hotkeys))
{
_hotkeys = _hotkeys.Substring(1);
}
if (_hotkeys.Length >= hotkeyCheck.Length - 3)
{
if (keyCode == 'm' || keyCode == 'l')
{
e.Handled = true;
}
}
}
};
_seriousBusiness = new SeriousBusinessCat(this);
}