public TrainerPicEditorWindow(TrainerPic initialPic) { InitializeComponent(); ViewModel.CurrentPic = initialPic; var identifierSortDesc = new SortDescription("Identifier", ListSortDirection.Ascending); picList.Items.SortDescriptions.Add(identifierSortDesc); picList.Items.IsLiveSorting = true; }
private void addPicButton_Click(object sender, RoutedEventArgs e) { if (!FileUtils.uploadImage(out string path, TrainerPicDir)) { return; } string identifier = "__new_pic_" + Project.Instance.Trainers.FrontPics.Count; System.Drawing.Bitmap image = FileUtils.loadBitmap(path); var newPic = new TrainerPic() { Identifier = identifier, PalettePath = identifier, Path = identifier, FullPath = path, UncompressedSize = image.Width * image.Height }; Project.Instance.Trainers.addFrontPic(newPic); ViewModel.CurrentPic = newPic; }