Merge branch 'feature/party_playback_proto' into 'master'

Feature/party playback proto

See merge request aurora/aurora-sharp-desktop!1
This commit is contained in:
Brandon Watson 2019-07-06 15:53:46 -04:00
commit 74f5d3e9c6
79 changed files with 1306 additions and 312 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Grpc.Tools.1.21.0\build\Grpc.Tools.props" Condition="Exists('..\packages\Grpc.Tools.1.21.0\build\Grpc.Tools.props')" />
<Import Project="..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.props" Condition="Exists('..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -110,6 +111,25 @@
<Reference Include="LibVLCSharp.Forms.Platforms.GTK">
<HintPath>..\packages\LibVLCSharp.Forms.GTK.3.0.0\lib\net47\LibVLCSharp.Forms.Platforms.GTK.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf">
<HintPath>..\packages\Google.Protobuf.3.8.0\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="System.Interactive.Async">
<HintPath>..\packages\System.Interactive.Async.3.2.0\lib\net46\System.Interactive.Async.dll</HintPath>
</Reference>
<Reference Include="Grpc.Core.Api">
<HintPath>..\packages\Grpc.Core.Api.1.21.0\lib\net45\Grpc.Core.Api.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Grpc.Core">
<HintPath>..\packages\Grpc.Core.1.21.0\lib\net45\Grpc.Core.dll</HintPath>
</Reference>
<Reference Include="Plugin.Settings.Abstractions">
<HintPath>..\packages\Xam.Plugins.Settings.3.1.1\lib\net45\Plugin.Settings.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Plugin.Settings">
<HintPath>..\packages\Xam.Plugins.Settings.3.1.1\lib\net45\Plugin.Settings.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="gtk-gui\gui.stetic">
@ -134,6 +154,7 @@
<Compile Include="gtk-gui\MainWindow.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Helpers\Settings.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
@ -463,4 +484,6 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.3.6.0.344457\build\Xamarin.Forms.targets')" />
<Import Project="..\packages\VideoLAN.LibVLC.Mac.3.1.2\build\VideoLAN.LibVLC.Mac.targets" Condition="Exists('..\packages\VideoLAN.LibVLC.Mac.3.1.2\build\VideoLAN.LibVLC.Mac.targets')" />
<Import Project="..\packages\Grpc.Tools.1.21.0\build\Grpc.Tools.targets" Condition="Exists('..\packages\Grpc.Tools.1.21.0\build\Grpc.Tools.targets')" />
<Import Project="..\packages\Grpc.Core.1.21.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.21.0\build\net45\Grpc.Core.targets')" />
</Project>

View File

@ -0,0 +1,44 @@
/*
// Helpers/Settings.cs This file was automatically added when you installed the Settings Plugin. If you are not using a PCL then comment this file back in to use it.
using Plugin.Settings;
using Plugin.Settings.Abstractions;
namespace Aurora.gtk.Helpers
{
/// <summary>
/// This is the Settings static class that can be used in your Core solution or in any
/// of your client applications. All settings are laid out the same exact way with getters
/// and setters.
/// </summary>
public static class Settings
{
private static ISettings AppSettings
{
get
{
return CrossSettings.Current;
}
}
#region Setting Constants
private const string SettingsKey = "settings_key";
private static readonly string SettingsDefault = string.Empty;
#endregion
public static string GeneralSettings
{
get
{
return AppSettings.GetValueOrDefault(SettingsKey, SettingsDefault);
}
set
{
AppSettings.AddOrUpdateValue(SettingsKey, value);
}
}
}
}*/

View File

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Google.Protobuf" version="3.8.0" targetFramework="net47" />
<package id="Grpc" version="1.21.0" targetFramework="net47" />
<package id="Grpc.Core" version="1.21.0" targetFramework="net47" />
<package id="Grpc.Core.Api" version="1.21.0" targetFramework="net47" />
<package id="Grpc.Tools" version="1.21.0" targetFramework="net47" developmentDependency="true" />
<package id="LibVLCSharp" version="3.0.0" targetFramework="net47" />
<package id="LibVLCSharp.Forms" version="3.0.0" targetFramework="net47" />
<package id="LibVLCSharp.Forms.GTK" version="3.0.0" targetFramework="net47" />
@ -7,6 +12,7 @@
<package id="Microsoft.Bcl" version="1.1.8" targetFramework="net47" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net47" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net47" />
<package id="System.Interactive.Async" version="3.2.0" targetFramework="net47" />
<package id="System.Reflection" version="4.3.0" targetFramework="net47" />
<package id="System.Reflection.TypeExtensions" version="4.4.0" targetFramework="net47" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net47" />
@ -14,6 +20,7 @@
<package id="System.ValueTuple" version="4.5.0" targetFramework="net47" />
<package id="taglib-sharp-netstandard2.0" version="2.1.0" targetFramework="net47" />
<package id="VideoLAN.LibVLC.Mac" version="3.1.2" targetFramework="net47" />
<package id="Xam.Plugins.Settings" version="3.1.1" targetFramework="net47" />
<package id="Xamarin.Forms" version="3.6.0.344457" targetFramework="net47" />
<package id="Xamarin.Forms.DataGrid" version="3.1.0" targetFramework="net47" />
<package id="Xamarin.Forms.Platform.GTK" version="3.6.0.344457" targetFramework="net47" />

View File

