from System import *;
from System.Windows import *;
from System.Windows.Input import *;
from System.Windows.Threading import *;
from Hiyoko import *;

execfile("DefaultStartup.py");

def Startup(sender):
	mainForm = Application.Current.MainWindow;
	#mainForm.Deactivated += HideOnDeactivated;
	#mainForm.HotKeyManager.HotKeys.Add(Key.T, ModifierKeys.Windows, ShownByHotkey);

def HideOnDeactivated(mainForm, e):
	b = True;
	for window in Application.Current.Windows:
		if window != mainForm:
			b &= (window.Visibility == Visibility.Hidden)
	if b:
		mainForm.Close();

def ShownByHotkey(hotkey, e):
	mainForm = Application.Current.MainWindow;
	mainForm.ShowWindow();
	mainForm.TimelinePanel.StatusEdit.Focus();

Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, Action[object](Startup), "");