コード例 #1
0
ファイル: Program.cs プロジェクト: tony-jang/NextCapture
        private static void Initialize()
        {
            AppDomain.CurrentDomain.AssemblyResolve    += CurrentDomain_AssemblyResolve;
            AppDomain.CurrentDomain.ProcessExit        += CurrentDomain_ProcessExit;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Application.ThreadException += Application_ThreadException;
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Dispatcher.Init();
            HotkeyManager.Init();
            SystemCursor.Show();

            LoadAssembly("SharpDX.dll");
            LoadAssembly("SharpDX.Direct3D11.dll");
            LoadAssembly("SharpDX.DXGI.dll");

            ShutterPlayer = new SoundPlayer(Properties.Resources.shutter);

            OSXCapture = new OSXCapture();

            foreach (var engine in OSXCapture.CaptureEngines)
            {
                engine.BeginCapture += ScreenCapture_BeginCapture;
            }

            MouseHook = new MouseHook();
            MouseHook.Hook();

            MouseHook.Filters.Add(OSXCapture);

#if DEBUG
            HotkeyManager.Register("Force_Close", new Hotkey()
            {
                ModifierKey = VKeys.Alt,
                SubKeys     = new[] { VKeys.Escape },
                Action      = new HotKeyEvent((s, e) =>
                {
                    Program.Close();
                    (e as HotkeyEventArgs).Handled = true;
                })
            });
#endif
        }