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:
commit
74f5d3e9c6
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<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')" />
|
<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>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@ -110,6 +111,25 @@
|
|||||||
<Reference Include="LibVLCSharp.Forms.Platforms.GTK">
|
<Reference Include="LibVLCSharp.Forms.Platforms.GTK">
|
||||||
<HintPath>..\packages\LibVLCSharp.Forms.GTK.3.0.0\lib\net47\LibVLCSharp.Forms.Platforms.GTK.dll</HintPath>
|
<HintPath>..\packages\LibVLCSharp.Forms.GTK.3.0.0\lib\net47\LibVLCSharp.Forms.Platforms.GTK.dll</HintPath>
|
||||||
</Reference>
|
</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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="gtk-gui\gui.stetic">
|
<EmbeddedResource Include="gtk-gui\gui.stetic">
|
||||||
@ -134,6 +154,7 @@
|
|||||||
<Compile Include="gtk-gui\MainWindow.cs" />
|
<Compile Include="gtk-gui\MainWindow.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Helpers\Settings.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
@ -463,4 +484,6 @@
|
|||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<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\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\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>
|
</Project>
|
44
Aurora.gtk/Helpers/Settings.cs
Normal file
44
Aurora.gtk/Helpers/Settings.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}*/
|
@ -1,5 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<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" version="3.0.0" targetFramework="net47" />
|
||||||
<package id="LibVLCSharp.Forms" 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" />
|
<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" version="1.1.8" targetFramework="net47" />
|
||||||
<package id="Microsoft.Bcl.Async" version="1.0.168" 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="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" version="4.3.0" targetFramework="net47" />
|
||||||
<package id="System.Reflection.TypeExtensions" version="4.4.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" />
|
<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="System.ValueTuple" version="4.5.0" targetFramework="net47" />
|
||||||
<package id="taglib-sharp-netstandard2.0" version="2.1.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="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" version="3.6.0.344457" targetFramework="net47" />
|
||||||
<package id="Xamarin.Forms.DataGrid" version="3.1.0" 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" />
|
<package id="Xamarin.Forms.Platform.GTK" version="3.6.0.344457" targetFramework="net47" />
|
||||||
|
@ -1,26 +1,29 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Application xmlns="http://xamarin.com/schemas/2014/forms"
|
<Application
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:converters="clr-namespace:Aurora.Frontend.Converters"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
x:Class="Aurora.App">
|
xmlns:converters="clr-namespace:Aurora.Design.Converters"
|
||||||
|
x:Class="Aurora.App">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary><!-- GENERAL COLORS -->
|
||||||
|
<Color
|
||||||
<!-- GENERAL COLORS -->
|
x:Key="WhiteColor">#FFFFFF</Color>
|
||||||
<Color x:Key="WhiteColor">#FFFFFF</Color>
|
<Color
|
||||||
<Color x:Key="BlackColor">#000000</Color>
|
x:Key="BlackColor">#000000</Color><!-- THEME COLORS -->
|
||||||
|
<Color
|
||||||
<!-- THEME COLORS -->
|
x:Key="AccentColor">#F5C210</Color>
|
||||||
<Color x:Key="AccentColor">#F5C210</Color>
|
<Color
|
||||||
<Color x:Key="ToolbarColor">#151C25</Color>
|
x:Key="ToolbarColor">#151C25</Color>
|
||||||
<Color x:Key="BackgroundColor">#1E2634</Color>
|
<Color
|
||||||
<Color x:Key="DarkBackgroundColor">#151C25</Color>
|
x:Key="BackgroundColor">#1E2634</Color>
|
||||||
<Color x:Key="MenuBackgroundColor">#44545C</Color>
|
<Color
|
||||||
|
x:Key="DarkBackgroundColor">#151C25</Color>
|
||||||
<!-- CONVERTERS -->
|
<Color
|
||||||
<converters:InverseBoolConverter x:Key="InverseBoolConverter" />
|
x:Key="MenuBackgroundColor">#44545C</Color><!-- CONVERTERS -->
|
||||||
<converters:ToUpperConverter x:Key="ToUpperConverter" />
|
<converters:InverseBoolConverter
|
||||||
|
x:Key="InverseBoolConverter"/>
|
||||||
|
<converters:ToUpperConverter
|
||||||
|
x:Key="ToUpperConverter"/>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using Aurora.Frontend.Views.Main;
|
using Aurora.Design.Views.Main;
|
||||||
using LibVLCSharp.Shared;
|
using LibVLCSharp.Shared;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Xamarin.Forms.Xaml;
|
using Xamarin.Forms.Xaml;
|
||||||
|
@ -1,45 +1,97 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project
|
||||||
|
Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<ProduceAssemblyReference>true</ProduceAssemblyReference>
|
<ProduceAssemblyReference>true</ProduceAssemblyReference>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
<ItemGroup>
|
<PackageReference
|
||||||
<PackageReference Include="Xamarin.Forms" Version="3.6.0.264807" />
|
Include="Xamarin.Forms"
|
||||||
<PackageReference Include="Xamarin.Essentials" Version="1.0.1" />
|
Version="3.6.0.264807"/>
|
||||||
<PackageReference Include="Xamarin.Forms.DataGrid" Version="3.1.0" />
|
<PackageReference
|
||||||
<PackageReference Include="taglib-sharp-netstandard2.0" Version="2.1.0" />
|
Include="Xamarin.Essentials"
|
||||||
<PackageReference Include="LibVLCSharp.Forms" Version="3.0.0" />
|
Version="1.0.1"/>
|
||||||
<PackageReference Include="VideoLAN.LibVLC.Mac" Version="3.1.3" />
|
<PackageReference
|
||||||
</ItemGroup>
|
Include="Xamarin.Forms.DataGrid"
|
||||||
<ItemGroup>
|
Version="3.1.0"/>
|
||||||
<Folder Include="Frontend\" />
|
<PackageReference
|
||||||
<Folder Include="Backend\" />
|
Include="taglib-sharp-netstandard2.0"
|
||||||
<Folder Include="Frontend\Components\" />
|
Version="2.1.0"/>
|
||||||
<Folder Include="Frontend\Views\" />
|
<PackageReference
|
||||||
<Folder Include="Frontend\Views\Songs\" />
|
Include="LibVLCSharp.Forms"
|
||||||
<Folder Include="Frontend\Views\MainView\" />
|
Version="3.0.0"/>
|
||||||
<Folder Include="Frontend\Behaviors\" />
|
<PackageReference
|
||||||
<Folder Include="Frontend\Components\NavigationMenu\" />
|
Include="VideoLAN.LibVLC.Mac"
|
||||||
<Folder Include="Frontend\Views\Albums\" />
|
Version="3.1.3"/>
|
||||||
<Folder Include="Frontend\Views\Artists\" />
|
<PackageReference
|
||||||
<Folder Include="Frontend\Views\Stations\" />
|
Include="Grpc"
|
||||||
<Folder Include="Backend\Utils\" />
|
Version="1.21.0"/>
|
||||||
<Folder Include="Backend\Models\" />
|
<PackageReference
|
||||||
<Folder Include="Backend\Services\" />
|
Include="Grpc.Tools"
|
||||||
<Folder Include="Frontend\Views\Party\" />
|
Version="1.21.0"
|
||||||
<Folder Include="Frontend\Components\HostSelector\" />
|
PrivateAssests="All"/>
|
||||||
<Folder Include="Frontend\Components\MemberList\" />
|
<PackageReference
|
||||||
</ItemGroup>
|
Include="Google.Protobuf"
|
||||||
<ItemGroup>
|
Version="3.8.0"/>
|
||||||
<Compile Update="Frontend\Components\MusicPlayer\Player.xaml.cs">
|
<PackageReference
|
||||||
<DependentUpon>Player.xaml</DependentUpon>
|
Include="Xam.Plugins.Settings"
|
||||||
</Compile>
|
Version="3.1.1"/>
|
||||||
</ItemGroup>
|
</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>
|
</Project>
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Behaviors
|
namespace Aurora.Design.Behaviors
|
||||||
{
|
{
|
||||||
public class BehaviorBase<T> : Behavior<T> where T : BindableObject
|
public class BehaviorBase<T> : Behavior<T> where T : BindableObject
|
||||||
{
|
{
|
@ -3,7 +3,7 @@ using System.Reflection;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Behaviors
|
namespace Aurora.Design.Behaviors
|
||||||
{
|
{
|
||||||
public class EventToCommandBehavior : BehaviorBase<View>
|
public class EventToCommandBehavior : BehaviorBase<View>
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Components.HorizontalList
|
namespace Aurora.Design.Components.HorizontalList
|
||||||
{
|
{
|
||||||
public class HorizontalList : Grid
|
public class HorizontalList : Grid
|
||||||
{
|
{
|
34
Aurora/Design/Components/HostSelector/HostSelector.xaml
Normal file
34
Aurora/Design/Components/HostSelector/HostSelector.xaml
Normal 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>
|
121
Aurora/Design/Components/HostSelector/HostSelector.xaml.cs
Normal file
121
Aurora/Design/Components/HostSelector/HostSelector.xaml.cs
Normal 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
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,7 +2,7 @@
|
|||||||
<ContentView
|
<ContentView
|
||||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
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>
|
<ContentView.Content>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Components.MediaPlayer
|
namespace Aurora.Design.Components.MediaPlayer
|
||||||
{
|
{
|
||||||
public partial class Player : ContentView
|
public partial class Player : ContentView
|
||||||
{
|
{
|
@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Aurora.Frontend.Views;
|
using Aurora.Design.Views;
|
||||||
using Aurora.Backend.Services.PlayerService;
|
using Aurora.Services.PlayerService;
|
||||||
using Aurora.Backend.Models.Media;
|
using Aurora.Models.Media;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Components.MediaPlayer
|
namespace Aurora.Design.Components.MediaPlayer
|
||||||
{
|
{
|
||||||
public class PlayerViewModel : BaseViewModel
|
public class PlayerViewModel : BaseViewModel
|
||||||
{
|
{
|
@ -2,8 +2,8 @@
|
|||||||
<ContentView
|
<ContentView
|
||||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
xmlns:hl="clr-namespace:Aurora.Frontend.Components.HorizontalList"
|
xmlns:hl="clr-namespace:Aurora.Design.Components.HorizontalList"
|
||||||
x:Class="Aurora.Frontend.Components.MemberList.MemberList">
|
x:Class="Aurora.Design.Components.MemberList.MemberList">
|
||||||
<ContentView.Content>
|
<ContentView.Content>
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<hl:HorizontalList
|
<hl:HorizontalList
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Frame>
|
<Frame>
|
||||||
<Label
|
<Label
|
||||||
Text="{Binding .}"/>
|
Text="{Binding Username}"/>
|
||||||
</Frame>
|
</Frame>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</hl:HorizontalList.ItemTemplate>
|
</hl:HorizontalList.ItemTemplate>
|
@ -1,12 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Collections.Specialized;
|
||||||
using Xamarin.Forms;
|
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
|
public partial class MemberList : ContentView
|
||||||
{
|
{
|
||||||
|
private static ObservableCollection<PartyMember> _newSource;
|
||||||
public MemberList()
|
public MemberList()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -21,7 +23,7 @@ namespace Aurora.Frontend.Components.MemberList
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static readonly BindableProperty MembersProperty =
|
public static readonly BindableProperty MembersProperty =
|
||||||
BindableProperty.Create(propertyName: "Members",
|
BindableProperty.Create(propertyName: "Members",
|
||||||
returnType: typeof(IEnumerable<string>),
|
returnType: typeof(ObservableCollection<PartyMember>),
|
||||||
declaringType: typeof(MemberList),
|
declaringType: typeof(MemberList),
|
||||||
defaultBindingMode: BindingMode.Default,
|
defaultBindingMode: BindingMode.Default,
|
||||||
propertyChanged: OnMembersChanged);
|
propertyChanged: OnMembersChanged);
|
||||||
@ -30,11 +32,11 @@ namespace Aurora.Frontend.Components.MemberList
|
|||||||
/// Backing property for MembersProperty
|
/// Backing property for MembersProperty
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
public IEnumerable<string> Members
|
public ObservableCollection<PartyMember> Members
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (IEnumerable<string>)GetValue(MembersProperty);
|
return (ObservableCollection<PartyMember>)GetValue(MembersProperty);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@ -54,8 +56,10 @@ namespace Aurora.Frontend.Components.MemberList
|
|||||||
var membersList = control.FindByName("MembersHorizontalList") as HorizontalList.HorizontalList;
|
var membersList = control.FindByName("MembersHorizontalList") as HorizontalList.HorizontalList;
|
||||||
if (membersList != null)
|
if (membersList != null)
|
||||||
{
|
{
|
||||||
membersList.ItemsSource = newValue as IEnumerable<string>;
|
_newSource = newValue as ObservableCollection<PartyMember>;
|
||||||
|
membersList.ItemsSource = newValue as ObservableCollection<PartyMember>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Components.NavigationMenu
|
namespace Aurora.Design.Components.NavigationMenu
|
||||||
{
|
{
|
||||||
public class NavigationGroupItem : List<NavigationItem>
|
public class NavigationGroupItem : List<NavigationItem>
|
||||||
{
|
{
|
@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
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
|
public class NavigationItem
|
||||||
{
|
{
|
74
Aurora/Design/Components/NavigationMenu/NavigationMenu.xaml
Normal file
74
Aurora/Design/Components/NavigationMenu/NavigationMenu.xaml
Normal 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>
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Components.NavigationMenu
|
namespace Aurora.Design.Components.NavigationMenu
|
||||||
{
|
{
|
||||||
public partial class NavigationMenu : ContentPage
|
public partial class NavigationMenu : ContentPage
|
||||||
{
|
{
|
@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ContentView
|
<ContentView
|
||||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
xmlns:dg="clr-namespace:Xamarin.Forms.DataGrid;assembly=Xamarin.Forms.DataGrid"
|
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>
|
<ContentView.Content>
|
||||||
<dg:DataGrid
|
<dg:DataGrid
|
||||||
x:Name="QueueDataGrid"
|
x:Name="QueueDataGrid"
|
@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Xamarin.Forms.DataGrid;
|
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
|
public partial class Queue : ContentView
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Converters
|
namespace Aurora.Design.Converters
|
||||||
{
|
{
|
||||||
public class InverseBoolConverter : IValueConverter
|
public class InverseBoolConverter : IValueConverter
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Converters
|
namespace Aurora.Design.Converters
|
||||||
{
|
{
|
||||||
public class ToUpperConverter : IValueConverter
|
public class ToUpperConverter : IValueConverter
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
<ContentView
|
<ContentView
|
||||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
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>
|
<ContentPage.Content>
|
||||||
<Grid></Grid>
|
<Grid></Grid>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Views.Albums
|
namespace Aurora.Design.Views.Albums
|
||||||
{
|
{
|
||||||
public partial class AlbumsView : ContentView
|
public partial class AlbumsView : ContentView
|
||||||
{
|
{
|
@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
namespace Aurora.Frontend.Views.Albums
|
namespace Aurora.Design.Views.Albums
|
||||||
{
|
{
|
||||||
public class AlbumsViewModel
|
public class AlbumsViewModel
|
||||||
{
|
{
|
7
Aurora/Design/Views/Artists/ArtistsView.xaml
Normal file
7
Aurora/Design/Views/Artists/ArtistsView.xaml
Normal 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>
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Views.Artists
|
namespace Aurora.Design.Views.Artists
|
||||||
{
|
{
|
||||||
public partial class ArtistsView : ContentView
|
public partial class ArtistsView : ContentView
|
||||||
{
|
{
|
@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
namespace Aurora.Frontend.Views.Artists
|
namespace Aurora.Design.Views.Artists
|
||||||
{
|
{
|
||||||
public class ArtistsViewModel
|
public class ArtistsViewModel
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Views
|
namespace Aurora.Design.Views
|
||||||
{
|
{
|
||||||
public class BaseViewModel : INotifyPropertyChanged
|
public class BaseViewModel : INotifyPropertyChanged
|
||||||
{
|
{
|
22
Aurora/Design/Views/MainView/MainView.xaml
Normal file
22
Aurora/Design/Views/MainView/MainView.xaml
Normal 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>
|
@ -1,12 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Aurora.Frontend.Components.NavigationMenu;
|
using Aurora.Design.Components.NavigationMenu;
|
||||||
using Aurora.Frontend.Views.MainView;
|
using Aurora.Design.Views.MainView;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Xamarin.Forms.Xaml;
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Views.Main
|
namespace Aurora.Design.Views.Main
|
||||||
{
|
{
|
||||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||||
public partial class MainView : MasterDetailPage
|
public partial class MainView : MasterDetailPage
|
@ -2,14 +2,15 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Aurora.Frontend.Components.NavigationMenu;
|
using Aurora.Design.Components.NavigationMenu;
|
||||||
using Aurora.Frontend.Views.Albums;
|
using Aurora.Design.Views.Albums;
|
||||||
using Aurora.Frontend.Views.Artists;
|
using Aurora.Design.Views.Artists;
|
||||||
using Aurora.Frontend.Views.Songs;
|
using Aurora.Design.Views.Songs;
|
||||||
using Aurora.Frontend.Views.Stations;
|
using Aurora.Design.Views.Stations;
|
||||||
using Aurora.Frontend.Views.Party;
|
using Aurora.Design.Views.Party;
|
||||||
|
using Aurora.Design.Views.Profile;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Views.MainView
|
namespace Aurora.Design.Views.MainView
|
||||||
{
|
{
|
||||||
public class MainViewModel : BaseViewModel
|
public class MainViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
@ -32,7 +33,7 @@ namespace Aurora.Frontend.Views.MainView
|
|||||||
_pages = new ObservableCollection<NavigationItem>(new[]
|
_pages = new ObservableCollection<NavigationItem>(new[]
|
||||||
{
|
{
|
||||||
new NavigationItem { Id = 4, Title = "Party", Group="Social", TargetType = typeof(PartyView)},
|
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 = 0, Title = "Songs", Group="Library", TargetType = typeof(SongsView) },
|
||||||
new NavigationItem { Id = 1, Title = "Artists", Group="Library", TargetType = typeof(ArtistsView)},
|
new NavigationItem { Id = 1, Title = "Artists", Group="Library", TargetType = typeof(ArtistsView)},
|
||||||
new NavigationItem { Id = 2, Title = "Albums", Group="Library", TargetType = typeof(AlbumsView)},
|
new NavigationItem { Id = 2, Title = "Albums", Group="Library", TargetType = typeof(AlbumsView)},
|
@ -2,9 +2,9 @@
|
|||||||
<ContentPage
|
<ContentPage
|
||||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
xmlns:components="clr-namespace:Aurora.Frontend.Components"
|
xmlns:components="clr-namespace:Aurora.Design.Components"
|
||||||
xmlns:mp="clr-namespace:Aurora.Frontend.Components.MediaPlayer"
|
xmlns:mp="clr-namespace:Aurora.Design.Components.MediaPlayer"
|
||||||
x:Class="Aurora.Frontend.Views.MainView.PageContainer">
|
x:Class="Aurora.Design.Views.MainView.PageContainer">
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Views.MainView
|
namespace Aurora.Design.Views.MainView
|
||||||
{
|
{
|
||||||
public partial class PageContainer : ContentPage
|
public partial class PageContainer : ContentPage
|
||||||
{
|
{
|
35
Aurora/Design/Views/Party/PartyView.xaml
Normal file
35
Aurora/Design/Views/Party/PartyView.xaml
Normal 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>
|
@ -1,8 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Views.Party
|
namespace Aurora.Design.Views.Party
|
||||||
{
|
{
|
||||||
public partial class PartyView : ContentView
|
public partial class PartyView : ContentView
|
||||||
{
|
{
|
126
Aurora/Design/Views/Party/PartyViewModel.cs
Normal file
126
Aurora/Design/Views/Party/PartyViewModel.cs
Normal 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");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
Aurora/Design/Views/Profile/ProfileView.xaml
Normal file
27
Aurora/Design/Views/Profile/ProfileView.xaml
Normal 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>
|
15
Aurora/Design/Views/Profile/ProfileView.xaml.cs
Normal file
15
Aurora/Design/Views/Profile/ProfileView.xaml.cs
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
34
Aurora/Design/Views/Profile/ProfileViewModel.cs
Normal file
34
Aurora/Design/Views/Profile/ProfileViewModel.cs
Normal 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,9 +2,9 @@
|
|||||||
<ContentView
|
<ContentView
|
||||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
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"
|
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>
|
<ContentPage.BindingContext>
|
||||||
<songs:SongsViewModel
|
<songs:SongsViewModel
|
||||||
x:Name="songsViewModel"/>
|
x:Name="songsViewModel"/>
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Views.Songs
|
namespace Aurora.Design.Views.Songs
|
||||||
{
|
{
|
||||||
public partial class SongsView : ContentView
|
public partial class SongsView : ContentView
|
||||||
{
|
{
|
@ -1,10 +1,10 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using Aurora.Backend.Models.Media;
|
using Aurora.Models.Media;
|
||||||
using Aurora.Backend.Services;
|
using Aurora.Services;
|
||||||
using Aurora.Backend.Services.PlayerService;
|
using Aurora.Services.PlayerService;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Views.Songs
|
namespace Aurora.Design.Views.Songs
|
||||||
{
|
{
|
||||||
public class SongsViewModel : BaseViewModel
|
public class SongsViewModel : BaseViewModel
|
||||||
{
|
{
|
7
Aurora/Design/Views/Stations/StationsViewModel.xaml
Normal file
7
Aurora/Design/Views/Stations/StationsViewModel.xaml
Normal 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>
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Views.Stations
|
namespace Aurora.Design.Views.Stations
|
||||||
{
|
{
|
||||||
public partial class StationsView : ContentView
|
public partial class StationsView : ContentView
|
||||||
{
|
{
|
@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
namespace Aurora.Frontend.Views.Stations
|
namespace Aurora.Design.Views.Stations
|
||||||
{
|
{
|
||||||
public class StationsViewModel
|
public class StationsViewModel
|
||||||
{
|
{
|
59
Aurora/Executors/BaseExecutor.cs
Normal file
59
Aurora/Executors/BaseExecutor.cs
Normal 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
|
||||||
|
}
|
||||||
|
}
|
89
Aurora/Executors/ClientExecutor.cs
Normal file
89
Aurora/Executors/ClientExecutor.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
68
Aurora/Executors/HostExecutor.cs
Normal file
68
Aurora/Executors/HostExecutor.cs
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Aurora.Backend.Models.Media
|
namespace Aurora.Models.Media
|
||||||
{
|
{
|
||||||
public class AudioMetadata : BaseMetadata
|
public class AudioMetadata : BaseMetadata
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Aurora.Backend.Models.Media
|
namespace Aurora.Models.Media
|
||||||
{
|
{
|
||||||
public abstract class BaseMedia
|
public abstract class BaseMedia
|
||||||
{
|
{
|
@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
namespace Aurora.Backend.Models.Media
|
namespace Aurora.Models.Media
|
||||||
{
|
{
|
||||||
public class BaseMetadata
|
public class BaseMetadata
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Aurora.Backend.Models.Media
|
namespace Aurora.Models.Media
|
||||||
{
|
{
|
||||||
public class LocalAudio : BaseMedia
|
public class LocalAudio : BaseMedia
|
||||||
{
|
{
|
@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
namespace Aurora.Backend.Models.Media
|
namespace Aurora.Models.Media
|
||||||
{
|
{
|
||||||
public enum MediaTypeEnum
|
public enum MediaTypeEnum
|
||||||
{
|
{
|
10
Aurora/Proto/general.proto
Normal file
10
Aurora/Proto/general.proto
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package Aurora.Proto;
|
||||||
|
|
||||||
|
message Chunk {
|
||||||
|
bytes Content = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Empty{
|
||||||
|
}
|
46
Aurora/Proto/party.proto
Normal file
46
Aurora/Proto/party.proto
Normal 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;
|
||||||
|
}
|
21
Aurora/Proto/playback.proto
Normal file
21
Aurora/Proto/playback.proto
Normal 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;
|
||||||
|
}
|
66
Aurora/RemoteImpl/RemotePartyImpl.cs
Normal file
66
Aurora/RemoteImpl/RemotePartyImpl.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
Aurora/RemoteImpl/RemotePlaybackImpl.cs
Normal file
38
Aurora/RemoteImpl/RemotePlaybackImpl.cs
Normal 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");
|
||||||
|
// };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Aurora.Backend.Services
|
namespace Aurora.Services
|
||||||
{
|
{
|
||||||
public abstract class BaseService<T> where T : class
|
public abstract class BaseService<T> where T : class
|
||||||
{
|
{
|
@ -2,10 +2,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Aurora.Backend.Models.Media;
|
using Aurora.Models.Media;
|
||||||
using Aurora.Backend.Utils;
|
using Aurora.Utils;
|
||||||
|
|
||||||
namespace Aurora.Backend.Services
|
namespace Aurora.Services
|
||||||
{
|
{
|
||||||
public class LibraryService : BaseService<LibraryService>
|
public class LibraryService : BaseService<LibraryService>
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
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);
|
public delegate void MediaChangedEventHandler(object source, MediaChangedEventArgs e);
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
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);
|
public delegate void PlaybackStateChangedEventHandler(object source, PlaybackStateChangedEventArgs e);
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using Aurora.Backend.Models.Media;
|
using Aurora.Models.Media;
|
||||||
using LibVLCSharp.Shared;
|
using LibVLCSharp.Shared;
|
||||||
|
|
||||||
namespace Aurora.Backend.Services.PlayerService
|
namespace Aurora.Services.PlayerService
|
||||||
{
|
{
|
||||||
public class PlayerService : BaseService<PlayerService>
|
public class PlayerService : BaseService<PlayerService>
|
||||||
{
|
{
|
79
Aurora/Services/ServerService.cs
Normal file
79
Aurora/Services/ServerService.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
51
Aurora/Services/SettingsService.cs
Normal file
51
Aurora/Services/SettingsService.cs
Normal 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); }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Aurora.Backend.Utils
|
namespace Aurora.Utils
|
||||||
{
|
{
|
||||||
public class FileSystemUtils
|
public class FileSystemUtils
|
||||||
{
|
{
|
1
start_second.sh
Executable file
1
start_second.sh
Executable file
@ -0,0 +1 @@
|
|||||||
|
mono --debug Aurora.gtk/bin/Debug/Aurora.gtk.exe
|
Loading…
Reference in New Issue
Block a user