Using System.Diagnostics.Debug. First pass at player controls styling
This commit is contained in:
parent
22a524cfd1
commit
187de97503
@ -518,6 +518,17 @@
|
|||||||
<Content Include="Resources\backward.png">
|
<Content Include="Resources\backward.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="Resources\pause.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Resources\menu.png">
|
||||||
|
</Content>
|
||||||
|
<Content Include="Resources\shuffle.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Resources\loop.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="..\packages\Grpc.Tools.2.25.0\build\Grpc.Tools.targets" Condition="Exists('..\packages\Grpc.Tools.2.25.0\build\Grpc.Tools.targets')" />
|
<Import Project="..\packages\Grpc.Tools.2.25.0\build\Grpc.Tools.targets" Condition="Exists('..\packages\Grpc.Tools.2.25.0\build\Grpc.Tools.targets')" />
|
||||||
|
BIN
Aurora.gtk/Resources/loop.png
Normal file
BIN
Aurora.gtk/Resources/loop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
Aurora.gtk/Resources/menu.png
Normal file
BIN
Aurora.gtk/Resources/menu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
Aurora.gtk/Resources/pause.png
Normal file
BIN
Aurora.gtk/Resources/pause.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
Aurora.gtk/Resources/shuffle.png
Normal file
BIN
Aurora.gtk/Resources/shuffle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -1,12 +1,26 @@
|
|||||||
Label {
|
#PlayerControlContainer {
|
||||||
color: darkgray;
|
background-color: #626363;
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
color: white;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
#MediaInfoLayout label {
|
#MediaInfoContainer {
|
||||||
margin-left: 20;
|
width: 150;
|
||||||
|
margin-top: 10;
|
||||||
|
margin-bottom: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
#MediaInfoContainer label {
|
||||||
|
margin-left: 20;
|
||||||
|
}
|
||||||
|
#AlbumArtBoxView {
|
||||||
|
background-color: black;
|
||||||
|
width: 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButton {
|
ImageButton {
|
||||||
|
@ -12,25 +12,30 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition
|
<ColumnDefinition
|
||||||
Width="100"/>
|
Width="150"/>
|
||||||
<ColumnDefinition
|
<ColumnDefinition
|
||||||
Width="*"/>
|
Width="*"/>
|
||||||
<ColumnDefinition
|
<ColumnDefinition
|
||||||
Width="100"/>
|
Width="100"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackLayout
|
<StackLayout
|
||||||
x:Name="MediaInfoLayout"
|
Orientation="Horizontal">
|
||||||
HorizontalOptions="StartAndExpand"
|
<BoxView
|
||||||
Grid.Column="0">
|
x:Name="AlbumArtBoxView"/>
|
||||||
<Label
|
<StackLayout
|
||||||
x:Name="SongTitleLabel"
|
x:Name="MediaInfoContainer"
|
||||||
LineBreakMode="TailTruncation"/>
|
HorizontalOptions="StartAndExpand"
|
||||||
<Label
|
Grid.Column="0">
|
||||||
x:Name="ArtistNameLabel"
|
<Label
|
||||||
LineBreakMode="TailTruncation"/>
|
x:Name="SongTitleLabel"
|
||||||
|
LineBreakMode="TailTruncation"/>
|
||||||
|
<Label
|
||||||
|
x:Name="ArtistNameLabel"
|
||||||
|
LineBreakMode="TailTruncation"/>
|
||||||
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout
|
<StackLayout
|
||||||
x:Name="PlayerControlLayout"
|
x:Name="PlayerControlContainer"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalOptions="Center"
|
HorizontalOptions="Center"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
@ -38,8 +43,7 @@
|
|||||||
x:Name="PreviousButton"
|
x:Name="PreviousButton"
|
||||||
Source="Resources/backward.png"/>
|
Source="Resources/backward.png"/>
|
||||||
<imgBtn:ImageButton
|
<imgBtn:ImageButton
|
||||||
x:Name="PlayButton"
|
x:Name="PlayButton"/>
|
||||||
Source="Resources/play.png"/>
|
|
||||||
<imgBtn:ImageButton
|
<imgBtn:ImageButton
|
||||||
x:Name="NextButton"
|
x:Name="NextButton"
|
||||||
Source="Resources/forwards.png"/>
|
Source="Resources/forwards.png"/>
|
||||||
|
@ -9,6 +9,7 @@ namespace Aurora.Design.Components.MediaPlayer
|
|||||||
{
|
{
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
PlayButton.Source = ImageSource.FromFile("Resources/play.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
#region SongTitle Bindable
|
#region SongTitle Bindable
|
||||||
@ -16,7 +17,11 @@ namespace Aurora.Design.Components.MediaPlayer
|
|||||||
BindableProperty.Create(propertyName: "SongTitle",
|
BindableProperty.Create(propertyName: "SongTitle",
|
||||||
returnType: typeof(string),
|
returnType: typeof(string),
|
||||||
declaringType: typeof(Player),
|
declaringType: typeof(Player),
|
||||||
propertyChanged: OnSongTitlePropertyChanged);
|
propertyChanged: (BindableObject bindable, object oldValue, object newValue) =>
|
||||||
|
{
|
||||||
|
Player component = bindable as Player;
|
||||||
|
component.SongTitleLabel.Text = (string)newValue;
|
||||||
|
});
|
||||||
|
|
||||||
public string SongTitle
|
public string SongTitle
|
||||||
{
|
{
|
||||||
@ -30,12 +35,6 @@ namespace Aurora.Design.Components.MediaPlayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnSongTitlePropertyChanged(BindableObject bindable, object oldValue, object newValue)
|
|
||||||
{
|
|
||||||
Player component = bindable as Player;
|
|
||||||
component.SongTitleLabel.Text = (string)newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion SongTitle Bindable
|
#endregion SongTitle Bindable
|
||||||
|
|
||||||
#region ArtistName Bindable
|
#region ArtistName Bindable
|
||||||
@ -43,7 +42,11 @@ namespace Aurora.Design.Components.MediaPlayer
|
|||||||
BindableProperty.Create(propertyName: "ArtistName",
|
BindableProperty.Create(propertyName: "ArtistName",
|
||||||
returnType: typeof(string),
|
returnType: typeof(string),
|
||||||
declaringType: typeof(Player),
|
declaringType: typeof(Player),
|
||||||
propertyChanged: OnArtistNamePropertyChanged);
|
propertyChanged: (BindableObject bindable, object oldValue, object newValue) =>
|
||||||
|
{
|
||||||
|
Player component = bindable as Player;
|
||||||
|
component.ArtistNameLabel.Text = (string)newValue;
|
||||||
|
});
|
||||||
|
|
||||||
public string ArtistName
|
public string ArtistName
|
||||||
{
|
{
|
||||||
@ -57,12 +60,6 @@ namespace Aurora.Design.Components.MediaPlayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnArtistNamePropertyChanged(BindableObject bindable, object oldValue, object newValue)
|
|
||||||
{
|
|
||||||
Player component = bindable as Player;
|
|
||||||
component.ArtistNameLabel.Text = (string)newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion ArtistName Bindable
|
#endregion ArtistName Bindable
|
||||||
|
|
||||||
#region PreviousButton
|
#region PreviousButton
|
||||||
@ -275,5 +272,32 @@ namespace Aurora.Design.Components.MediaPlayer
|
|||||||
component.NextButton.IsEnabled = cmd.CanExecute(null);
|
component.NextButton.IsEnabled = cmd.CanExecute(null);
|
||||||
}
|
}
|
||||||
#endregion PlayButton
|
#endregion PlayButton
|
||||||
|
|
||||||
|
#region Playing Bindable
|
||||||
|
public static readonly BindableProperty IsPlayingProperty =
|
||||||
|
BindableProperty.Create(
|
||||||
|
propertyName: "IsPlaying",
|
||||||
|
returnType: typeof(bool),
|
||||||
|
declaringType: typeof(Player),
|
||||||
|
propertyChanged: (BindableObject bindable, object oldValue, object newValue) =>
|
||||||
|
{
|
||||||
|
Player control = (Player)bindable;
|
||||||
|
if ((bool)newValue == true)
|
||||||
|
{
|
||||||
|
control.PlayButton.Source = ImageSource.FromFile("Resources/pause.png");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
control.PlayButton.Source = ImageSource.FromFile("Resources/play.png");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
public bool IsPlaying
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsPlayingProperty); }
|
||||||
|
set { SetValue(IsPlayingProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Playing Binadable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
Aurora/Design/Converters/PlayIconConverter.cs
Normal file
10
Aurora/Design/Converters/PlayIconConverter.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
namespace Aurora.Design.Converters
|
||||||
|
{
|
||||||
|
public class PlayIconConverter
|
||||||
|
{
|
||||||
|
public PlayIconConverter()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -72,6 +72,8 @@ namespace Aurora.Design.Views
|
|||||||
|
|
||||||
public SetPlayerVisibleDelegate SetPlayerVisible { get; set; }
|
public SetPlayerVisibleDelegate SetPlayerVisible { get; set; }
|
||||||
|
|
||||||
|
public SetIsPlayingDelegate SetIsPlaying { get; set; }
|
||||||
|
|
||||||
#endregion Player
|
#endregion Player
|
||||||
|
|
||||||
#region Lifecycle
|
#region Lifecycle
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#Header {
|
#Header {
|
||||||
background-color: #232323;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
#Header > Entry {
|
#Header > Entry {
|
||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#TitleContainer {
|
#TitleContainer {
|
||||||
margin-top: 10;
|
margin-top: 10;
|
||||||
background-color: #3a3a3a;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
#TitleContainer Label {
|
#TitleContainer Label {
|
||||||
|
@ -17,10 +17,15 @@
|
|||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="60"/>
|
<RowDefinition Height="60"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="150"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
<!--Header-->
|
<!--Header-->
|
||||||
<StackLayout
|
<StackLayout
|
||||||
x:Name="Header"
|
x:Name="Header"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<Entry Text="Search"/>
|
<Entry Text="Search"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
@ -28,35 +33,31 @@
|
|||||||
<!--Title-->
|
<!--Title-->
|
||||||
<StackLayout
|
<StackLayout
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
x:Name="TitleContainer">
|
x:Name="TitleContainer">
|
||||||
<Label Text="{Binding Title}" TextColor="White"/>
|
<Label Text="{Binding Title}" TextColor="White"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
||||||
<!--Library Grid-->
|
<!--Sidebar-->
|
||||||
<Grid Grid.Row="2">
|
<navigation:NavigationMenu
|
||||||
<Grid.ColumnDefinitions>
|
Grid.Column="0"
|
||||||
<ColumnDefinition Width="150"/>
|
Grid.RowSpan="3"
|
||||||
<ColumnDefinition Width="*"/>
|
x:Name="MasterPage"
|
||||||
</Grid.ColumnDefinitions>
|
Items="{Binding Pages}"
|
||||||
|
SelectedItem="{Binding SelectedItem}"/>
|
||||||
|
|
||||||
<navigation:NavigationMenu
|
<!--Page Container-->
|
||||||
Grid.Column="0"
|
<views:PageContainer
|
||||||
x:Name="MasterPage"
|
Grid.Column="1"
|
||||||
Items="{Binding Pages}"
|
Grid.Row="2"
|
||||||
SelectedItem="{Binding SelectedItem}"/>
|
x:Name="ContentPage"/>
|
||||||
|
|
||||||
<views:PageContainer
|
|
||||||
Grid.Column="1"
|
|
||||||
Grid.Row="0"
|
|
||||||
x:Name="ContentPage"/>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<!--Music Player-->
|
<!--Music Player-->
|
||||||
<mp:Player
|
<mp:Player
|
||||||
x:Name="Player"
|
x:Name="Player"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
HeightRequest="50"/>
|
Grid.ColumnSpan="2"
|
||||||
|
HeightRequest="50"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</ContentPage>
|
</ContentPage>
|
@ -17,7 +17,9 @@ namespace Aurora.Design.Views.Main
|
|||||||
/// <param name="media"></param>
|
/// <param name="media"></param>
|
||||||
public delegate void SetPlayerMetadataDelegate(BaseMedia media);
|
public delegate void SetPlayerMetadataDelegate(BaseMedia media);
|
||||||
|
|
||||||
public delegate void SetPlayerVisibleDelegate(Boolean visible);
|
public delegate void SetPlayerVisibleDelegate(bool visible);
|
||||||
|
|
||||||
|
public delegate void SetIsPlayingDelegate(bool playing);
|
||||||
|
|
||||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||||
public partial class MainView : ContentPage//, IDisposable
|
public partial class MainView : ContentPage//, IDisposable
|
||||||
@ -139,6 +141,7 @@ namespace Aurora.Design.Views.Main
|
|||||||
{
|
{
|
||||||
vm.SetPlayerMetadata = null;
|
vm.SetPlayerMetadata = null;
|
||||||
vm.SetPlayerVisible = null;
|
vm.SetPlayerVisible = null;
|
||||||
|
vm.SetIsPlaying = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -152,8 +155,10 @@ namespace Aurora.Design.Views.Main
|
|||||||
_player.PreviousButtonCommand = new Command(vm.OnPreviousButtonExecute, vm.CanPreviousButtonExecute);
|
_player.PreviousButtonCommand = new Command(vm.OnPreviousButtonExecute, vm.CanPreviousButtonExecute);
|
||||||
|
|
||||||
//Assign SetPlayer delegate
|
//Assign SetPlayer delegate
|
||||||
|
|
||||||
vm.SetPlayerMetadata = SetPlayer;
|
vm.SetPlayerMetadata = SetPlayer;
|
||||||
vm.SetPlayerVisible = SetPlayerVisible;
|
vm.SetPlayerVisible = SetPlayerVisible;
|
||||||
|
vm.SetIsPlaying = SetIsPlaying;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -178,6 +183,11 @@ namespace Aurora.Design.Views.Main
|
|||||||
{
|
{
|
||||||
_player.IsVisible = visible;
|
_player.IsVisible = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetIsPlaying(bool playing)
|
||||||
|
{
|
||||||
|
_player.IsPlaying = playing;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ namespace Aurora.Design.Views.Party
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Exception occurred while receiviing events: ", ex.Message);
|
System.Diagnostics.Debug.WriteLine("Exception occurred while receiviing events: ", ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ namespace Aurora.Design.Views.Party
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Exception occurred while receiviing events: ", ex.Message);
|
System.Diagnostics.Debug.WriteLine("Exception occurred while receiviing events: ", ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ namespace Aurora.Design.Views.Party
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Error subscribing to events: " + ex.Message);
|
System.Diagnostics.Debug.WriteLine("Error subscribing to events: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ namespace Aurora.Design.Views.Party
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine(string.Format("CLIENT {0} - SubscribeToEvents called from client with id", SettingsService.Instance.ClientId));
|
System.Diagnostics.Debug.WriteLine(string.Format("CLIENT {0} - SubscribeToEvents called from client with id", SettingsService.Instance.ClientId));
|
||||||
await _client.RemoteEventClient.SubscribeToEventsAsync(req);
|
await _client.RemoteEventClient.SubscribeToEventsAsync(req);
|
||||||
}
|
}
|
||||||
private async Task UnsubscribeFromEvents()
|
private async Task UnsubscribeFromEvents()
|
||||||
|
@ -22,8 +22,6 @@ namespace Aurora.Design.Views.Songs
|
|||||||
_songsList = new ObservableCollection<BaseMedia>();
|
_songsList = new ObservableCollection<BaseMedia>();
|
||||||
PlayCommand = new Command(OnPlayButtonExecute, CanPlayButtonExecute);
|
PlayCommand = new Command(OnPlayButtonExecute, CanPlayButtonExecute);
|
||||||
|
|
||||||
_player.PlaybackStateChanged += OnPlaybackStateChanged;
|
|
||||||
|
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +85,10 @@ namespace Aurora.Design.Views.Songs
|
|||||||
|
|
||||||
public async override void OnPlayButtonExecute()
|
public async override void OnPlayButtonExecute()
|
||||||
{
|
{
|
||||||
|
if (_selectedSong == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
base.Media = _selectedSong;
|
base.Media = _selectedSong;
|
||||||
if (!_player.IsMediaLoaded(base.Media))
|
if (!_player.IsMediaLoaded(base.Media))
|
||||||
{
|
{
|
||||||
@ -98,16 +100,19 @@ namespace Aurora.Design.Views.Songs
|
|||||||
case PlaybackState.Buffering:
|
case PlaybackState.Buffering:
|
||||||
{
|
{
|
||||||
_player.Play();
|
_player.Play();
|
||||||
|
SetIsPlaying(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PlaybackState.Playing:
|
case PlaybackState.Playing:
|
||||||
{
|
{
|
||||||
_player.Pause();
|
_player.Pause();
|
||||||
|
SetIsPlaying(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PlaybackState.Stopped:
|
case PlaybackState.Stopped:
|
||||||
{
|
{
|
||||||
_player.Play();
|
_player.Play();
|
||||||
|
SetIsPlaying(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,18 +129,5 @@ namespace Aurora.Design.Views.Songs
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion Commands
|
#endregion Commands
|
||||||
|
|
||||||
#region Events
|
|
||||||
/// <summary>
|
|
||||||
/// PlayerService playback state changed event handler.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender">The sending object.</param>
|
|
||||||
/// <param name="args">Event arguments.</param>
|
|
||||||
public void OnPlaybackStateChanged(object sender, PlaybackStateChangedEventArgs args)
|
|
||||||
{
|
|
||||||
OnPropertyChanged("PlayButtonText");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Events
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,11 +69,11 @@ namespace Aurora.Models.Media
|
|||||||
|
|
||||||
await this.DataStream.WriteAsync(buffer, 0, buffer.Length);
|
await this.DataStream.WriteAsync(buffer, 0, buffer.Length);
|
||||||
}
|
}
|
||||||
Console.WriteLine("Done receiving stream");
|
System.Diagnostics.Debug.WriteLine("Done receiving stream");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Exception caught while loading remote audio:" + ex.Message);
|
System.Diagnostics.Debug.WriteLine("Exception caught while loading remote audio:" + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await base.Load();
|
await base.Load();
|
||||||
|
@ -28,12 +28,12 @@ namespace Aurora.RemoteImpl
|
|||||||
Grpc.Core.ServerCallContext context)
|
Grpc.Core.ServerCallContext context)
|
||||||
{
|
{
|
||||||
string peerId = Combine(new string[] { context.Peer, request.ClientId });
|
string peerId = Combine(new string[] { context.Peer, request.ClientId });
|
||||||
Console.WriteLine(string.Format("SERVER - Events request received from peer: {0}", peerId));
|
System.Diagnostics.Debug.WriteLine(string.Format("SERVER - Events request received from peer: {0}", peerId));
|
||||||
|
|
||||||
AutoResetEvent are = new AutoResetEvent(false);
|
AutoResetEvent are = new AutoResetEvent(false);
|
||||||
Action<BaseEvent> callback = (BaseEvent bEvent) =>
|
Action<BaseEvent> callback = (BaseEvent bEvent) =>
|
||||||
{
|
{
|
||||||
Console.WriteLine(string.Format("SERVER - Event fired for peer: {0}", peerId));
|
System.Diagnostics.Debug.WriteLine(string.Format("SERVER - Event fired for peer: {0}", peerId));
|
||||||
//TODO need to remove callback if stream no longer exists IE. Client crashed or stopped
|
//TODO need to remove callback if stream no longer exists IE. Client crashed or stopped
|
||||||
responseStream.WriteAsync(bEvent);
|
responseStream.WriteAsync(bEvent);
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ namespace Aurora.RemoteImpl
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override Task<SubscriptionResponse> SubscribeToEvents(SubscribeRequest request, Grpc.Core.ServerCallContext context)
|
public override Task<SubscriptionResponse> SubscribeToEvents(SubscribeRequest request, Grpc.Core.ServerCallContext context)
|
||||||
{
|
{
|
||||||
Console.WriteLine(string.Format("SERVER - Subscription from client with id: {0}", request.ClientId));
|
System.Diagnostics.Debug.WriteLine(string.Format("SERVER - Subscription from client with id: {0}", request.ClientId));
|
||||||
EventManager.Instance.AddSubscriptionList(Combine(new string[] { context.Peer, request.ClientId }), request.EventTypes.ToList());
|
EventManager.Instance.AddSubscriptionList(Combine(new string[] { context.Peer, request.ClientId }), request.EventTypes.ToList());
|
||||||
|
|
||||||
return Task.FromResult(new SubscriptionResponse { Successful = true });
|
return Task.FromResult(new SubscriptionResponse { Successful = true });
|
||||||
|
@ -40,7 +40,7 @@ namespace Aurora.RemoteImpl
|
|||||||
IpAddress = context.Host,
|
IpAddress = context.Host,
|
||||||
};
|
};
|
||||||
|
|
||||||
Console.WriteLine("SERVER - Client joined party: " + partyMember.Id);
|
System.Diagnostics.Debug.WriteLine("SERVER - Client joined party: " + partyMember.Id);
|
||||||
|
|
||||||
_partyMembers.Add(partyMember);
|
_partyMembers.Add(partyMember);
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ namespace Aurora.RemoteImpl
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(string.Format("Error preparing queue: {0}", ex.Message));
|
System.Diagnostics.Debug.WriteLine(string.Format("Error preparing queue: {0}", ex.Message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ namespace Aurora.RemoteImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Send stream
|
//Send stream
|
||||||
Console.WriteLine("Begin sending file");
|
System.Diagnostics.Debug.WriteLine("Begin sending file");
|
||||||
byte[] buffer = new byte[2048]; // read in chunks of 2KB
|
byte[] buffer = new byte[2048]; // read in chunks of 2KB
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
while ((bytesRead = songCopy.DataStream.Read(buffer, 0, buffer.Length)) > 0)
|
while ((bytesRead = songCopy.DataStream.Read(buffer, 0, buffer.Length)) > 0)
|
||||||
@ -41,11 +41,11 @@ namespace Aurora.RemoteImpl
|
|||||||
Google.Protobuf.ByteString bufferByteString = Google.Protobuf.ByteString.CopyFrom(buffer);
|
Google.Protobuf.ByteString bufferByteString = Google.Protobuf.ByteString.CopyFrom(buffer);
|
||||||
await responseStream.WriteAsync(new Chunk { Content = bufferByteString });
|
await responseStream.WriteAsync(new Chunk { Content = bufferByteString });
|
||||||
}
|
}
|
||||||
Console.WriteLine("Done sending file");
|
System.Diagnostics.Debug.WriteLine("Done sending file");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Exception caught while sending audio file: " + ex.Message);
|
System.Diagnostics.Debug.WriteLine("Exception caught while sending audio file: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ namespace Aurora.RemoteImpl
|
|||||||
ServerTimeTicks = Utils.TimeUtils.GetNetworkTime().DateTime.Ticks
|
ServerTimeTicks = Utils.TimeUtils.GetNetworkTime().DateTime.Ticks
|
||||||
};
|
};
|
||||||
await responseStream.WriteAsync(sync);
|
await responseStream.WriteAsync(sync);
|
||||||
Console.WriteLine("Sent Sync");
|
System.Diagnostics.Debug.WriteLine("Sent Sync");
|
||||||
await Task.Delay(5000);
|
await Task.Delay(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ namespace Aurora.Services.ClientService
|
|||||||
{
|
{
|
||||||
_eventCancellationTokenSource = new CancellationTokenSource();
|
_eventCancellationTokenSource = new CancellationTokenSource();
|
||||||
string clientId = SettingsService.Instance.ClientId;
|
string clientId = SettingsService.Instance.ClientId;
|
||||||
Console.WriteLine(string.Format("CLIENT {0} - GetEvents called from client with id", clientId));
|
System.Diagnostics.Debug.WriteLine(string.Format("CLIENT {0} - GetEvents called from client with id", clientId));
|
||||||
using (AsyncServerStreamingCall<BaseEvent> eventStream = _remoteEventsClient
|
using (AsyncServerStreamingCall<BaseEvent> eventStream = _remoteEventsClient
|
||||||
.GetEvents(new EventsRequest { ClientId = SettingsService.Instance.ClientId }))
|
.GetEvents(new EventsRequest { ClientId = SettingsService.Instance.ClientId }))
|
||||||
{
|
{
|
||||||
@ -126,14 +126,14 @@ namespace Aurora.Services.ClientService
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Exception while parsing event ---" + ex.Message);
|
System.Diagnostics.Debug.WriteLine("Exception while parsing event ---" + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(string.Format("EXCEPTION while parsing events --- " + ex.Message));
|
System.Diagnostics.Debug.WriteLine(string.Format("EXCEPTION while parsing events --- " + ex.Message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ namespace Aurora.Services.EventManager
|
|||||||
executionTask.ContinueWith((Task task) =>
|
executionTask.ContinueWith((Task task) =>
|
||||||
{
|
{
|
||||||
var exception = executionTask.Exception;
|
var exception = executionTask.Exception;
|
||||||
Console.WriteLine(string.Format("SERVER --- Exception occurred firing event"));
|
System.Diagnostics.Debug.WriteLine(string.Format("SERVER --- Exception occurred firing event"));
|
||||||
this._actionList.Remove(pair.Key);
|
this._actionList.Remove(pair.Key);
|
||||||
},
|
},
|
||||||
TaskContinuationOptions.OnlyOnFaulted);
|
TaskContinuationOptions.OnlyOnFaulted);
|
||||||
|
@ -147,21 +147,21 @@ namespace Aurora.Services.PlayerService
|
|||||||
newPosition - oldPosition < -0.001)
|
newPosition - oldPosition < -0.001)
|
||||||
{
|
{
|
||||||
_mediaPlayer.Position = newPosition;
|
_mediaPlayer.Position = newPosition;
|
||||||
Console.WriteLine(string.Format("**Audio synced**"));
|
System.Diagnostics.Debug.WriteLine(string.Format("**Audio synced**"));
|
||||||
// Console.WriteLine(string.Format("Remote Server Time {0}", new DateTime(sync.ServerTimeTicks).ToLongTimeString()));
|
// System.Diagnostics.Debug.WriteLine(string.Format("Remote Server Time {0}", new DateTime(sync.ServerTimeTicks).ToLongTimeString()));
|
||||||
// Console.WriteLine(string.Format("Remote Track Time: {0}", sync.TrackPosition));
|
// System.Diagnostics.Debug.WriteLine(string.Format("Remote Track Time: {0}", sync.TrackPosition));
|
||||||
// Console.WriteLine(string.Format("Local Server Time: {0}", time.DateTime.ToLongTimeString()));
|
// System.Diagnostics.Debug.WriteLine(string.Format("Local Server Time: {0}", time.DateTime.ToLongTimeString()));
|
||||||
// Console.WriteLine(string.Format("Local Track Time: {0}", _mediaPlayer.Position));
|
// System.Diagnostics.Debug.WriteLine(string.Format("Local Track Time: {0}", _mediaPlayer.Position));
|
||||||
// Console.WriteLine(string.Format("Offset: {0}", offset));
|
// System.Diagnostics.Debug.WriteLine(string.Format("Offset: {0}", offset));
|
||||||
// Console.WriteLine(string.Format("Old Position: {0}", oldPosition));
|
// System.Diagnostics.Debug.WriteLine(string.Format("Old Position: {0}", oldPosition));
|
||||||
// Console.WriteLine(string.Format("New Position: {0}", newPosition));
|
// System.Diagnostics.Debug.WriteLine(string.Format("New Position: {0}", newPosition));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Exception caught while attempting to sync: " + ex.Message);
|
System.Diagnostics.Debug.WriteLine("Exception caught while attempting to sync: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -73,7 +73,7 @@ namespace Aurora.Services
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
Console.WriteLine(string.Format("Starting gRPC server at hostname: {0}, port: {1}", _hostname, _port));
|
System.Diagnostics.Debug.WriteLine(string.Format("Starting gRPC server at hostname: {0}, port: {1}", _hostname, _port));
|
||||||
|
|
||||||
if (!Initialized)
|
if (!Initialized)
|
||||||
{
|
{
|
||||||
@ -93,7 +93,7 @@ namespace Aurora.Services
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(string.Format("Error starting gRPC server: {0}", ex.Message));
|
System.Diagnostics.Debug.WriteLine(string.Format("Error starting gRPC server: {0}", ex.Message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ namespace Aurora.Utils
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{ex.GetType()} {ex.Message}\n{ex.StackTrace}");
|
System.Diagnostics.Debug.WriteLine($"{ex.GetType()} {ex.Message}\n{ex.StackTrace}");
|
||||||
ex = ex.InnerException;
|
ex = ex.InnerException;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user