private void OnOverwriteNamesCommand()
        {
            var dirtyNames = GetDirtyObjects().Where(obj => obj is AffixedPictureName)
                             .Select(obj => (AffixedPictureName)obj)
                             .ToList();

            var allInvalidNames = dirtyNames.Where(name => !name.ToString()
                                                   .IsValidFileNameAndDoesntExist())
                                  .ToList();

            if (allInvalidNames.Count > 0)
            {
                _messageDialogService.ShowMessage("Invalid file names:",
                                                  string.Join("\r\n", allInvalidNames.Select(name =>
                                                                                             name.ToString())));
                return;
            }

            dirtyNames.RemoveAll(editName =>
            {
                if (_pictureRepository.TryChangePictureName(
                        editName.Picture, editName.ToString()).Success.Value)
                {
                    _eventAggregator.GetEvent <PictureNameChangedEvent>()
                    .Publish(new PictureNameChangePayload()
                    {
                        Guid           = editName.Picture.Guid,
                        NewPictureName = editName.ToString()
                    });

                    EditPictureNames.Remove(editName);

                    return(true);
                }
                else
                {
                    return(false);
                }
            });

            if (dirtyNames.Count > 0)
            {
                _messageDialogService.ShowMessage("Unable to change names for these:",
                                                  string.Join("\r\n", dirtyNames.Select(name =>
                                                                                        name.ToString())));
            }
        }
        private async void OnEditPictureNameCommand(Picture picture)
        {
            var newName = await _modalDialog.ShowInput("Edit Picture Name",
                                                       picture.ImageName,
                                                       picture.ImageName);

            if (string.IsNullOrWhiteSpace(newName))
            {
                return;
            }

            if (_pictureRepository.TryChangePictureName(picture, newName).Success.Value)
            {
                picture.FullFileName = newName;
            }
            else
            {
                _modalDialog.ShowMessage("Invalid File name", "Name was either invalid or already exists.");
            }
        }
Exemple #3
0
 private void ShowOkCancalMesssage()
 {
     _messageDialogService.ShowMessage("OK・キャンセルになっていますよ", "OK・キャンセルタイトル", MessageDialogType.OkCancel);
 }