Example #1
0
        public MainWindow()
        {
            InitializeComponent();

            m_rootViewModel  = App.Root;
            this.DataContext = m_rootViewModel;

            Commands.MapCommand(m_rootViewModel.Tasks.NewTaskCommand, ApplicationCommands.New, this);
            Commands.MapCommand(m_rootViewModel.Tasks.CancelNewCommand, Commands.Cancel, this);

            this.CommandBindings.Add(
                new CommandBinding(ApplicationCommands.Close, (sender, args) => Close()));

            this.SourceInitialized += (sender, args) =>
                                      HotKeyHelper.HookHotKey(this, Key.T, ModifierKeys.Control | ModifierKeys.Alt, c_hotKeyId, this_hotkey);

            this.Closing += new CancelEventHandler(MainWindow_Closing);

            this.Loaded += (sender, e) =>
            {
                CreateWindowGlass();
                Taskbar.Init();
                ProcessCommandLineArgs(SingleInstance <App> .CommandLineArgs, true);
            };

            RegisterApplicationRecoveryAndRestart();
        }