BankProject/Client/ConsoleForms/ContextManager.cs
GabrielTofvesson bdbb1342ba Massive update
* Added new endpoint for updating password
* Added internationalization method to ContextManager and Context
* Updated contexts to use internationalization
* Added a fancy text-based UI to the server
* Added translations
* Moved Promise class to its own file
* Made BankNetInteractor its own file
* Added a lot of convenient methods
* Added many more comments
* Fixed input event management in ButtonView
* Added support for dynamic ListView content modification
* Added more layouts
* Fixed some namespaces
* Added more commands to the server
2018-05-13 20:04:01 +02:00

33 lines
872 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Client.ConsoleForms
{
public sealed class ContextManager
{
public Context Current { get; private set; }
public LangManager I18n { get; private set; }
public ContextManager(bool doLang = true)
{
if (doLang) I18n = LangManager.LoadLang();
else I18n = LangManager.NO_LANG;
}
public void LoadContext(Context ctx)
{
Current?.OnDestroy();
Current = ctx;
Current.OnCreate();
}
public bool Update(ConsoleController.KeyEvent keypress, bool hasKeypress = true)
=> Current?.Update(keypress, hasKeypress) == true;
public string GetIntlString(string i18n) => I18n.MapIfExists(i18n);
}
}