Ejemplo n.º 1
0
        protected override async Task ExecuteAsync(object parameter)
        {
            Folder folder = (Folder)parameter;

            string path = _dialogService.FileBrowserDialog();

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            Meme meme = new Meme()
            {
                Title     = Path.GetFileNameWithoutExtension(path),
                ImagePath = path,
                Folder    = folder
            };

            await _dataStorage.AddMeme(meme, folder);
        }
Ejemplo n.º 2
0
        protected override async Task ExecuteAsync(object parameter)
        {
            Folder folder = (Folder)parameter;

            DialogMemeVM dialogMemeVM = new DialogMemeVM(new Meme(), folder, _serviceCollectionClass, "Создание мема");

            Meme meme = (Meme)await MaterialDesignThemes.Wpf.DialogHost.Show(dialogMemeVM, _dialogId);

            dialogMemeVM.Dispose();
            dialogMemeVM = null;
            GC.Collect();
            GC.WaitForPendingFinalizers();

            if (meme == null || string.IsNullOrEmpty(meme.ImagePath))
            {
                return;
            }

            meme.Folder = folder;
            await _dataStorage.AddMeme(meme, folder);
        }