GabrielTofvesson 856e16b3f2 * Added support for artificial key event triggers
* Added OnClose event to view: triggered when controller is removing view from render queue
* Added more localization
* Added bank transfer
* Fixed account balance reset
* Fixed user copying issues in database: now it does a full deep copy, as opposed to a shallow copy
* Fixed serverside sysinsert checks
* Fixed serverside Account_Get info endpoint
* Other minor things
2018-05-15 18:57:49 +02:00

30 lines
883 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Client.ConsoleForms.Parameters;
using Client.ConsoleForms.Events;
namespace Client.ConsoleForms.Graphics
{
public class ButtonView : TextView, ISubmissionListener
{
protected SubmissionEvent evt;
public ButtonView(ViewData parameters, LangManager lang) : base(parameters, lang)
{
}
public override bool HandleKeyEvent(ConsoleController.KeyEvent info, bool inFocus, bool triggered)
{
bool b = (triggered || (inFocus && info.ValidEvent)) && info.Event.Key == ConsoleKey.Enter;
base.HandleKeyEvent(info, inFocus, triggered);
if (b) evt?.Invoke(this);
return b;
}
public void SetEvent(SubmissionEvent listener) => evt = listener;
}
}