From dc7879c23db30dbbbe7129873fa7bf272fcb8368 Mon Sep 17 00:00:00 2001 From: watsonb8 Date: Sat, 18 Jan 2020 18:07:31 -0500 Subject: [PATCH] Cosmetic refactoring --- Aurora/Design/Views/BaseViewModel.cs | 8 ++-- Aurora/Design/Views/MainView/MainView.xaml.cs | 6 +-- Aurora/Design/Views/Party/PartyViewModel.cs | 44 +++++++++---------- Aurora/Design/Views/Songs/SongsViewModel.cs | 8 ++-- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Aurora/Design/Views/BaseViewModel.cs b/Aurora/Design/Views/BaseViewModel.cs index d7183b5..d9aefeb 100644 --- a/Aurora/Design/Views/BaseViewModel.cs +++ b/Aurora/Design/Views/BaseViewModel.cs @@ -20,8 +20,8 @@ namespace Aurora.Design.Views /// /// Command event handler for player play button /// - public virtual void OnPlayButtonExecute() { } - public virtual bool CanPlayButtonExecute() + public virtual void OnPlayButtonCommandExecute() { } + public virtual bool CanPlayButtonCommandExecute() { return true; } @@ -30,7 +30,7 @@ namespace Aurora.Design.Views /// Command event handler for player next button /// public virtual void OnNextButtonExecute() { } - public virtual bool CanNextButtonExecute() + public virtual bool CanNextButtonCommandExecute() { return true; } @@ -39,7 +39,7 @@ namespace Aurora.Design.Views /// Command event handler for player previous button /// public virtual void OnPreviousButtonExecute() { } - public virtual bool CanPreviousButtonExecute() + public virtual bool CanPreviousButtonCommandExecute() { return true; } diff --git a/Aurora/Design/Views/MainView/MainView.xaml.cs b/Aurora/Design/Views/MainView/MainView.xaml.cs index 8985105..a008571 100644 --- a/Aurora/Design/Views/MainView/MainView.xaml.cs +++ b/Aurora/Design/Views/MainView/MainView.xaml.cs @@ -166,9 +166,9 @@ namespace Aurora.Design.Views.Main /// BaseViewModel to assign controls to private void AssignPlayerControls(BaseViewModel vm) { - _playerComponent.PlayButtonCommand = new Command(vm.OnPlayButtonExecute, vm.CanPlayButtonExecute); - _playerComponent.NextButtonCommand = new Command(vm.OnNextButtonExecute, vm.CanNextButtonExecute); - _playerComponent.PreviousButtonCommand = new Command(vm.OnPreviousButtonExecute, vm.CanPreviousButtonExecute); + _playerComponent.PlayButtonCommand = new Command(vm.OnPlayButtonCommandExecute, vm.CanPlayButtonCommandExecute); + _playerComponent.NextButtonCommand = new Command(vm.OnNextButtonExecute, vm.CanNextButtonCommandExecute); + _playerComponent.PreviousButtonCommand = new Command(vm.OnPreviousButtonExecute, vm.CanPreviousButtonCommandExecute); vm.ChangePlayerState = ChangePlayerState; vm.IsPlaying = () => diff --git a/Aurora/Design/Views/Party/PartyViewModel.cs b/Aurora/Design/Views/Party/PartyViewModel.cs index dc405e7..b9daa6d 100644 --- a/Aurora/Design/Views/Party/PartyViewModel.cs +++ b/Aurora/Design/Views/Party/PartyViewModel.cs @@ -43,15 +43,15 @@ namespace Aurora.Design.Views.Party SetState(PartyState.SelectingHost); - PlayCommand = new Command(OnDoubleClickExecute, CanDoubleClickExecute); + PlayCommand = new Command(OnDoubleClickCommandExecute, CanDoubleClickCommandExecute); - LeavePartyCommand = new Command(OnLeavePartyExecute, CanLeaveParty); + LeavePartyCommand = new Command(OnLeavePartyCommandExecute, CanLeavePartyCommandExecute); _client = ClientService.Instance; - _client.OnMediaPaused += this.OnMediaPaused; - _client.OnMediaResumed += this.OnMediaResumed; - _client.OnNewMediaPlaying += this.OnNewMediaPlaying; + _client.OnMediaPaused += this.OnRemoteMediaPaused; + _client.OnMediaResumed += this.OnRemoteMediaResumed; + _client.OnNewMediaPlaying += this.OnNewRemoteMediaPlaying; _client.OnPartyMemberJoined += this.OnPartyMemberJoined; _client.OnPartyMemberLeft += this.OnPartyMemberLeft; @@ -152,12 +152,12 @@ namespace Aurora.Design.Views.Party { case ConnectionType.Host: { - OnHostExecute(); + OnHostCommandExecute(); break; } case ConnectionType.Join: { - OnJoinExecute(); + OnJoinCommandExecute(); break; } } @@ -182,7 +182,7 @@ namespace Aurora.Design.Views.Party /// /// /// - public void OnMediaPaused(object sender, MediaPausedEventArgs args) + public void OnRemoteMediaPaused(object sender, MediaPausedEventArgs args) { StopPlaying(); } @@ -192,7 +192,7 @@ namespace Aurora.Design.Views.Party /// /// /// - public void OnNewMediaPlaying(object sender, NewMediaPlayingEventArgs args) + public void OnNewRemoteMediaPlaying(object sender, NewMediaPlayingEventArgs args) { PlayFromBeginning(GetMediaFromQueue(args.Event.Media.Id)); } @@ -202,7 +202,7 @@ namespace Aurora.Design.Views.Party /// /// /// - public void OnMediaResumed(object sender, MediaResumedEventArgs args) + public void OnRemoteMediaResumed(object sender, MediaResumedEventArgs args) { PlayResume(); } @@ -242,7 +242,7 @@ namespace Aurora.Design.Views.Party #endregion Events #region Commands - private async void OnJoinExecute() + private async void OnJoinCommandExecute() { SetState(PartyState.Connecting); _client.Start(_hostname, SettingsService.Instance.DefaultPort.ToString()); @@ -260,12 +260,12 @@ namespace Aurora.Design.Views.Party } } - private bool CanJoinExecute() + private bool CanJoinCommandExecute() { return true; } - private async void OnHostExecute() + private async void OnHostCommandExecute() { //Change state SetState(PartyState.Connecting); @@ -288,22 +288,22 @@ namespace Aurora.Design.Views.Party } } - private bool CanHostExecute() + private bool CanHostCommandExecute() { return true; } - private async void OnLeavePartyExecute() + private async void OnLeavePartyCommandExecute() { await _client.RemotePartyClient.LeavePartyAsync(new LeavePartyRequest()); } - private bool CanLeaveParty() + private bool CanLeavePartyCommandExecute() { return (this._state == PartyState.InParty || this._state == PartyState.Hosting) ? true : false; } - public override void OnPlayButtonExecute() + public override void OnPlayButtonCommandExecute() { if (base.IsPlaying()) { @@ -329,17 +329,17 @@ namespace Aurora.Design.Views.Party } } - public override bool CanPlayButtonExecute() + public override bool CanPlayButtonCommandExecute() { return this._state == PartyState.Hosting; } - public override bool CanNextButtonExecute() + public override bool CanNextButtonCommandExecute() { return this._state == PartyState.Hosting; } - public override bool CanPreviousButtonExecute() + public override bool CanPreviousButtonCommandExecute() { return this._state == PartyState.Hosting; } @@ -347,7 +347,7 @@ namespace Aurora.Design.Views.Party /// /// On double click execute, fire media playing event /// - public void OnDoubleClickExecute() + public void OnDoubleClickCommandExecute() { //Fire Playing event AudioMetadata meta = _selectedMedia.Metadata as AudioMetadata; @@ -368,7 +368,7 @@ namespace Aurora.Design.Views.Party }); } - public bool CanDoubleClickExecute() + public bool CanDoubleClickCommandExecute() { return this._state == PartyState.Hosting; } diff --git a/Aurora/Design/Views/Songs/SongsViewModel.cs b/Aurora/Design/Views/Songs/SongsViewModel.cs index 70b374d..588f0e4 100644 --- a/Aurora/Design/Views/Songs/SongsViewModel.cs +++ b/Aurora/Design/Views/Songs/SongsViewModel.cs @@ -51,7 +51,7 @@ namespace Aurora.Design.Views.Songs #endregion Methods #region Commmands - public override bool CanPreviousButtonExecute() + public override bool CanPreviousButtonCommandExecute() { return true; } @@ -60,12 +60,12 @@ namespace Aurora.Design.Views.Songs } - public override bool CanPlayButtonExecute() + public override bool CanPlayButtonCommandExecute() { return true; } - public override void OnPlayButtonExecute() + public override void OnPlayButtonCommandExecute() { if (_selectedSong == null) { @@ -82,7 +82,7 @@ namespace Aurora.Design.Views.Songs } - public override bool CanNextButtonExecute() + public override bool CanNextButtonCommandExecute() { return true; }