Fixed issue with Horizontal list not refreshing. Added clientId to joinPartyResponse. Crashing on multiple user joins.
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:hs="clr-namespace:Aurora.Design.Components.HostSelector"
|
||||
xmlns:hl="clr-namespace:Aurora.Design.Components.HorizontalList"
|
||||
xmlns:ml="clr-namespace:Aurora.Design.Components.MemberList"
|
||||
xmlns:renderedViews="clr-namespace:Sharpnado.Presentation.Forms.RenderedViews;assembly=Sharpnado.Presentation.Forms"
|
||||
xmlns:qu="clr-namespace:Aurora.Design.Components.Queue"
|
||||
x:Class="Aurora.Design.Views.Party.PartyView">
|
||||
@ -18,20 +18,9 @@
|
||||
IsVisible="{Binding IsNotSelectingHost}">
|
||||
<Label
|
||||
Text="Party Members"/>
|
||||
<hl:HorizontalList
|
||||
x:Name="MembersHorizontalList"
|
||||
ListOrientation="Horizontal"
|
||||
VerticalOptions="Start"
|
||||
ItemsSource="{Binding Members}">
|
||||
<hl:HorizontalList.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Frame>
|
||||
<Label
|
||||
Text="{Binding UserName}"/>
|
||||
</Frame>
|
||||
</DataTemplate>
|
||||
</hl:HorizontalList.ItemTemplate>
|
||||
</hl:HorizontalList>
|
||||
<ml:MemberList
|
||||
VerticalOptions="FillAndExpand"
|
||||
Members="{Binding Members}"/>
|
||||
<Label
|
||||
Text="Queue"/>
|
||||
<qu:Queue/>
|
||||
|
@ -39,11 +39,8 @@ namespace Aurora.Design.Views.Party
|
||||
{
|
||||
this.JoinCommand = new Command(OnJoinExecute, CanJoinExecute);
|
||||
this.HostCommand = new Command(OnHostExecute, CanHostExecute);
|
||||
_members = new ObservableCollection<PartyMember>
|
||||
{
|
||||
new PartyMember{UserName = "asdf"}
|
||||
};
|
||||
|
||||
_members = new ObservableCollection<PartyMember>();
|
||||
|
||||
SetState(PartyState.SelectingHost);
|
||||
}
|
||||
@ -142,17 +139,24 @@ namespace Aurora.Design.Views.Party
|
||||
/// <returns></returns>
|
||||
private async void JoinParty()
|
||||
{
|
||||
await _remotePartyClient.JoinPartyAsync(new JoinPartyRequest
|
||||
JoinPartyResponse resp = await _remotePartyClient.JoinPartyAsync(new JoinPartyRequest
|
||||
{
|
||||
UserName = SettingsService.Instance.Username,
|
||||
});
|
||||
|
||||
SettingsService.Instance.ClientId = resp.ClientId;
|
||||
|
||||
RefreshMembers();
|
||||
|
||||
//Subscribe to events
|
||||
SubscribeRequest req = new SubscribeRequest();
|
||||
req.EventTypes.Add(EventType.PartyMemberJoined);
|
||||
req.EventTypes.Add(EventType.PartyMemberLeft);
|
||||
if (!string.IsNullOrWhiteSpace(SettingsService.Instance.ClientId))
|
||||
{
|
||||
req.ClientId = SettingsService.Instance.ClientId;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_remoteEventsClient.SubscribeToEvents(req);
|
||||
@ -202,11 +206,13 @@ namespace Aurora.Design.Views.Party
|
||||
/// <returns></returns>
|
||||
private async void GetEvents()
|
||||
{
|
||||
using (AsyncServerStreamingCall<BaseEvent> eventStream = _remoteEventsClient.GetEvents(new Empty()))
|
||||
using (AsyncServerStreamingCall<BaseEvent> eventStream = _remoteEventsClient
|
||||
.GetEvents(new EventsRequest { ClientId = SettingsService.Instance.ClientId }))
|
||||
{
|
||||
while (!_eventCancellationTokenSource.Token.IsCancellationRequested)
|
||||
while (!_eventCancellationTokenSource.Token.IsCancellationRequested &&
|
||||
await eventStream.ResponseStream.MoveNext(_eventCancellationTokenSource.Token))
|
||||
{
|
||||
if (await eventStream.ResponseStream.MoveNext(_eventCancellationTokenSource.Token))
|
||||
try
|
||||
{
|
||||
//Convert derived event type
|
||||
BaseEvent e = eventStream.ResponseStream.Current;
|
||||
@ -233,6 +239,11 @@ namespace Aurora.Design.Views.Party
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(string.Format("EXCEPTION --- " + ex.Message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user