* Reworked padding rendering (now handled natively by View) * Fixed how ConsoleController renders dirty views * Explicitly added padding to the LayoutMeta dimensions computation * Added support for updating passwords in SessionContext * Completed account display system * Added many more resources * Simplified internationalization * Added clientside representations for accounts and transations * MOAR COMMENTS! * Optimized account serialization * Corrected issue where copying a user simply copied references to the user accounts; not actually copying accounts (which caused jank) * Fixed timestamp for TimeStampWriter * Probably some other minor things
38 lines
990 B
C#
38 lines
990 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Client
|
|
{
|
|
public delegate void Event(Promise p);
|
|
public class Promise
|
|
{
|
|
internal Promise handler = null; // For chained promise management
|
|
private Event evt;
|
|
public string Value { get; internal set; }
|
|
public bool HasValue { get; internal set; }
|
|
public Event Subscribe
|
|
{
|
|
get => evt;
|
|
set
|
|
{
|
|
// Allows clearing subscriptions
|
|
if (evt == null || value == null) evt = value;
|
|
else evt += value;
|
|
if (HasValue)
|
|
evt(this);
|
|
}
|
|
}
|
|
public static Promise AwaitPromise(Task<Promise> p)
|
|
{
|
|
//if (!p.IsCompleted) p.RunSynchronously();
|
|
p.Wait();
|
|
return p.Result;
|
|
}
|
|
|
|
public void Unsubscribe() => evt = null;
|
|
}
|
|
}
|