private void txtActorGender_TextChanged(object sender, TextChangedEventArgs e) { CharacterItem chara = lstCharacters.SelectedItem as CharacterItem; if (chara.lblActorGender.Content != txtActorGender.Text) { Actor actor = projie.Assets.Actors[Convert.ToInt16(chara.lblActorID.Content) - 1]; int containsGender = 0; foreach (Field field in actor.Fields) { switch (field.Title) { case "Gender": field.Value = txtActorGender.Text; containsGender = 1; break; } } if (containsGender == 0) { Field addField = new Field(); addField.Title = "Gender"; addField.Value = txtActorGender.Text; actor.Fields.Add(addField); } chara.lblActorGender.Content = txtActorGender.Text; needsSave = true; } }
private void btnPicturePicker_Click(object sender, RoutedEventArgs e) { if (lstCharacters.SelectedItem != null) { CharacterItem chara = lstCharacters.SelectedItem as CharacterItem; OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Image Files (*.png;*.jpeg;*.jpg)|*.png;*.jpeg;*.jpg"; openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); //if(txtActorPicture.Text != "") // openFileDialog.InitialDirectory = txtActorPicture.Text; if (openFileDialog.ShowDialog() == true) { string actorImageString = ImageToBase64(openFileDialog.FileName); txtActorPicture.Text = actorImageString; BitmapImage actorImage = Base64ToImage(txtActorPicture.Text); imgActorPicture.Source = actorImage; if (txtActorPicture.Text != "" && chara.lblActorPicture.Content != txtActorPicture.Text) { chara.lblActorPicture.Content = actorImageString; chara.imgActorImage.Source = actorImage; Actor actor = projie.Assets.Actors[Convert.ToInt16(chara.lblActorID.Content) - 1]; int containsDescription = 0; foreach (Field field in actor.Fields) { switch (field.Title) { case "Pictures": field.Value = actorImageString; containsDescription = 1; break; } } if (containsDescription == 0) { Field addField = new Field(); addField.Title = "Pictures"; addField.Value = actorImageString; actor.Fields.Add(addField); } } } needsSave = true; } }
private void txtActorAge_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e) { CharacterItem chara = lstCharacters.SelectedItem as CharacterItem; if (txtActorAge.Value.ToString() != "" && chara.lblActorAge.Content != txtActorAge.Value.ToString()) { Actor actor = projie.Assets.Actors[Convert.ToInt16(chara.lblActorID.Content) - 1]; int containsAge = 0; foreach (Field field in actor.Fields) { switch (field.Title) { case "Age": field.Value = txtActorAge.Value.ToString(); containsAge = 1; break; } } if (containsAge == 0) { Field addField = new Field(); addField.Title = "Age"; addField.Value = txtActorAge.Value.ToString(); actor.Fields.Add(addField); } chara.lblActorAge.Content = txtActorAge.Value.ToString(); needsSave = true; } }