public override void ViewWillAppear(bool animated) { if (Application.PetManager.SelectedPetAttribute == null) { return; } //get selected attribute infos petAttribute = Application.PetManager.SelectedPetAttribute; petAttributeID = Application.PetManager.SelectedPetAttributeID; selectedType = petAttribute.PetAttributeType; pvAttributTypePicker.Select((int)selectedType, 0, true); //if can modify if (Application.PetManager.SelectedPet.SharePower != 0) { btnSaveChanges.Enabled = true; btnDeleteAttribut.Enabled = true; } else { btnSaveChanges.Enabled = false; btnDeleteAttribut.Enabled = false; } //update view UpdateAttributeView(); }
public override void Selected(UIPickerView pickerView, nint row, nint component) { //set selected type selectedType = (PetAttributeType)((int)row); //trigger event typeChangeEvent?.Invoke(null, null); }
public static Image GetImageForPetAttributeType(PetAttributeType petAttributeType) { Image attributeImage = Properties.Resources.bone; switch (petAttributeType) { case PetAttributeType.OTHER: attributeImage = Properties.Resources.bone; break; case PetAttributeType.SEXE: attributeImage = Properties.Resources.gender; break; case PetAttributeType.WEIGHT: attributeImage = Properties.Resources.weight; break; case PetAttributeType.BIRTHDAY: attributeImage = Properties.Resources.birthday; break; case PetAttributeType.DEATHDAY: attributeImage = Properties.Resources.deathday; break; case PetAttributeType.FOOD: attributeImage = Properties.Resources.food; break; case PetAttributeType.DRUG: attributeImage = Properties.Resources.drug; break; case PetAttributeType.VETERINARY: attributeImage = Properties.Resources.veterinary; break; case PetAttributeType.WALKING: attributeImage = Properties.Resources.walking; break; case PetAttributeType.WASHING: attributeImage = Properties.Resources.washing; break; case PetAttributeType.COMPETITION: attributeImage = Properties.Resources.competition; break; } return(attributeImage); }
/// <summary> /// Inits the attribut type picker. /// </summary> public void InitAttributTypePicker() { //create new picker model var petTypePicketModel = new PetTypePickerModel(Enum.GetValues(typeof(PetAttributeType))); //set picker view model pvAttributTypePicker.Model = petTypePicketModel; //add event handler petTypePicketModel.typeChangeEvent += (sender, e) => { selectedType = petTypePicketModel.selectedType; ivAttributIcon.Image = IosPetHelper.GetImageForAttributeType(selectedType); }; }
public static UIImage GetImageForAttributeType(PetAttributeType attributeType) { UIImage image; try { //try to load image with attribute type image = new UIImage($"Attribute/{attributeType.ToString().ToLower()}.png"); } catch { image = new UIImage("Pet/other.png"); } return(image); }
String attributeDescription; //attribute description public PetAttribute(PetAttributeType petAttributeType, String attributeTitle, String attributeDescription) { this.petAttributeType = petAttributeType; this.attributeTitle = attributeTitle; this.attributeDescription = attributeDescription; }