Permalink
Browse files

app was crashing with the writing & reading hotkeys logic

  • Loading branch information...
srushti committed Aug 13, 2009
1 parent 6b1710a commit 98a587572dd52b87a006230f59e938c687b23450
View
@@ -9,7 +9,7 @@ public partial class App {
var processes = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
ShutdownMode = ShutdownMode.OnExplicitShutdown;
if (processes.Length != 1) Shutdown();
- var command = new MainWindowCommand(Shutdown, new AppSettings());
+ var command = new MainWindowCommand(Shutdown);
command.Execute();
command.Collapse();
DispatcherUnhandledException += (sender, args) => {
@@ -8,6 +8,7 @@ public class FileSystemStalker {
public FileSystemStalker(Folder folder, FileChangeTypes fileChangeTypes, FileChangedDelegate changedDelegate) {
this.changedDelegate = changedDelegate;
+ if (!folder.Exists()) return;
watcher = new FileSystemWatcher(folder.FullName) {IncludeSubdirectories = true, EnableRaisingEvents = true};
if (AskedForEvent(fileChangeTypes, FileChangeTypes.Created)) watcher.Created += RaiseEvent;
if (AskedForEvent(fileChangeTypes, FileChangeTypes.Changed)) watcher.Changed += RaiseEvent;
@@ -14,16 +14,17 @@ public class MainWindowCommand {
private MainWindow window;
private readonly Hotkey unchangeableDisplayHotkey = new Hotkey(Modifiers.Alt | Modifiers.Control | Modifiers.Shift, Keys.Space);
- public MainWindowCommand(VoidDelegate killApplication, AppSettings settings) {
+ public MainWindowCommand(VoidDelegate killApplication) {
var selfPlugin = new SelfPlugin();
var loader = new PluginLoader(selfPlugin);
- PersistanceHelper.LoadOrSaveAndLoad(selfPlugin.XStream, Paths.Instance.AppSettings,
- new AppSettings(new Hotkey(Modifiers.Alt, Keys.F2),
- new Hotkey(Modifiers.Alt | Modifiers.Control | Modifiers.Shift, Keys.F4)));
+ AppSettings appSettings = PersistanceHelper.LoadOrSaveAndLoad(selfPlugin.XStream, Paths.Instance.AppSettings,
+ new AppSettings(new Hotkey(Modifiers.Alt, Keys.F2),
+ new Hotkey(Modifiers.Alt | Modifiers.Control | Modifiers.Shift,
+ Keys.F4)));
+ displayHotkey = appSettings.DisplayHotKey;
+ killHotkey = appSettings.KillHotKey;
controller = new MainWindowController(loader.LaunchablePlugins, loader.CharacterPlugins, loader.LaunchableHandlers, selfPlugin);
this.killApplication = killApplication;
- displayHotkey = settings.DisplayHotKey;
- killHotkey = settings.KillHotKey;
}
public void Execute() {
Oops, something went wrong.

0 comments on commit 98a5875

Please sign in to comment.