Esempio n. 1
0
        public void ShowMessage(TimedDialogue message, int timeout = MessageBox.DEFAULT_TIMEOUT)
        {
            ScreenState screenState = new ScreenState
            {
                Width = _oldWidth,
                Height = _oldHeight
            };

            MessageBox = new MessageBox(screenState, message, timeout);
        }
Esempio n. 2
0
        private void Go()
        {
            try
            {
                Application.Init();

                _window = new Window(Configuration.WindowTitle);
                _window.SetDefaultSize(Configuration.WindowWidth, Configuration.WindowHeight);
                _window.DeleteEvent += OnWinDelete;
                _window.KeyPressEvent += OnKeyPress;
                _window.KeyReleaseEvent += OnKeyRelease;
                _window.ConfigureEvent += OnWinConfigure;
                _window.ExposeEvent += OnExposed;

                _oldWidth = Configuration.WindowWidth;
                _oldHeight = Configuration.WindowHeight;

                GLib.Timeout.Add(1000 / Configuration.RefreshRate, new GLib.TimeoutHandler(OnTimedDraw));

                _window.ShowAll();

                _pixmap = new Gdk.Pixmap(_window.GdkWindow, Configuration.WindowWidth, Configuration.WindowHeight, -1);
                _window.AppPaintable = true;
                _window.DoubleBuffered = false;

                QueueInitialState();

                while (!_quit)
                {
                    try
                    {
                        if (MessageBox != null && MessageBox.Timer.IsUp)
                        {
                            MessageBox = null;
                        }

                        State.RunIteration();
                    }
                    catch (Exception e)
                    {
                        HandleFatalException(e);
                    }

                    Gdk.Threads.Enter();

                    if (Application.EventsPending())
                    {
                        try
                        {
                            Application.RunIteration();
                        }
                        catch (Exception e)
                        {
                            HandleFatalException(e);
                        }
                        finally
                        {
                            Gdk.Threads.Leave();
                        }
                    }
                }

                Gdk.Threads.Enter();

                try
                {
                    Application.Quit();
                }
                finally
                {
                    Gdk.Threads.Leave();
                }
            }
            finally
            {
                Cleanup();
            }
        }