Exemplo n.º 1
0
        private void RaiseRenameRequest()
        {
            if (ItemListSelectedItem is FileSearchViewModel ||
                ItemListSelectedItem is FolderSearchViewModel)
            {
                var item  = (AssetEntitySearchViewModelBase)ItemListSelectedItem;
                var title = ItemListSelectedItem is FileSearchViewModel
                                   ? "Enter new file name".Localize()
                                   : "Enter new folder name".Localize();
                var inputVm = _inputNameVmFactory.GetViewModelInstance();
                inputVm.InputText = item.DisplayName;
                var confirmation = new ConditionalConfirmation {
                    Title = title, Content = inputVm
                };

                InputNameDialogRequest.Raise(confirmation, (x) =>
                {
                    if (x.Confirmed)
                    {
                        var inputNameDialogViewModel = x.Content as IInputNameDialogViewModel;
                        if (inputNameDialogViewModel != null)
                        {
                            var newFolderName = inputNameDialogViewModel.InputText;
                            _assetRepository.Rename(item.InnerItemID, newFolderName);
                            LoadItems();
                        }
                    }
                });
            }
        }
Exemplo n.º 2
0
        private void RaiseCreateFolderRequest()
        {
            var inputVm = _inputNameVmFactory.GetViewModelInstance();

            var confirmation = new ConditionalConfirmation {
                Title = "Enter new folder name".Localize(), Content = inputVm
            };

            InputNameDialogRequest.Raise(confirmation, (x) =>
            {
                if (x.Confirmed)
                {
                    var inputNameDialogViewModel = x.Content as IInputNameDialogViewModel;
                    if (inputNameDialogViewModel != null)
                    {
                        var newFolderName = inputNameDialogViewModel.InputText;
                        _assetRepository.CreateFolder(newFolderName, ParentItem.InnerItemID);
                        LoadItems();
                    }
                }
            });
        }