Apply review suggestions

This commit is contained in:
Lucas A 2020-01-17 18:53:17 +01:00
parent 0422b326ad
commit f00938971e
2 changed files with 15 additions and 6 deletions

View File

@ -26,7 +26,7 @@ public TestSceneOnlineViewContainer()
Child = new Container Child = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = onlineView = new OnlineViewContainer(@"Please login to view dummy test content") Child = onlineView = new OnlineViewContainer(@"view dummy test content")
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]

View File

@ -23,6 +23,9 @@ public class OnlineViewContainer : Container, IOnlineComponent
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
[Resolved]
protected IAPIProvider API { get; private set; }
public OnlineViewContainer(string placeholderMessage) public OnlineViewContainer(string placeholderMessage)
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
@ -35,12 +38,12 @@ public OnlineViewContainer(string placeholderMessage)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Alpha = 0, Alpha = 0,
Child = placeholder = new LoginPlaceholder(placeholderMessage) Child = placeholder = new LoginPlaceholder($@"Please sign in to {placeholderMessage}")
}, },
}; };
} }
public void APIStateChanged(IAPIProvider api, APIState state) public virtual void APIStateChanged(IAPIProvider api, APIState state)
{ {
switch (state) switch (state)
{ {
@ -70,10 +73,16 @@ private void updatePlaceholderVisibility(bool showPlaceholder)
} }
} }
[BackgroundDependencyLoader] protected override void LoadComplete()
private void load(IAPIProvider api)
{ {
api.Register(this); API?.Register(this);
base.LoadComplete();
}
protected override void Dispose(bool isDisposing)
{
API?.Unregister(this);
base.Dispose(isDisposing);
} }
} }
} }