static void Main() { // Do this before Composer.Init() because of the Disabled setting Settings.LoadConfig(); Composer.Init(); Settings.LoadSequences(); KeyboardHook.Init(); Updater.Init(); Settings.StartWatchConfigFile(); try { var app = new Application(); var icon = new SysTrayIcon(); app.Exit += (o, e) => icon.Dispose(); app.Run(); } finally { Settings.StopWatchConfigFile(); Updater.Fini(); KeyboardHook.Fini(); Settings.SaveConfig(); Composer.Fini(); Updater.Fini(); } }
static void Main(string[] args) { // Some commandline flags just trigger a message broadcast var command_flags = new Dictionary <string, MenuCommand>() { { "-sequences", MenuCommand.ShowSequences }, { "-settings", MenuCommand.ShowOptions }, }; foreach (var arg in args) { if (command_flags.TryGetValue(arg, out var cmd)) { NativeMethods.PostMessage(HWND.BROADCAST, WM_WINCOMPOSE.OPEN, (int)cmd, 0); return; } } // Do this before Composer.Init() because of the Disabled setting Settings.LoadConfig(); Composer.Init(); Settings.LoadSequences(); Metadata.LoadDB(); KeyboardHook.Init(); Updater.Init(); Settings.StartWatchConfigFile(); try { var app = new Application(); var icon = new SysTrayIcon(); app.Exit += (o, e) => icon.Dispose(); app.Run(); } finally { Settings.StopWatchConfigFile(); Updater.Fini(); KeyboardHook.Fini(); Settings.SaveConfig(); Metadata.SaveDB(); Composer.Fini(); Updater.Fini(); } }