/// <summary> /// Modifies the source data before passing it to the target for display in the UI. /// </summary> /// <param name="value">The source data being passed to the target.</param> /// <param name="targetType">The <see cref="T:System.Type"/> of data expected by the target dependency property.</param> /// <param name="parameter">An optional parameter to be used in the converter logic.</param> /// <param name="culture">The culture of the conversion.</param> /// <returns> /// The value to be passed to the target dependency property. /// </returns> public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (!(value is PlayerStatusType)) { return(this.NotReadyBrush); } PlayerStatusType playerStatus = (PlayerStatusType)value; Brush returnBrush = this.NotReadyBrush; switch (playerStatus) { case PlayerStatusType.NotReady: returnBrush = this.NotReadyBrush; break; case PlayerStatusType.Ready: returnBrush = this.ReadyBrush; break; case PlayerStatusType.Loading: returnBrush = this.LoadingBrush; break; } return(returnBrush); }
public static string GetInheritGroupStatus(int GroupID, PlayerStatusType statusType, ToilluminateEntities db) { GroupMaster gm = db.GroupMaster.Find(GroupID); switch (statusType) { case PlayerStatusType.Active: if (gm.ActiveFlag != "2") { return(gm.ActiveFlag); } else { return(GetInheritGroupStatus((int)gm.GroupParentID, PlayerStatusType.Active, db)); } case PlayerStatusType.Online: if (gm.OnlineFlag != "2") { return(gm.OnlineFlag); } else { return(GetInheritGroupStatus((int)gm.GroupParentID, PlayerStatusType.Online, db)); } default: return(""); } }
public static string GetPlayerStatusByID(PlayerMaster pm, PlayerStatusType statusType, ToilluminateEntities db) { switch (statusType) { case PlayerStatusType.Active: if (pm.ActiveFlag != "2") { return(pm.ActiveFlag); } else { return(GetInheritGroupStatus((int)pm.GroupID, PlayerStatusType.Active, db)); } case PlayerStatusType.Online: if (pm.OnlineFlag != "2") { return(pm.OnlineFlag); } else { return(GetInheritGroupStatus((int)pm.GroupID, PlayerStatusType.Online, db)); } default: return(""); } }
public string GetFriendlyName(PlayerStatusType playerStatusType) { foreach (var trigger in this) { if (trigger.PlayerStatus.Id == playerStatusType.Id) { return(trigger.Name); } } return(playerStatusType.Name); }
public void RefreshPlayerStatus(PlayerStatusType status, RepeatType repeatType, bool isShuffleEnabled) { _isPlaying = status == PlayerStatusType.Playing; RunOnUiThread(() => { switch (status) { case PlayerStatusType.Playing: _btnPlayPause.SetImageResource(Resource.Drawable.player_pause); break; default: _btnPlayPause.SetImageResource(Resource.Drawable.player_play); break; } }); }
public void RefreshPlayerStatus(PlayerStatusType status, RepeatType repeatType, bool isShuffleEnabled) { Console.WriteLine("MainWindow - RefreshPlayerStatus - status: {0}", status.ToString()); Gtk.Application.Invoke(delegate{ switch (status) { case PlayerStatusType.Initialized: case PlayerStatusType.Stopped: case PlayerStatusType.Paused: actionPlay.StockId = "gtk-media-play"; //actionPlay.IconName = "gtk-media-play"; break; case PlayerStatusType.Playing: actionPlay.StockId = "gtk-media-pause"; //actionPlay.IconName = "gtk-media-pause"; break; } }); }
private void Initialize() { Console.WriteLine("WidgetService - Initializing service..."); int maxMemory = (int) (Runtime.GetRuntime().MaxMemory()/1024); int cacheSize = maxMemory/16; _bitmapCache = new BitmapCache(null, cacheSize, 200, 200); _messengerHub = Bootstrapper.GetContainer().Resolve<ITinyMessengerHub>(); _playerService = Bootstrapper.GetContainer().Resolve<IPlayerService>(); _messengerHub.Subscribe<PlayerPlaylistIndexChangedMessage>((message) => { Console.WriteLine("WidgetService - PlayerPlaylistIndexChangedMessage"); if (message.Data.AudioFileStarted != null) { _audioFile = message.Data.AudioFileStarted; //UpdateNotificationView(message.Data.AudioFileStarted, null); UpdateWidgetView(); GetAlbumArt(message.Data.AudioFileStarted); } }); _messengerHub.Subscribe<PlayerStatusMessage>((message) => { Console.WriteLine("WidgetService - PlayerStatusMessage - Status=" + message.Status.ToString()); _status = message.Status; UpdateWidgetView(); }); }
private void Initialize() { Console.WriteLine("NotificationService - Initializing service..."); int maxMemory = (int) (Runtime.GetRuntime().MaxMemory()/1024); int cacheSize = maxMemory/16; _bitmapCache = new BitmapCache(null, cacheSize, 200, 200); _messengerHub = Bootstrapper.GetContainer().Resolve<ITinyMessengerHub>(); _playerService = Bootstrapper.GetContainer().Resolve<IPlayerService>(); _messengerHub.Subscribe<PlayerPlaylistIndexChangedMessage>((message) => { Console.WriteLine("NotificationService - PlayerPlaylistIndexChangedMessage"); if (message.Data.AudioFileStarted != null) { _audioFile = message.Data.AudioFileStarted; //UpdateNotificationView(message.Data.AudioFileStarted, null); UpdateNotificationView(); GetAlbumArt(message.Data.AudioFileStarted); } }); _messengerHub.Subscribe<PlayerStatusMessage>((message) => { Console.WriteLine("NotificationService - PlayerStatusMessage - Status=" + message.Status.ToString()); _status = message.Status; UpdateNotificationView(); }); // Declare the service as foreground (i.e. the user is aware because of the audio) Console.WriteLine("NotificationService - Declaring service as foreground (API {0})...", (int) global::Android.OS.Build.VERSION.SdkInt); CreateNotificationView(); }
public void RefreshPlayerStatus(PlayerStatusType status) { }
public void RefreshPlayerStatus(PlayerStatusType status) { RunOnUiThread(() => { bool hasStartedPlaying = !_isPlaying && status == PlayerStatusType.Playing; _isPlaying = status == PlayerStatusType.Playing; //Console.WriteLine("MainActivity - PlayerStatusMessage - Status=" + message.Status.ToString()); RunOnUiThread(() => { if (hasStartedPlaying) { //Console.WriteLine("MainActivity - PlayerStatusMessage - HasStartedPlaying"); if (_viewFlipper.Visibility == ViewStates.Gone) { //Console.WriteLine("MainActivity - PlayerStatusMessage - Showing view flipper"); _viewFlipper.Visibility = ViewStates.Visible; } } switch (status) { case PlayerStatusType.Playing: _btnPlayPause.SetImageResource(Resource.Drawable.player_pause); break; default: _btnPlayPause.SetImageResource(Resource.Drawable.player_play); break; } }); }); }
private void LoadArenaLayouts(Arena arena, ArenaViewModel arenaViewModel) { foreach (var arenaLayout in arena.Layouts) { var arenaLayoutViewModel = new ArenaLayoutViewModel(arenaViewModel, new PlayerStatusTypeViewModel(PlayerStatusType.FromId(arenaLayout.PlayerStatus), _skinDefinition.Triggers), arenaLayout.Attributes, arenaLayout.DataGridInfo); LoadArenaLayoutAlsoPlayingGames(arenaViewModel.Name, arenaLayoutViewModel, arenaLayout.AlsoPlayingGames); LoadArenaLayoutFilters(arenaLayoutViewModel, arenaLayout.FilteringInfo); LoadArenaLayoutGames(arenaViewModel.Name, arenaLayoutViewModel, arenaLayout.Games, arenaViewModel.IsNewGamesArena); arenaViewModel.Layouts.Add(arenaLayoutViewModel); } if (arenaViewModel.Layouts.Count > 0) { arenaViewModel.Layouts[0].Activate(); } }
private void LoadLobbies(LobbyCollection lobbies) { if (lobbies.Count == 0) { _skinDefinition.Lobbies = new LobbyCollectionViewModel(Constants.DefaultNumberOfLobbyItems, _skinDefinition.Triggers); } else { _skinDefinition.Lobbies = new LobbyCollectionViewModel(lobbies.First().Items.Count, _skinDefinition.Triggers); } foreach (var lobby in lobbies) { var lobbyViewModel = new LobbyViewModel(new PlayerStatusTypeViewModel(PlayerStatusType.FromId(lobby.PlayerStatus), _skinDefinition.Triggers), lobby.FavoriteSize); foreach (var item in lobby.Items) { var itemViewModel = FindLobbyItemSource(item.Id); if (itemViewModel != null) { lobbyViewModel.Items.Add(new LobbyItemViewModel(itemViewModel)); } else { _buildErrors.Add(new ErrorMessageViewModel("Lobby arena", $"Cannot find the lobby item {item.Id} in the list of available lobby items", ErrorServerity.Warning, null)); } } _skinDefinition.Lobbies.Add(lobbyViewModel); } }
private void LoadGamesGroupCollection(string description, GameGroupLayoutCollection source, GameGroupLayoutCollectionViewModel destination) { foreach (var layout in source) { var viewModel = new GameGroupLayoutViewModel(new PlayerStatusTypeViewModel(PlayerStatusType.FromId(layout.PlayerStatus), _skinDefinition.Triggers)); foreach (var game in layout.Games) { AddGameToCollection(game.Id, viewModel.Games, description); } destination.Add(viewModel); } }
public void RefreshPlayerStatus(PlayerStatusType status, RepeatType repeatType, bool isShuffleEnabled) { Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { if (status == PlayerStatusType.Playing) imagePlayPause.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/Images/Toolbar/pause.png")); else imagePlayPause.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/Images/Toolbar/play.png")); switch (repeatType) { case RepeatType.Off: imageRepeat.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/Images/Toolbar/repeat_off.png")); break; case RepeatType.Playlist: imageRepeat.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/Images/Toolbar/repeat_on.png")); break; case RepeatType.Song: imageRepeat.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/Images/Toolbar/repeat_single.png")); break; default: throw new ArgumentOutOfRangeException(); } string imageName = isShuffleEnabled ? "shuffle_on" : "shuffle_off"; imageShuffle.Source = new BitmapImage(new Uri(string.Format("pack://application:,,,/Resources/Images/Toolbar/{0}.png", imageName))); EnableUIForPlayerStatus(status); })); }
public PlayerStatusTypeViewModel(PlayerStatusType playerStatus, IPlayerStatusFriendlyNameProvider playerStatusFriendlyNameProvider) { PlayerStatus = playerStatus; _playerStatusFriendlyNameProvider = playerStatusFriendlyNameProvider; _playerStatusFriendlyNameProvider.Changed += PlayerStatusFriendlyNameProvider_Changed; }
private void EnableUIForPlayerStatus(PlayerStatusType status) { bool enabled = status != PlayerStatusType.Stopped && status != PlayerStatusType.Initialized; trackPosition.IsEnabled = enabled; trackTimeShifting.IsEnabled = enabled; trackPitchShifting.IsEnabled = enabled; btnAddLoop.IsEnabled = enabled; btnAddLoop.Enabled = enabled; btnAddMarker.IsEnabled = enabled; btnAddMarker.Enabled = enabled; btnUseThisTempo.IsEnabled = enabled; btnChangeKey.IsEnabled = enabled; btnEditSongMetadata.IsEnabled = enabled; btnSearchGuitarTabs.IsEnabled = enabled; btnSearchBassTabs.IsEnabled = enabled; btnSearchLyrics.IsEnabled = enabled; btnIncrementPitch.IsEnabled = enabled; btnDecrementPitch.IsEnabled = enabled; btnResetPitch.IsEnabled = enabled; btnIncrementTime.IsEnabled = enabled; btnDecrementTime.IsEnabled = enabled; btnResetTime.IsEnabled = enabled; }
public void RefreshPlayerStatus(PlayerStatusType status, RepeatType repeatType, bool isShuffleEnabled) { Console.WriteLine("RefreshPlayerStatus - Status: {0} - RepeatType: {1} - IsShuffleEnabled: {2}", status, repeatType, isShuffleEnabled); InvokeOnMainThread(() => { switch (status) { case PlayerStatusType.Initialized: case PlayerStatusType.Stopped: case PlayerStatusType.Paused: case PlayerStatusType.StartPaused: case PlayerStatusType.WaitingToStart: btnToolbarPlayPause.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "toolbar_play"); break; case PlayerStatusType.Playing: btnToolbarPlayPause.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "toolbar_pause"); break; default: throw new ArgumentOutOfRangeException(); } switch (repeatType) { case RepeatType.Off: btnToolbarRepeat.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "toolbar_repeat_off"); break; case RepeatType.Playlist: btnToolbarRepeat.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "toolbar_repeat_on"); break; case RepeatType.Song: btnToolbarRepeat.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "toolbar_repeat_single"); break; default: throw new ArgumentOutOfRangeException(); } string imageName = isShuffleEnabled ? "toolbar_shuffle_on" : "toolbar_shuffle_off"; btnToolbarShuffle.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == imageName); }); }
public void RefreshPlayerStatus(PlayerStatusType status) { RunOnUiThread(() => { //Console.WriteLine("LockScreenActivity - PlayerStatusMessage - Status: " + message.Status.ToString()); if (status == PlayerStatusType.Initialized || status == PlayerStatusType.Paused || status == PlayerStatusType.Stopped) { _isPlaying = false; _btnPlayPause.SetImageResource(Resource.Drawable.player_play); } else { _isPlaying = true; _btnPlayPause.SetImageResource(Resource.Drawable.player_pause); } }); }
public void RefreshPlayerStatus(PlayerStatusType status, RepeatType repeatType, bool isShuffleEnabled) { InvokeOnMainThread(() => { switch (status) { case PlayerStatusType.Paused: btnPlayPause.GlyphImageView.Image = UIImage.FromBundle("Images/Player/play"); break; case PlayerStatusType.Playing: btnPlayPause.GlyphImageView.Image = UIImage.FromBundle("Images/Player/pause"); break; } }); }