/// <summary> /// Updates the selected rows from a UserRequestRowMessage /// </summary> /// <param name="x">The x.</param> private void UpdateSelectedRows(UserRequestRowMessage msg) { try { foreach (var item in msg.GameItems) { try { if (!string.IsNullOrWhiteSpace(item.Name)) { var game = _hyperspinManager.CurrentSystemsGames.FirstOrDefault(y => y.Name == item.Name); switch (msg.RowUpdateType) { case RowUpdateType.Description: game.Description = (string)msg.Value; break; case RowUpdateType.Genre: game.Genre = (string)msg.Value; break; case RowUpdateType.Manufacturer: game.Manufacturer = (string)msg.Value; break; case RowUpdateType.Rating: game.Rating = (string)msg.Value; break; case RowUpdateType.Year: int yr = 0000; int.TryParse((string)msg.Value, out yr); game.Year = yr; break; case RowUpdateType.Enabled: game.GameEnabled = (int)msg.Value; break; case RowUpdateType.Favorite: game.IsFavorite = Convert.ToBoolean((int)msg.Value); break; default: break; } } } catch (Exception) { throw; } } } catch (Exception) { throw; } }
/// <summary> /// Updates the rows. /// </summary> /// <param name="enabled">The enabled.</param> /// <param name="enabled">The enabled.</param> private void UpdateRows(string enabled, RowUpdateType rowType) { object value = null; if (rowType == RowUpdateType.Enabled || rowType == RowUpdateType.Favorite) { value = (object)Convert.ToInt32(enabled); } try { var messgae = new UserRequestRowMessage(_selectedService.SelectedGames, rowType, value); //Publish after the gameslist is updated here _eventAgg.GetEvent <UserRequestUpdateSelectedRows>().Publish(messgae); } catch (Exception) { throw; } }
/// <summary> /// Apply a given text to the selected rows cell /// </summary> private void ApplyToCells() { if (_selectedService.SelectedGames != null && _selectedService.SelectedGames.Count > 0) { try { UserRequestRowMessage msg = null; switch (SelectedItem) { case "Description": msg = new UserRequestRowMessage(_selectedService.SelectedGames, RowUpdateType.Description, ApplyString); break; case "Genre": msg = new UserRequestRowMessage(_selectedService.SelectedGames, RowUpdateType.Genre, ApplyString); break; case "Manufacturer": msg = new UserRequestRowMessage(_selectedService.SelectedGames, RowUpdateType.Manufacturer, ApplyString); break; case "Rating": msg = new UserRequestRowMessage(_selectedService.SelectedGames, RowUpdateType.Rating, ApplyString); break; case "Year": msg = new UserRequestRowMessage(_selectedService.SelectedGames, RowUpdateType.Year, ApplyString); break; default: return; } _eventAggregator.GetEvent <UserRequestUpdateSelectedRows>().Publish(msg); } catch (Exception) { throw; } } }