Fix stand alone chat display textbox not binding to local channel

This commit is contained in:
Joseph Madamba 2022-12-29 01:37:37 -08:00
parent c326745f96
commit 70dbb8edac
1 changed files with 5 additions and 8 deletions

View File

@ -87,14 +87,6 @@ private void load(ChannelManager manager)
channelManager ??= manager;
}
protected override void LoadComplete()
{
base.LoadComplete();
if (channelManager != null)
TextBox?.Current.BindTo(channelManager.CurrentChannel.Value.TextBoxMessage);
}
protected virtual StandAloneDrawableChannel CreateDrawableChannel(Channel channel) =>
new StandAloneDrawableChannel(channel);
@ -119,8 +111,13 @@ private void channelChanged(ValueChangedEvent<Channel> e)
{
drawableChannel?.Expire();
if (e.OldValue != null)
TextBox?.Current.UnbindFrom(e.OldValue.TextBoxMessage);
if (e.NewValue == null) return;
TextBox?.Current.BindTo(e.NewValue.TextBoxMessage);
drawableChannel = CreateDrawableChannel(e.NewValue);
drawableChannel.CreateChatLineAction = CreateMessage;
drawableChannel.Padding = new MarginPadding { Bottom = postingTextBox ? text_box_height : 0 };