Added components to support the party view
This commit is contained in:
parent
d3f51371dd
commit
7d94c75f27
@ -6,8 +6,6 @@
|
||||
x:Class="Aurora.Frontend.Components.MemberList.MemberList">
|
||||
<ContentView.Content>
|
||||
<StackLayout>
|
||||
<Label
|
||||
Text="Party Members"/>
|
||||
<hl:HorizontalList
|
||||
x:Name="MembersHorizontalList"
|
||||
ListOrientation="Horizontal"
|
||||
|
48
Aurora/Frontend/Components/Queue/Queue.xaml
Normal file
48
Aurora/Frontend/Components/Queue/Queue.xaml
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:dg="clr-namespace:Xamarin.Forms.DataGrid;assembly=Xamarin.Forms.DataGrid"
|
||||
x:Class="Aurora.Frontend.Components.Queue.Queue">
|
||||
<ContentView.Content>
|
||||
<dg:DataGrid
|
||||
x:Name="QueueDataGrid"
|
||||
SelectionEnabled="True"
|
||||
RowHeight="25"
|
||||
HeaderHeight="40"
|
||||
BorderColor="#CCCCCC"
|
||||
HeaderBackground="#E0E6F8">
|
||||
<dg:DataGrid.HeaderFontSize>
|
||||
<OnIdiom
|
||||
x:TypeArguments="x:Double">
|
||||
<OnIdiom.Tablet>15</OnIdiom.Tablet>
|
||||
<OnIdiom.Phone>13</OnIdiom.Phone>
|
||||
<OnIdiom.Desktop>20</OnIdiom.Desktop>
|
||||
</OnIdiom>
|
||||
</dg:DataGrid.HeaderFontSize>
|
||||
<dg:DataGrid.Columns>
|
||||
<dg:DataGridColumn
|
||||
Title="Title"
|
||||
PropertyName="Metadata.Title"
|
||||
Width="2*"/>
|
||||
<dg:DataGridColumn
|
||||
Title="Album"
|
||||
PropertyName="Metadata.Album"
|
||||
Width="0.95*"/>
|
||||
<dg:DataGridColumn
|
||||
Title="Artist"
|
||||
PropertyName="Metadata.Artist"
|
||||
Width="1*"/>
|
||||
<dg:DataGridColumn
|
||||
Title="Duration"
|
||||
PropertyName="Metadata.Duration"/>
|
||||
</dg:DataGrid.Columns>
|
||||
<dg:DataGrid.RowsBackgroundColorPalette>
|
||||
<dg:PaletteCollection>
|
||||
<Color>#F2F2F2</Color>
|
||||
<Color>#FFFFFF</Color>
|
||||
</dg:PaletteCollection>
|
||||
</dg:DataGrid.RowsBackgroundColorPalette>
|
||||
</dg:DataGrid>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
109
Aurora/Frontend/Components/Queue/Queue.xaml.cs
Normal file
109
Aurora/Frontend/Components/Queue/Queue.xaml.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.DataGrid;
|
||||
using Aurora.Backend.Models.Media;
|
||||
|
||||
namespace Aurora.Frontend.Components.Queue
|
||||
{
|
||||
public partial class Queue : ContentView
|
||||
{
|
||||
public Queue()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region ItemsSource Property
|
||||
/// <summary>
|
||||
/// Bindable Property for the ItemsSource of the datagrid.
|
||||
/// </summary>
|
||||
/// <param name=""ItemsSource""></param>
|
||||
/// <param name="typeof(IEnumerable<object>"></param>
|
||||
/// <returns></returns>
|
||||
public static readonly BindableProperty ItemsSourceProperty =
|
||||
BindableProperty.Create(propertyName: "ItemsSource",
|
||||
returnType: typeof(IEnumerable<object>),
|
||||
declaringType: typeof(Queue),
|
||||
defaultBindingMode: BindingMode.Default,
|
||||
propertyChanged: OnItemsSourceChanged);
|
||||
|
||||
/// <summary>
|
||||
/// Backing property for the ItemsSource property.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public IEnumerable<object> ItemsSource
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IEnumerable<object>)GetValue(ItemsSourceProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(ItemsSourceProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ItemsSource Changed event handler
|
||||
/// </summary>
|
||||
/// <param name="bindable"></param>
|
||||
/// <param name="oldValue"></param>
|
||||
/// <param name="newValue"></param>
|
||||
private static void OnItemsSourceChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
Queue control = bindable as Queue;
|
||||
var queueDataGrid = control.FindByName("QueueDataGrid") as DataGrid;
|
||||
queueDataGrid.ItemsSource = newValue as IEnumerable<object>;
|
||||
}
|
||||
|
||||
#endregion ItemsSource Property
|
||||
|
||||
/// <summary>
|
||||
/// Bindable property for the selected item field on the datagrid.
|
||||
/// </summary>
|
||||
/// <param name=""SelectedItem""></param>
|
||||
/// <param name="typeof(BaseMetadata"></param>
|
||||
/// <returns></returns>
|
||||
public static readonly BindableProperty SelectedItemProperty =
|
||||
BindableProperty.Create(propertyName: "SelectedItem",
|
||||
returnType: typeof(object),
|
||||
declaringType: typeof(Queue),
|
||||
defaultBindingMode: BindingMode.TwoWay,
|
||||
propertyChanged: OnSelectedItemChanged);
|
||||
|
||||
/// <summary>
|
||||
/// Backing property for the SelectedItem property.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public object SelectedItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((object)GetValue(SelectedItemProperty));
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(SelectedItemProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles selection change events.
|
||||
/// </summary>
|
||||
/// <param name="bindable">The bindable object.</param>
|
||||
/// <param name="newValue"></param>
|
||||
/// <param name="oldValue"></param>
|
||||
private static void OnSelectedItemChanged(BindableObject bindable, object newValue, object oldValue)
|
||||
{
|
||||
Queue control = bindable as Queue;
|
||||
var queueDataGrid = control.FindByName("QueueDataGrid") as DataGrid;
|
||||
IEnumerable<object> source = (IEnumerable<object>)queueDataGrid.ItemsSource;
|
||||
if (source.Contains(newValue))
|
||||
{
|
||||
queueDataGrid.SelectedItem = newValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Aurora.Frontend.Views.Albums.AlbumsView">
|
||||
<ContentView
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Aurora.Frontend.Views.Albums.AlbumsView">
|
||||
<ContentPage.Content>
|
||||
<Label Text="Albums" />
|
||||
<Grid></Grid>
|
||||
</ContentPage.Content>
|
||||
</ContentView>
|
||||
</ContentView>
|
@ -4,14 +4,20 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:hs="clr-namespace:Aurora.Frontend.Components.HostSelector"
|
||||
xmlns:ml="clr-namespace:Aurora.Frontend.Components.MemberList"
|
||||
xmlns:qu="clr-namespace:Aurora.Frontend.Components.Queue"
|
||||
x:Class="Aurora.Frontend.Views.Party.PartyView">
|
||||
<ContentView.Content>
|
||||
<AbsoluteLayout
|
||||
VerticalOptions="FillAndExpand"
|
||||
HorizontalOptions="FillAndExpand">
|
||||
<StackLayout>
|
||||
<Label
|
||||
Text="Party Members"/>
|
||||
<ml:MemberList
|
||||
Members="{Binding Members}"/>
|
||||
<Label
|
||||
Text="Queue"/>
|
||||
<qu:Queue/>
|
||||
</StackLayout>
|
||||
<hs:HostSelector
|
||||
AbsoluteLayout.LayoutFlags="All"
|
||||
|
Loading…
Reference in New Issue
Block a user