|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.Windows.Threading;
using System.Threading;
namespace AutoExtractor
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private MainWindow window;
public App()
{
}
public App(KeyboardHook hook)
{
if (hook == null)
throw new ArgumentNullException("hook");
hook.KeyCombinationPressed += new EventHandler(hook_KeyCombinationPressed);
}
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
window = new MainWindow();
if (AutoExtractor.Properties.Settings.Default.StartMinimizedToTray)
window.MinimizeToTray();
else
window.Show();
}
void hook_KeyCombinationPressed(object sender, EventArgs e)
{
Dispatcher.Invoke(DispatcherPriority.Normal, new ThreadStart(ShowMainWindow));
}
private void ShowMainWindow()
{
if (window.Visibility != Visibility.Visible)
{
WindowVisibilityHelper.ActivateWindow(window);
window.ChangedFileControl.Focus();
}
else
window.MinimizeToTray();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I'm a .NET developer, fluent in C# and VB.NET with a focus on SharePoint and experience in WinForms, WPF, Silverlight, ASP.NET, SQL Server. My roots come from a support/system administrator role so I know my way around a server room as well.
I have a passion for technology and I love what I do.