private void PlaceableConfigurator_DialogButtonClicked(object sender, PlaceableDialogButtonClickedEventArgs e) { TileManagerViewModel vm = DataContext as TileManagerViewModel; if (e.DialogResult == DialogResult.OK) { FileInfo imageFileInfo = !string.IsNullOrWhiteSpace(e.Placeable.ImagePath) ? new FileInfo(e.Placeable.ImagePath) : null; if (imageFileInfo != null && imageFileInfo.Exists) { string localResourcePath = Path.Combine(vm.SelectedCollection.FilePath, "placeables", "resources"); if (!Directory.Exists(localResourcePath)) { Directory.CreateDirectory(localResourcePath); } string localImagePath = Path.Combine(localResourcePath, imageFileInfo.Name); if (!new FileInfo(localImagePath).Exists) { File.Copy(imageFileInfo.FullName, localImagePath); } e.Placeable.ImagePath = localImagePath; } if (!vm.IsEditPlaceable) { vm.SelectedCollection.PlaceableFile.Data.Add(e.Placeable); } } vm.IsPlaceableConfiguratorOpen = false; }
protected virtual void OnDialogButtonClicked(PlaceableDialogButtonClickedEventArgs e) { DialogButtonClicked?.Invoke(this, e); }