@ -1,26 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:converters="clr-namespace:Aurora.Frontend.Converters"
x:Class="Aurora.App">
<Application
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:converters="clr-namespace:Aurora.Design.Converters"
x:Class="Aurora.App">
<Application.Resources>
<ResourceDictionary>
<!-- GENERAL COLORS -->
<Color x:Key="WhiteColor">#FFFFFF</Color>
<Color x:Key="BlackColor">#000000</Color>
<!-- THEME COLORS -->
<Color x:Key="AccentColor">#F5C210</Color>
<Color x:Key="ToolbarColor">#151C25</Color>
<Color x:Key="BackgroundColor">#1E2634</Color>
<Color x:Key="DarkBackgroundColor">#151C25</Color>
<Color x:Key="MenuBackgroundColor">#44545C</Color>
<!-- CONVERTERS -->
<converters:InverseBoolConverter x:Key="InverseBoolConverter" />
<converters:ToUpperConverter x:Key="ToUpperConverter" />
<ResourceDictionary><!-- GENERAL COLORS -->
<Color
x:Key="WhiteColor">#FFFFFF</Color>
<Color
x:Key="BlackColor">#000000</Color><!-- THEME COLORS -->
<Color
x:Key="AccentColor">#F5C210</Color>
<Color
x:Key="ToolbarColor">#151C25</Color>
<Color
x:Key="BackgroundColor">#1E2634</Color>
<Color
x:Key="DarkBackgroundColor">#151C25</Color>
<Color
x:Key="MenuBackgroundColor">#44545C</Color><!-- CONVERTERS -->
<converters:InverseBoolConverter
x:Key="InverseBoolConverter"/>
<converters:ToUpperConverter
x:Key="ToUpperConverter"/>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -1,5 +1,5 @@
using System;
using Aurora.Frontend.Views.Main;
using Aurora.Design.Views.Main;
using LibVLCSharp.Shared;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

View File

@ -1,45 +1,97 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ProduceAssemblyReference>true</ProduceAssemblyReference>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.6.0.264807" />
<PackageReference Include="Xamarin.Essentials" Version="1.0.1" />
<PackageReference Include="Xamarin.Forms.DataGrid" Version="3.1.0" />
<PackageReference Include="taglib-sharp-netstandard2.0" Version="2.1.0" />
<PackageReference Include="LibVLCSharp.Forms" Version="3.0.0" />
<PackageReference Include="VideoLAN.LibVLC.Mac" Version="3.1.3" />
</ItemGroup>
<ItemGroup>
<Folder Include="Frontend\" />
<Folder Include="Backend\" />
<Folder Include="Frontend\Components\" />
<Folder Include="Frontend\Views\" />
<Folder Include="Frontend\Views\Songs\" />
<Folder Include="Frontend\Views\MainView\" />
<Folder Include="Frontend\Behaviors\" />
<Folder Include="Frontend\Components\NavigationMenu\" />
<Folder Include="Frontend\Views\Albums\" />
<Folder Include="Frontend\Views\Artists\" />
<Folder Include="Frontend\Views\Stations\" />
<Folder Include="Backend\Utils\" />
<Folder Include="Backend\Models\" />
<Folder Include="Backend\Services\" />
<Folder Include="Frontend\Views\Party\" />
<Folder Include="Frontend\Components\HostSelector\" />
<Folder Include="Frontend\Components\MemberList\" />
</ItemGroup>
<ItemGroup>
<Compile Update="Frontend\Components\MusicPlayer\Player.xaml.cs">
<DependentUpon>Player.xaml</DependentUpon>
</Compile>
</ItemGroup>
<Project
Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ProduceAssemblyReference>true</ProduceAssemblyReference>
</PropertyGroup>
<PropertyGroup
Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference
Include="Xamarin.Forms"
Version="3.6.0.264807"/>
<PackageReference
Include="Xamarin.Essentials"
Version="1.0.1"/>
<PackageReference
Include="Xamarin.Forms.DataGrid"
Version="3.1.0"/>
<PackageReference
Include="taglib-sharp-netstandard2.0"
Version="2.1.0"/>
<PackageReference
Include="LibVLCSharp.Forms"
Version="3.0.0"/>
<PackageReference
Include="VideoLAN.LibVLC.Mac"
Version="3.1.3"/>
<PackageReference
Include="Grpc"
Version="1.21.0"/>
<PackageReference
Include="Grpc.Tools"
Version="1.21.0"
PrivateAssests="All"/>
<PackageReference
Include="Google.Protobuf"
Version="3.8.0"/>
<PackageReference
Include="Xam.Plugins.Settings"
Version="3.1.1"/>
</ItemGroup>
<ItemGroup>
<Folder
Include="Design\"/>
<Folder
Include="Design\Components\"/>
<Folder
Include="Design\Views\"/>
<Folder
Include="Design\Views\Songs\"/>
<Folder
Include="Design\Views\MainView\"/>
<Folder
Include="Design\Behaviors\"/>
<Folder
Include="Design\Components\NavigationMenu\"/>
<Folder
Include="Design\Views\Albums\"/>
<Folder
Include="Design\Views\Artists\"/>
<Folder
Include="Design\Views\Stations\"/>
<Folder
Include="Utils\"/>
<Folder
Include="Models\"/>
<Folder
Include="Services\"/>
<Folder
Include="Design\Views\Party\"/>
<Folder
Include="Design\Components\HostSelector\"/>
<Folder
Include="Design\Components\MemberList\"/>
<Folder
Include="Design\Components\Queue\"/>
<Folder
Include="Design\Views\Profile\"/>
</ItemGroup>
<ItemGroup>
<Compile
Update="Design\Components\MusicPlayer\Player.xaml.cs">
<DependentUpon>Player.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Protobuf
Include="Proto\general.proto"/>
<Protobuf
Include="Proto\party.proto"/>
<Protobuf
Include="Proto\playback.proto"/>
</ItemGroup>
</Project>

View File

