예제 #1
0
        public static bool Init(string[] args)
        {
            string appName = Assembly.GetExecutingAssembly().GetName().Name;

            // check gtk
            if (!ThemeHelper.CheckGtk())
                return false;
            ThemeHelper.ApplyCustomTheme(args);

            // init gtk app
            Application.Init(appName, ref args);

            // check windows platform
            if (!Gui.PlatformUtils.IsWindows) {
                CustomMessageDialog dlg = new CustomMessageDialog(
                    null, MessageType.Error,
                    "Your OS is not supported on this version!");
                dlg.Ok += (sender, e) => Application.Quit();
                dlg.Show();
                Application.Run();
                return false;
            }

            // load dgle
            IEngineCore pEngineCore = null;
            if (!Engine.GetEngine(DLL_PATH, out pEngineCore)) {
                CustomMessageDialog dlg = new CustomMessageDialog(
                    null, MessageType.Error,
                    "Couldn't load \"{0}\"!", DLL_NAME);
                dlg.Ok += (sender, e) => Application.Quit();
                dlg.Show();
                Application.Run();
                return false;
            }

            Core = pEngineCore;

            // init dgle with force no window
            TEngWindow eng_win = new TEngWindow();
            Core.InitializeEngine(
                IntPtr.Zero, appName, ref eng_win, 33,
                E_ENGINE_INIT_FLAGS.EIF_FORCE_NO_WINDOW | E_ENGINE_INIT_FLAGS.EIF_FORCE_NO_SPLASH);
            Core.ConsoleVisible(false);

            // init main win
            MainWindow win = new MainWindow();
            win.Show();
            win.DeleteEvent += (o, a) => {
                Stop();
                a.RetVal = true;
            };

            return true;
        }
예제 #2
0
        private bool InitDCP()
        {
            // init dcp file system from dgle
            try {
                dcp = new DCP();

                return true;
            } catch {
                CustomMessageDialog dlg = new CustomMessageDialog(
                    this, MessageType.Error, ButtonsType.Ok,
                    "Failed to load DCP file system from DGLE!");
                dlg.Ok += (sender, e) => Program.Stop();
                dlg.Show();

                return false;
            }
        }