Can now somewhat reliably join a party

This commit is contained in:
watsonb8
2019-07-06 15:52:28 -04:00
parent 0d64c0732e
commit 2a3290defc
15 changed files with 140 additions and 125 deletions

View File

@ -20,11 +20,6 @@
VerticalOptions="Center"/>
<Entry
x:Name="HostnameEntry"/>
<Label
Text="Port"
VerticalOptions="Center"/>
<Entry
x:Name="PortEntry"/>
<Button
HorizontalOptions="Center"
x:Name="buttonHost"

View File

@ -31,10 +31,6 @@ namespace Aurora.Design.Components.HostSelector
{
Hostname = e.NewTextValue;
};
PortEntry.TextChanged += (sender, e) =>
{
Port = e.NewTextValue;
};
}
@ -119,33 +115,6 @@ namespace Aurora.Design.Components.HostSelector
#endregion Hostname property
#region Port property
public static readonly BindableProperty PortProperty =
BindableProperty.Create(propertyName: "Port",
returnType: typeof(string),
declaringType: typeof(HostSelector),
defaultBindingMode: BindingMode.TwoWay,
propertyChanged: OnPortChanged);
public string Port
{
get { return (string)GetValue(PortProperty); }
set { SetValue(PortProperty, value); }
}
private static void OnPortChanged(BindableObject bindable, object oldValue, object newValue)
{
string newVal = newValue as string;
HostSelector instance = bindable as HostSelector;
if (instance.PortEntry.Text != newVal)
{
instance.PortEntry.Text = newVal;
}
}
#endregion Port property
}

View File

@ -1,13 +1,14 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using Xamarin.Forms;
using Aurora.Design.Components.HorizontalList;
using Aurora.Models;
using Aurora.Proto;
namespace Aurora.Design.Components.MemberList
{
public partial class MemberList : ContentView
{
private static ObservableCollection<PartyMember> _newSource;
public MemberList()
{
InitializeComponent();
@ -22,7 +23,7 @@ namespace Aurora.Design.Components.MemberList
/// <returns></returns>
public static readonly BindableProperty MembersProperty =
BindableProperty.Create(propertyName: "Members",
returnType: typeof(IEnumerable<PartyMember>),
returnType: typeof(ObservableCollection<PartyMember>),
declaringType: typeof(MemberList),
defaultBindingMode: BindingMode.Default,
propertyChanged: OnMembersChanged);
@ -31,11 +32,11 @@ namespace Aurora.Design.Components.MemberList
/// Backing property for MembersProperty
/// </summary>
/// <value></value>
public IEnumerable<PartyMember> Members
public ObservableCollection<PartyMember> Members
{
get
{
return (IEnumerable<PartyMember>)GetValue(MembersProperty);
return (ObservableCollection<PartyMember>)GetValue(MembersProperty);
}
set
{
@ -55,8 +56,10 @@ namespace Aurora.Design.Components.MemberList
var membersList = control.FindByName("MembersHorizontalList") as HorizontalList.HorizontalList;
if (membersList != null)
{
membersList.ItemsSource = newValue as IEnumerable<PartyMember>;
_newSource = newValue as ObservableCollection<PartyMember>;
membersList.ItemsSource = newValue as ObservableCollection<PartyMember>;
}
}
}
}