@ -1,7 +1,7 @@
using System;
using Xamarin.Forms;
namespace Aurora.Frontend.Behaviors
namespace Aurora.Design.Behaviors
{
public class BehaviorBase<T> : Behavior<T> where T : BindableObject
{

View File

@ -3,7 +3,7 @@ using System.Reflection;
using System.Windows.Input;
using Xamarin.Forms;
namespace Aurora.Frontend.Behaviors
namespace Aurora.Design.Behaviors
{
public class EventToCommandBehavior : BehaviorBase<View>
{

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Windows.Input;
using Xamarin.Forms;
namespace Aurora.Frontend.Components.HorizontalList
namespace Aurora.Design.Components.HorizontalList
{
public class HorizontalList : Grid
{

View File

@ -0,0 +1,34 @@
<?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.Design.Components.HostSelector.HostSelector">
<ContentView.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition
Height="*"/>
</Grid.RowDefinitions>
<StackLayout
Grid.Row="0"
x:Name="CredentialEditorLayout"
Orientation="Horizontal"
HorizontalOptions="Center"
VerticalOptions="Start">
<Label
Text="Hostname"
VerticalOptions="Center"/>
<Entry
x:Name="HostnameEntry"/>
<Button
HorizontalOptions="Center"
x:Name="buttonHost"
Text="Host"/>
<Button
HorizontalOptions="Center"
x:Name="buttonClient"
Text="Join"/>
</StackLayout>
</Grid>
</ContentView.Content>
</ContentView>

View File

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace Aurora.Design.Components.HostSelector
{
public enum ConnectionType
{
Host,
Client,
}
public enum SelectorState
{
SelectingHost,
EnteringCredentials,
}
public partial class HostSelector : ContentView
{
public HostSelector()
{
InitializeComponent();
//Set initial conditions
CredentialEditorLayout.IsVisible = true;
buttonHost.Clicked += OnButtonHostClicked;
buttonClient.Clicked += OnButtonClientClicked;
HostnameEntry.TextChanged += (sender, e) =>
{
Hostname = e.NewTextValue;
};
}
/// <summary>
/// On the host button clicked.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">E.</param>
void OnButtonHostClicked(object sender, EventArgs e)
{
if (HostCommand.CanExecute(null))
{
HostCommand.Execute(null);
}
}
/// <summary>
/// On the client button clicked.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">E.</param>
void OnButtonClientClicked(object sender, EventArgs e)
{
if (JoinCommand.CanExecute(null))
{
JoinCommand.Execute(null);
}
}
#region Host Selected Command
public static readonly BindableProperty HostCommandProperty =
BindableProperty.Create(propertyName: "HostSelectedCommand",
returnType: typeof(Command),
declaringType: typeof(HostSelector));
public Command HostCommand
{
get { return (Command)GetValue(HostCommandProperty); }
set { SetValue(HostCommandProperty, value); }
}
#endregion Host Selected Command
#region Client Selected Command
public static readonly BindableProperty JoinCommandProperty =
BindableProperty.Create(propertyName: "JoinSelectedCommand",
returnType: typeof(Command),
declaringType: typeof(HostSelector));
public Command JoinCommand
{
get { return (Command)GetValue(JoinCommandProperty); }
set { SetValue(JoinCommandProperty, value); }
}
#endregion Client Selected Command
#region Hostname property
public static readonly BindableProperty HostnameProperty =
BindableProperty.Create(propertyName: "Hostname",
returnType: typeof(string),
declaringType: typeof(HostSelector),
defaultBindingMode: BindingMode.TwoWay,
propertyChanged: OnHostNameChanged);
public string Hostname
{
get { return (string)GetValue(HostnameProperty); }
set { SetValue(HostnameProperty, value); }
}
private static void OnHostNameChanged(BindableObject bindable, object oldValue, object newValue)
{
string newVal = newValue as string;
HostSelector instance = bindable as HostSelector;
if (instance.HostnameEntry.Text != newVal)
{
instance.HostnameEntry.Text = newVal;
}
}
#endregion Hostname property
}
}

View File

@ -2,7 +2,7 @@
<ContentView
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Aurora.Frontend.Components.MediaPlayer.Player">
x:Class="Aurora.Design.Components.MediaPlayer.Player">
<ContentView.Content>
<Grid>
<Grid.ColumnDefinitions>

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using Xamarin.Forms;
namespace Aurora.Frontend.Components.MediaPlayer
namespace Aurora.Design.Components.MediaPlayer
{
public partial class Player : ContentView
{

View File

@ -1,10 +1,10 @@
using System;
using Xamarin.Forms;
using Aurora.Frontend.Views;
using Aurora.Backend.Services.PlayerService;
using Aurora.Backend.Models.Media;
using Aurora.Design.Views;
using Aurora.Services.PlayerService;
using Aurora.Models.Media;
namespace Aurora.Frontend.Components.MediaPlayer
namespace Aurora.Design.Components.MediaPlayer
{
public class PlayerViewModel : BaseViewModel
{

View File

@ -2,8 +2,8 @@
<ContentView
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:hl="clr-namespace:Aurora.Frontend.Components.HorizontalList"
x:Class="Aurora.Frontend.Components.MemberList.MemberList">
xmlns:hl="clr-namespace:Aurora.Design.Components.HorizontalList"
x:Class="Aurora.Design.Components.MemberList.MemberList">
<ContentView.Content>
<StackLayout>
<hl:HorizontalList
@ -14,7 +14,7 @@
<DataTemplate>
<Frame>
<Label
Text="{Binding .}"/>
Text="{Binding Username}"/>
</Frame>
</DataTemplate>
</hl:HorizontalList.ItemTemplate>

View File

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

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Aurora.Frontend.Components.NavigationMenu
namespace Aurora.Design.Components.NavigationMenu
{
public class NavigationGroupItem : List<NavigationItem>
{

View File

@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Aurora.Frontend.Views.Main;
using Aurora.Design.Views.Main;
namespace Aurora.Frontend.Components.NavigationMenu
namespace Aurora.Design.Components.NavigationMenu
{
public class NavigationItem
{

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Aurora.Design.Components.NavigationMenu.NavigationMenu"
Title="Navigation">
<ContentView.Content>
<StackLayout>
<ListView
x:Name="MenuItemsListView"
SeparatorVisibility="None"
HasUnevenRows="true"
BackgroundColor="{StaticResource MenuBackgroundColor}"
IsGroupingEnabled="true"
CachingStrategy="RecycleElement">
<ListView.Header>
<Grid
BackgroundColor="#03A9F4">
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="10"/>
<ColumnDefinition
Width="*"/>
<ColumnDefinition
Width="10"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition
Height="30"/>
<RowDefinition
Height="80"/>
<RowDefinition
Height="Auto"/>
<RowDefinition
Height="10"/>
</Grid.RowDefinitions>
<Label
Grid.Column="1"
Grid.Row="2"
Text="Aurora"
Style="{DynamicResource SubtitleStyle}"/>
</Grid>
</ListView.Header>
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<Label
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Start"
Text="{Binding GroupHeading}"
FontSize="18"
TextColor="White"/>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout
Padding="15,10"
HorizontalOptions="FillAndExpand">
<Label
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
Text="{Binding Title}"
FontSize="24"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentView.Content>
</ContentPage>

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using Xamarin.Forms;
namespace Aurora.Frontend.Components.NavigationMenu
namespace Aurora.Design.Components.NavigationMenu
{
public partial class NavigationMenu : ContentPage
{

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<?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">
x:Class="Aurora.Design.Components.Queue.Queue">
<ContentView.Content>
<dg:DataGrid
x:Name="QueueDataGrid"

View File

@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using Xamarin.Forms;
using Xamarin.Forms.DataGrid;
using Aurora.Backend.Models.Media;
using Aurora.Models.Media;
namespace Aurora.Frontend.Components.Queue
namespace Aurora.Design.Components.Queue
{
public partial class Queue : ContentView
{

View File

@ -2,7 +2,7 @@
using System.Globalization;
using Xamarin.Forms;
namespace Aurora.Frontend.Converters
namespace Aurora.Design.Converters
{
public class InverseBoolConverter : IValueConverter
{

View File

@ -2,7 +2,7 @@
using System.Globalization;
using Xamarin.Forms;
namespace Aurora.Frontend.Converters
namespace Aurora.Design.Converters
{
public class ToUpperConverter : IValueConverter
{

View File

@ -2,7 +2,7 @@
<ContentView
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Aurora.Frontend.Views.Albums.AlbumsView">
x:Class="Aurora.Design.Views.Albums.AlbumsView">
<ContentPage.Content>
<Grid></Grid>
</ContentPage.Content>

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using Xamarin.Forms;
namespace Aurora.Frontend.Views.Albums
namespace Aurora.Design.Views.Albums
{
public partial class AlbumsView : ContentView
{

View File

@ -1,5 +1,5 @@
using System;
namespace Aurora.Frontend.Views.Albums
namespace Aurora.Design.Views.Albums
{
public class AlbumsViewModel
{

View File

@ -0,0 +1,7 @@
<?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.Design.Views.Artists.ArtistsView">
<ContentPage.Content></ContentPage.Content>
</ContentView>

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using Xamarin.Forms;
namespace Aurora.Frontend.Views.Artists
namespace Aurora.Design.Views.Artists
{
public partial class ArtistsView : ContentView
{

View File

@ -1,5 +1,5 @@
using System;
namespace Aurora.Frontend.Views.Artists
namespace Aurora.Design.Views.Artists
{
public class ArtistsViewModel
{

View File

@ -2,7 +2,7 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace Aurora.Frontend.Views
namespace Aurora.Design.Views
{
public class BaseViewModel : INotifyPropertyChanged
{

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<MasterDetailPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:Aurora.Design.Views.MainView"
xmlns:navigation="clr-namespace:Aurora.Design.Components.NavigationMenu"
x:Class="Aurora.Design.Views.Main.MainView"
MasterBehavior="Split">
<MasterDetailPage.Master>
<navigation:NavigationMenu
x:Name="MasterPage"
Items="{Binding Pages}"/>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<x:Arguments>
<views:PageContainer
x:Name="ContentPage"/>
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
</MasterDetailPage>

View File

@ -1,12 +1,12 @@
using System;
using System.Collections.ObjectModel;
using System.Linq;
using Aurora.Frontend.Components.NavigationMenu;
using Aurora.Frontend.Views.MainView;
using Aurora.Design.Components.NavigationMenu;
using Aurora.Design.Views.MainView;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Aurora.Frontend.Views.Main
namespace Aurora.Design.Views.Main
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MainView : MasterDetailPage

View File

@ -2,14 +2,15 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Aurora.Frontend.Components.NavigationMenu;
using Aurora.Frontend.Views.Albums;
using Aurora.Frontend.Views.Artists;
using Aurora.Frontend.Views.Songs;
using Aurora.Frontend.Views.Stations;
using Aurora.Frontend.Views.Party;
using Aurora.Design.Components.NavigationMenu;
using Aurora.Design.Views.Albums;
using Aurora.Design.Views.Artists;
using Aurora.Design.Views.Songs;
using Aurora.Design.Views.Stations;
using Aurora.Design.Views.Party;
using Aurora.Design.Views.Profile;
namespace Aurora.Frontend.Views.MainView
namespace Aurora.Design.Views.MainView
{
public class MainViewModel : BaseViewModel
{
@ -32,7 +33,7 @@ namespace Aurora.Frontend.Views.MainView
_pages = new ObservableCollection<NavigationItem>(new[]
{
new NavigationItem { Id = 4, Title = "Party", Group="Social", TargetType = typeof(PartyView)},
new NavigationItem { Id = 5, Title = "Profile", Group="Social", TargetType = typeof(ArtistsView)},
new NavigationItem { Id = 5, Title = "Profile", Group="Social", TargetType = typeof(ProfileView)},
new NavigationItem { Id = 0, Title = "Songs", Group="Library", TargetType = typeof(SongsView) },
new NavigationItem { Id = 1, Title = "Artists", Group="Library", TargetType = typeof(ArtistsView)},
new NavigationItem { Id = 2, Title = "Albums", Group="Library", TargetType = typeof(AlbumsView)},

View File

@ -2,9 +2,9 @@
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:components="clr-namespace:Aurora.Frontend.Components"
xmlns:mp="clr-namespace:Aurora.Frontend.Components.MediaPlayer"
x:Class="Aurora.Frontend.Views.MainView.PageContainer">
xmlns:components="clr-namespace:Aurora.Design.Components"
xmlns:mp="clr-namespace:Aurora.Design.Components.MediaPlayer"
x:Class="Aurora.Design.Views.MainView.PageContainer">
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using Xamarin.Forms;
namespace Aurora.Frontend.Views.MainView
namespace Aurora.Design.Views.MainView
{
public partial class PageContainer : ContentPage
{

View File

@ -0,0 +1,35 @@
<?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:hs="clr-namespace:Aurora.Design.Components.HostSelector"
xmlns:ml="clr-namespace:Aurora.Design.Components.MemberList"
xmlns:qu="clr-namespace:Aurora.Design.Components.Queue"
x:Class="Aurora.Design.Views.Party.PartyView">
<ContentView.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition
Height="*"/>
</Grid.RowDefinitions>
<StackLayout
Grid.Row="0"
IsVisible="{Binding IsNotSelectingHost}">
<Label
Text="Party Members"/>
<ml:MemberList
VerticalOptions="FillAndExpand"
Members="{Binding Members}"/>
<Label
Text="Queue"/>
<qu:Queue/>
</StackLayout>
<hs:HostSelector
Grid.Row="0"
Hostname="{Binding Hostname}"
HostCommand="{Binding HostCommand}"
JoinCommand="{Binding JoinCommand}"
IsVisible="{Binding IsSelectingHost}"/>
</Grid>
</ContentView.Content>
</ContentView>

View File

@ -1,8 +1,7 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace Aurora.Frontend.Views.Party
namespace Aurora.Design.Views.Party
{
public partial class PartyView : ContentView
{

View File

@ -0,0 +1,126 @@
using System;
using System.Collections.ObjectModel;
using Aurora.Executors;
using Aurora.Proto;
using Xamarin.Forms;
namespace Aurora.Design.Views.Party
{
enum PartyState
{
SelectingHost,
InParty,
Connecting,
}
public class PartyViewModel : BaseViewModel
{
private PartyState _state;
private BaseExecutor _executor;
private string _hostname;
private ObservableCollection<PartyMember> _members;
public PartyViewModel()
{
this.JoinCommand = new Command(OnJoinExecute, CanJoinExecute);
this.HostCommand = new Command(OnHostExecute, CanHostExecute);
_members = new ObservableCollection<PartyMember>();
State(PartyState.SelectingHost);
}
#region Properties
public ObservableCollection<PartyMember> Members
{
get
{
return _members;
}
set { SetProperty(ref _members, value); }
}
public bool IsSelectingHost
{
get { return _state == PartyState.SelectingHost; }
}
public bool IsNotSelectingHost
{
get { return _state != PartyState.SelectingHost; }
}
public Command JoinCommand { get; set; }
public Command HostCommand { get; set; }
public string Hostname
{
get { return _hostname; }
set { SetProperty(ref _hostname, value); }
}
#endregion Properties
private void State(PartyState state)
{
_state = state;
OnPropertyChanged("IsSelectingHost");
OnPropertyChanged("IsNotSelectingHost");
}
#region Commands
private void OnJoinExecute()
{
_executor = BaseExecutor.CreateExecutor<ClientExecutor>();
_executor.Connect(this.Hostname);
SetUpMembers();
State(PartyState.Connecting);
}
private bool CanJoinExecute()
{
return true;
}
private void OnHostExecute()
{
//Instantiate and initialize all executors
_executor = BaseExecutor.CreateExecutor<HostExecutor>();
_executor.Connect(this.Hostname);
SetUpMembers();
//Change state
State(PartyState.Connecting);
}
private bool CanHostExecute()
{
return true;
}
#endregion Commands
private void SetUpMembers()
{
_members = _executor.PartyMembers;
OnPropertyChanged("Members");
_executor.PartyMembers.CollectionChanged += (sender, e) =>
{
if (_executor != null)
{
_members = _executor.PartyMembers;
}
OnPropertyChanged("Members");
};
}
}
}

View File

@ -0,0 +1,27 @@
<?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.Design.Views.Profile.ProfileView">
<ContentView.Content>
<StackLayout
Orientation="Vertical">
<StackLayout
Orientation="Horizontal">
<Label
VerticalOptions="Center"
Text="Username"/>
<Entry
Text="{Binding Username}"/>
</StackLayout>
<StackLayout
Orientation="Horizontal">
<Label
VerticalOptions="Center"
Text="Default Port"/>
<Entry
Text="{Binding Port}"/>
</StackLayout>
</StackLayout>
</ContentView.Content>
</ContentView>

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace Aurora.Design.Views.Profile
{
public partial class ProfileView : ContentView
{
public ProfileView()
{
InitializeComponent();
BindingContext = new ProfileViewModel();
}
}
}

View File

@ -0,0 +1,34 @@
using System;
using Aurora.Services;
namespace Aurora.Design.Views.Profile
{
public class ProfileViewModel : BaseViewModel
{
public ProfileViewModel()
{
}
public string Username
{
get { return SettingsService.Instance.Username; }
set
{
SettingsService.Instance.Username = value;
OnPropertyChanged("Username");
}
}
public string Port
{
get { return SettingsService.Instance.DefaultPort.ToString(); }
set
{
Int32.TryParse(value, out int portNum);
SettingsService.Instance.DefaultPort = portNum;
OnPropertyChanged("Port");
}
}
}
}

View File

@ -2,9 +2,9 @@
<ContentView
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:songs="clr-namespace:Aurora.Frontend.Views.Songs"
xmlns:songs="clr-namespace:Aurora.Design.Views.Songs"
xmlns:dg="clr-namespace:Xamarin.Forms.DataGrid;assembly=Xamarin.Forms.DataGrid"
x:Class="Aurora.Frontend.Views.Songs.SongsView">
x:Class="Aurora.Design.Views.Songs.SongsView">
<ContentPage.BindingContext>
<songs:SongsViewModel
x:Name="songsViewModel"/>

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using Xamarin.Forms;
namespace Aurora.Frontend.Views.Songs
namespace Aurora.Design.Views.Songs
{
public partial class SongsView : ContentView
{

View File

@ -1,10 +1,10 @@
using System.Collections.ObjectModel;
using Aurora.Backend.Models.Media;
using Aurora.Backend.Services;
using Aurora.Backend.Services.PlayerService;
using Aurora.Models.Media;
using Aurora.Services;
using Aurora.Services.PlayerService;
using Xamarin.Forms;
namespace Aurora.Frontend.Views.Songs
namespace Aurora.Design.Views.Songs
{
public class SongsViewModel : BaseViewModel
{

View File

@ -0,0 +1,7 @@
<?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.Design.Views.Stations.StationsView">
<ContentPage.Content></ContentPage.Content>
</ContentView>

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using Xamarin.Forms;
namespace Aurora.Frontend.Views.Stations
namespace Aurora.Design.Views.Stations
{
public partial class StationsView : ContentView
{

View File

@ -1,5 +1,5 @@
using System;
namespace Aurora.Frontend.Views.Stations
namespace Aurora.Design.Views.Stations
{
public class StationsViewModel
{

View File

@ -0,0 +1,59 @@
using System;
using System.Reflection;
using System.Linq;
using System.Collections.ObjectModel;
using Aurora.Proto;
namespace Aurora.Executors
{
public abstract class BaseExecutor
{
protected BaseExecutor()
{
}
public Type ExecutorType { get; protected set; }
public abstract ObservableCollection<PartyMember> PartyMembers { get; }
public static BaseExecutor CreateExecutor<T>()
{
BaseExecutor executor = null;
if (typeof(T) == typeof(HostExecutor))
{
executor = new HostExecutor();
executor.ExecutorType = typeof(HostExecutor);
}
else if (typeof(T) == typeof(ClientExecutor))
{
executor = new ClientExecutor();
executor.ExecutorType = typeof(ClientExecutor);
}
else
{
throw new InvalidOperationException("Cannot create an executor of type: " + nameof(T));
}
return executor;
}
public abstract void Connect(string hostname);
public abstract void Close();
public abstract ObservableCollection<PartyMember> GetMembers();
public abstract void GetQueue();
public abstract void AddToQueue();
public abstract void RemoveFromQueue();
}
public enum ExecutorType
{
Server,
Client
}
}

View File

@ -0,0 +1,89 @@
using System;
using System.Collections.ObjectModel;
using Grpc.Core;
using Aurora.Proto;
using Aurora.Models;
using Aurora.Services;
namespace Aurora.Executors
{
public class ClientExecutor : BaseExecutor
{
private Channel _channel;
private RemotePartyService.RemotePartyServiceClient _remotePartyClient;
private RemotePlaybackService.RemotePlaybackServiceClient _remotePlaybackClient;
private ObservableCollection<PartyMember> _partyMembers;
public ClientExecutor()
{
_partyMembers = new ObservableCollection<PartyMember>();
}
#region Properties
public override ObservableCollection<PartyMember> PartyMembers
{
get { return _partyMembers; }
}
#endregion Properties
public override void Connect(string hostname)
{
_channel = new Channel(string.Format("{0}:{1}", hostname, SettingsService.Instance.DefaultPort), ChannelCredentials.Insecure);
_remotePartyClient = new RemotePartyService.RemotePartyServiceClient(_channel);
_remotePlaybackClient = new RemotePlaybackService.RemotePlaybackServiceClient(_channel);
JoinParty();
}
public override async void Close()
{
await _channel.ShutdownAsync();
}
public override void AddToQueue()
{
throw new NotImplementedException();
}
public override ObservableCollection<PartyMember> GetMembers()
{
throw new NotImplementedException();
}
public override void GetQueue()
{
throw new NotImplementedException();
}
public override void RemoveFromQueue()
{
throw new NotImplementedException();
}
private async void JoinParty()
{
await _remotePartyClient.JoinPartyAsync(new JoinPartyRequest
{
UserName = SettingsService.Instance.Username,
});
MembersResponse resposne = _remotePartyClient.GetPartyMembers(new Empty());
//Add members
foreach (PartyMember member in resposne.Members)
{
_partyMembers.Add(member);
}
//Remove out of date members
foreach (PartyMember member in _partyMembers)
{
if (!resposne.Members.Contains(member))
{
_partyMembers.Remove(member);
}
}
}
}
}

View File

@ -0,0 +1,68 @@
using System;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using Aurora.Models;
using Aurora.Executors;
using Aurora.Services;
using Aurora.Proto;
using Aurora.RemoteImpl;
namespace Aurora.Executors
{
public class HostExecutor : BaseExecutor
{
RemotePartyServiceImpl _remotePartyServiceImpl;
RemotePlaybackServiceImpl _remotePlaybackImpl;
public HostExecutor()
{
_remotePartyServiceImpl = new RemotePartyServiceImpl();
_remotePlaybackImpl = new RemotePlaybackServiceImpl();
}
public override void Connect(string hostname)
{
//Initialize gRPC server
ServerService.Instance.Initialize(hostname);
//Register grpc RemoteService with singleton server service
ServerService.Instance.RegisterService(RemotePartyService.BindService(_remotePartyServiceImpl));
ServerService.Instance.RegisterService(RemotePlaybackService.BindService(_remotePlaybackImpl));
//start gRPC server
ServerService.Instance.Start();
}
#region Properties
public override ObservableCollection<PartyMember> PartyMembers
{
get { return _remotePartyServiceImpl.PartyMembers; }
}
#endregion Properties
public override async void Close()
{
await ServerService.Instance.Stop();
}
public override void AddToQueue()
{
throw new NotImplementedException();
}
public override ObservableCollection<PartyMember> GetMembers()
{
throw new NotImplementedException();
}
public override void GetQueue()
{
throw new NotImplementedException();
}
public override void RemoveFromQueue()
{
throw new NotImplementedException();
}
}
}

View File

@ -1,13 +0,0 @@
<?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.Components.HostSelector.HostSelector">
<ContentView.Content>
<StackLayout HorizontalOptions="Center"
VerticalOptions="Center"
BackgroundColor="Red">
<Button Text="Host Session"/>
<Button Text="Join Session"/>
</StackLayout>
</ContentView.Content>
</ContentView>

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace Aurora.Frontend.Components.HostSelector
{
public partial class HostSelector : ContentView
{
public HostSelector()
{
InitializeComponent();
}
}
}

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Aurora.Frontend.Components.NavigationMenu.NavigationMenu"
Title="Navigation">
<ContentView.Content>
<StackLayout>
<ListView x:Name="MenuItemsListView"
SeparatorVisibility="None"
HasUnevenRows="true"
BackgroundColor="{StaticResource MenuBackgroundColor}"
IsGroupingEnabled="true"
CachingStrategy="RecycleElement">
<ListView.Header>
<Grid BackgroundColor="#03A9F4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="10" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="80" />
<RowDefinition Height="Auto" />
<RowDefinition Height="10" />
</Grid.RowDefinitions>
<Label Grid.Column="1" Grid.Row="2" Text="Aurora" Style="{DynamicResource SubtitleStyle}" />
</Grid>
</ListView.Header>
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<Label VerticalOptions="FillAndExpand" VerticalTextAlignment="Start" Text="{Binding GroupHeading}" FontSize="18" TextColor="White"/>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Padding="15,10" HorizontalOptions="FillAndExpand">
<Label VerticalOptions="FillAndExpand" VerticalTextAlignment="Center" Text="{Binding Title}" FontSize="24" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentView.Content>
</ContentPage>

View File

@ -1,5 +0,0 @@
<?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.Artists.ArtistsView">
<ContentPage.Content>
</ContentPage.Content>
</ContentView>

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:Aurora.Frontend.Views.MainView"
xmlns:navigation="clr-namespace:Aurora.Frontend.Components.NavigationMenu"
x:Class="Aurora.Frontend.Views.Main.MainView"
MasterBehavior="Split">
<MasterDetailPage.Master>
<navigation:NavigationMenu x:Name="MasterPage" Items="{Binding Pages}"/>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<x:Arguments>
<views:PageContainer x:Name="ContentPage" />
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
</MasterDetailPage>

View File

@ -1,29 +0,0 @@
<?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: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"
AbsoluteLayout.LayoutBounds="0.5,0.5,0.7,0.7"
BackgroundColor="Green"
IsVisible="False"/>
</AbsoluteLayout>
</ContentView.Content>
</ContentView>

View File

@ -1,31 +0,0 @@
using System;
using System.Collections.ObjectModel;
namespace Aurora.Frontend.Views.Party
{
public class PartyViewModel : BaseViewModel
{
private ObservableCollection<string> _members;
public PartyViewModel()
{
_members = new ObservableCollection<string>()
{
"Kevin",
"Brandon",
"Sheila",
"Dale",
"Austin",
"Tori",
"Ashley",
"Spencer",
};
OnPropertyChanged("Members");
}
public ObservableCollection<string> Members
{
get { return _members; }
set { SetProperty(ref _members, value); }
}
}
}

View File

@ -1,5 +0,0 @@
<?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.Stations.StationsView">
<ContentPage.Content>
</ContentPage.Content>
</ContentView>

View File

@ -1,6 +1,6 @@
using System;
namespace Aurora.Backend.Models.Media
namespace Aurora.Models.Media
{
public class AudioMetadata : BaseMetadata
{

View File

@ -1,7 +1,7 @@
using System;
using System.IO;
namespace Aurora.Backend.Models.Media
namespace Aurora.Models.Media
{
public abstract class BaseMedia
{

View File

@ -1,5 +1,5 @@
using System;
namespace Aurora.Backend.Models.Media
namespace Aurora.Models.Media
{
public class BaseMetadata
{

View File

@ -1,7 +1,7 @@
using System;
using System.IO;
namespace Aurora.Backend.Models.Media
namespace Aurora.Models.Media
{
public class LocalAudio : BaseMedia
{

View File

@ -1,5 +1,5 @@
using System;
namespace Aurora.Backend.Models.Media
namespace Aurora.Models.Media
{
public enum MediaTypeEnum
{

View File

@ -0,0 +1,10 @@
syntax = "proto3";
package Aurora.Proto;
message Chunk {
bytes Content = 1;
}
message Empty{
}

46
Aurora/Proto/party.proto Normal file
View File

@ -0,0 +1,46 @@
syntax = "proto3";
package Aurora.Proto;
import "Proto/general.proto";
service RemotePartyService {
//Party Service
rpc JoinParty(JoinPartyRequest) returns (JoinPartyResponse);
rpc LeaveParty(LeavePartyRequest) returns (LeavePartyResponse);
rpc GetPartyMembers(Empty) returns (MembersResponse);
}
message JoinPartyRequest {
string userName = 2;
}
message JoinPartyResponse {
PartyJoinedStatusEnum status = 1;
}
message LeavePartyRequest {
string clientId = 1;
}
message LeavePartyResponse {
PartyJoinedStatusEnum status = 1;
}
message PartyMember {
string userName = 1;
string id = 2;
string ipAddress = 3;
int32 port = 4;
}
message MembersResponse {
repeated PartyMember members = 1;
}
enum PartyJoinedStatusEnum {
Connected = 0;
Disconnected = 1;
}

View File

@ -0,0 +1,21 @@
syntax = "proto3";
package Aurora.Proto;
import "Proto/general.proto";
service RemotePlaybackService {
//Playback Service
rpc GetPartyStream(Empty) returns (stream Chunk) {};
}
enum TransferStatusCode {
Unknown = 0;
Ok = 1;
Failed = 2;
}
message TransferStatus {
string Message = 1;
TransferStatusCode Code = 2;
}

View File

@ -0,0 +1,66 @@
using System;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using System.Linq;
using Aurora.Proto;
using Aurora.Models;
using Aurora.Services;
namespace Aurora.RemoteImpl
{
public class RemotePartyServiceImpl : RemotePartyService.RemotePartyServiceBase
{
/// <summary>
/// Dictionary of party members. Key -> ClientId
/// </summary>
private ObservableCollection<PartyMember> _partyMembers;
public RemotePartyServiceImpl()
{
_partyMembers = new ObservableCollection<PartyMember>();
//Add self to members list
_partyMembers.Add(new PartyMember
{
UserName = SettingsService.Instance.Username,
Id = "asdf",
IpAddress = ServerService.Instance.Hostname,
Port = ServerService.Instance.Port
});
}
public ObservableCollection<PartyMember> PartyMembers
{
get
{
return _partyMembers;
}
}
public override Task<JoinPartyResponse> JoinParty(JoinPartyRequest request, Grpc.Core.ServerCallContext context)
{
_partyMembers.Add(new PartyMember()
{
UserName = request.UserName,
IpAddress = context.Host,
});
JoinPartyResponse response = new JoinPartyResponse() { Status = PartyJoinedStatusEnum.Connected };
return Task.FromResult(response);
}
public override Task<LeavePartyResponse> LeaveParty(LeavePartyRequest request, Grpc.Core.ServerCallContext context)
{
_partyMembers.Remove(_partyMembers.Where(e => e.Id == request.ClientId).Single());
LeavePartyResponse response = new LeavePartyResponse() { Status = PartyJoinedStatusEnum.Disconnected };
return Task.FromResult(response);
}
public override Task<MembersResponse> GetPartyMembers(Empty empty, Grpc.Core.ServerCallContext context)
{
MembersResponse response = new MembersResponse();
response.Members.AddRange(_partyMembers);
return Task.FromResult(response);
}
}
}

View File

@ -0,0 +1,38 @@
using System;
using System.Threading.Tasks;
using System.IO;
using Aurora.Proto;
using Aurora.Models;
namespace Aurora.RemoteImpl
{
public class RemotePlaybackServiceImpl : RemotePlaybackService.RemotePlaybackServiceBase
{
public RemotePlaybackServiceImpl()
{
}
public override async Task GetPartyStream(Empty empty,
Grpc.Core.IServerStreamWriter<Chunk> responseStream,
Grpc.Core.ServerCallContext context)
{
throw new NotImplementedException("Working on it");
// //Send stream
// string cwd = Directory.GetCurrentDirectory();
// using (FileStream fs = System.IO.File.OpenRead(Path.Combine(cwd, request.FileName)))
// {
// Console.WriteLine("Begin sending file");
// byte[] buffer = new byte[2048]; // read in chunks of 2KB
// int bytesRead;
// while ((bytesRead = fs.Read(buffer, 0, buffer.Length)) > 0)
// {
// Google.Protobuf.ByteString bufferByteString = Google.Protobuf.ByteString.CopyFrom(buffer);
// await responseStream.WriteAsync(new Chunk { Content = bufferByteString });
// }
// Console.WriteLine("Done sending file");
// };
}
}
}

View File

@ -1,6 +1,6 @@
using System;
namespace Aurora.Backend.Services
namespace Aurora.Services
{
public abstract class BaseService<T> where T : class
{

View File

@ -2,10 +2,10 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using Aurora.Backend.Models.Media;
using Aurora.Backend.Utils;
using Aurora.Models.Media;
using Aurora.Utils;
namespace Aurora.Backend.Services
namespace Aurora.Services
{
public class LibraryService : BaseService<LibraryService>
{

View File

@ -1,7 +1,7 @@
using System;
using Aurora.Backend.Models.Media;
using Aurora.Models.Media;
namespace Aurora.Backend.Services.PlayerService
namespace Aurora.Services.PlayerService
{
public delegate void MediaChangedEventHandler(object source, MediaChangedEventArgs e);

View File

@ -1,7 +1,7 @@
using System;
using Aurora.Backend.Models.Media;
using Aurora.Models.Media;
namespace Aurora.Backend.Services.PlayerService
namespace Aurora.Services.PlayerService
{
public delegate void PlaybackStateChangedEventHandler(object source, PlaybackStateChangedEventArgs e);

View File

@ -1,8 +1,8 @@
using System;
using Aurora.Backend.Models.Media;
using Aurora.Models.Media;
using LibVLCSharp.Shared;
namespace Aurora.Backend.Services.PlayerService
namespace Aurora.Services.PlayerService
{
public class PlayerService : BaseService<PlayerService>
{

View File

@ -0,0 +1,79 @@
using System;
using System.Threading.Tasks;
using Grpc.Core;
using Aurora.Proto;
namespace Aurora.Services
{
public class ServerService : BaseService<ServerService>
{
private string _hostname = "127.0.0.1";
private int _port = SettingsService.Instance.DefaultPort;
private Grpc.Core.Server _server;
/// <summary>
/// Constructor. Registers GRPC service implementations.
/// </summary>
public ServerService()
{
}
public int Port
{
get { return _port; }
}
public string Hostname
{
get { return _hostname; }
}
public void Initialize(string hostname)
{
this._hostname = hostname;
_server = new Grpc.Core.Server
{
Ports = { new ServerPort(_hostname, _port, ServerCredentials.Insecure) }
};
}
/// <summary>
/// Start Server
/// </summary>
public void Start()
{
try
{
Console.WriteLine(string.Format("Starting gRPC server at hostname: {0}, port: {1}", _hostname, _port));
_server.Start();
}
catch (Exception ex)
{
Console.WriteLine(string.Format("Error starting gRPC server: {0}", ex.Message));
}
}
/// <summary>
/// Shutdown server async.
/// </summary>
/// <returns>Task</returns>
public async Task Stop()
{
await _server.ShutdownAsync();
}
public async Task Reset()
{
await Stop();
_server = new Grpc.Core.Server
{
Ports = { new ServerPort("localhost", _port, ServerCredentials.Insecure) }
};
}
public void RegisterService(ServerServiceDefinition definition)
{
_server.Services.Add(definition);
}
}
}

View File

@ -0,0 +1,51 @@
using System;
using System.Threading;
using Plugin.Settings;
using Plugin.Settings.Abstractions;
namespace Aurora.Services
{
public class SettingsService : BaseService<SettingsService>
{
private Lazy<ISettings> _appSettings;
private string _usernameKey = "username";
private string _defaultPortKey = "port";
public SettingsService()
{
}
public ISettings AppSettings
{
get
{
if (_appSettings == null)
{
_appSettings = new Lazy<ISettings>(() => CrossSettings.Current, LazyThreadSafetyMode.PublicationOnly);
}
return _appSettings.Value;
}
set
{
_appSettings = new Lazy<ISettings>(() => value, LazyThreadSafetyMode.PublicationOnly);
}
}
public string Username
{
get { return AppSettings.GetValueOrDefault(_usernameKey, ""); }
set
{
AppSettings.AddOrUpdateValue(_usernameKey, value);
}
}
public int DefaultPort
{
get { return AppSettings.GetValueOrDefault(_defaultPortKey, 4005); }
set { AppSettings.AddOrUpdateValue(_defaultPortKey, value); }
}
}
}

View File

@ -5,7 +5,7 @@ using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Aurora.Backend.Utils
namespace Aurora.Utils
{
public class FileSystemUtils
{

1
start_second.sh Executable file
View File

@ -0,0 +1 @@
mono --debug Aurora.gtk/bin/Debug/Aurora.gtk.exe