/// <summary> /// Runs the sample. /// </summary> public void Run() { _configuration = OnConfigure(); _form = CreateForm(_configuration); currentFormWindowState = _form.WindowState; bool isFormClosed = false; bool formIsResizing = false; _form.MouseClick += HandleMouseClick; _form.KeyDown += HandleKeyDown; _form.KeyUp += HandleKeyUp; _form.Resize += (o, args) => { if (_form.WindowState != currentFormWindowState) { HandleResize(o, args); } currentFormWindowState = _form.WindowState; }; _form.ResizeBegin += (o, args) => { formIsResizing = true; }; _form.ResizeEnd += (o, args) => { formIsResizing = false; HandleResize(o, args); }; _form.Closed += (o, args) => { isFormClosed = true; }; userInterface = new UserInterface(); var stats = new Element(); stats.SetBinding("Label", framesPerSecond); userInterface.Container.Add(stats); OnInitialize(); OnResourceLoad(); clock.Start(); MessagePump.Run(_form, () => { if (isFormClosed) { return; } Update(); if (!formIsResizing) { Render(); } }); OnResourceUnload(); }
/// <summary> /// Runs the sample. /// </summary> public void Run() { _configuration = OnConfigure(); _form = CreateForm(_configuration); currentFormWindowState = _form.WindowState; bool isFormClosed = false; bool formIsResizing = false; _form.MouseClick += HandleMouseClick; _form.KeyDown += HandleKeyDown; _form.KeyUp += HandleKeyUp; _form.Resize += ( o, args ) => { if( _form.WindowState != currentFormWindowState ) { HandleResize( o, args ); } currentFormWindowState = _form.WindowState; }; _form.ResizeBegin += ( o, args ) => { formIsResizing = true; }; _form.ResizeEnd += ( o, args ) => { formIsResizing = false; HandleResize( o, args ); }; _form.Closed += ( o, args ) => { isFormClosed = true; }; userInterface = new UserInterface(); var stats = new Element(); stats.SetBinding( "Label", framesPerSecond ); userInterface.Container.Add( stats ); OnInitialize(); OnResourceLoad(); clock.Start(); MessagePump.Run( _form, () => { if( isFormClosed ) { return; } Update(); if( !formIsResizing ) Render(); } ); OnResourceUnload(); }