BankProject/Client/Context/SessionContext.cs
GabrielTofvesson 3c36755c7c Added internationalization manager
- Prioritizes language file matching system language above all else
  - Secondarily prioritizes "default" lang file
  - Prioritizes lang files declared in meta file (low-to-high priority system)
Moved resource files to one folder
Added multi-file loading support
Started creating a shared layout resource file
Added language files
  - Swedish (default): Incomplete
  - English US (priority 0): Complete
  - English GB: (priority ): Complete
Continued implementing ListVew
Added reference support for 'top' variable in View.Draw()
2018-04-04 11:58:09 +02:00

42 lines
1.1 KiB
C#

using Client.ConsoleForms;
using Client.ConsoleForms.Graphics;
using ConsoleForms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tofvesson.Collections;
namespace Client
{
public sealed class SessionContext : Context
{
private readonly BankNetInteractor interactor;
private readonly string sessionID;
public SessionContext(ContextManager manager, BankNetInteractor interactor, string sessionID) : base(manager, "Session", "Common")
{
this.interactor = interactor;
this.sessionID = sessionID;
((DialogView)views.GetNamed("Success")).RegisterSelectListener((v, i, s) =>
{
interactor.Logout(sessionID);
manager.LoadContext(new NetContext(manager));
});
}
public override void OnCreate()
{
controller.AddView(views.GetNamed("Success"));
}
public override void OnDestroy()
{
controller.CloseView(views.GetNamed("Success"));
interactor.Disconnect();
}
}
}