private void OnCreateFolderButtonClick(object sender, RoutedEventArgs e) { var orgId = OrganizationTreeView.SelectedValue as String; if (!string.IsNullOrEmpty(orgId)) { var source = FileEntityListBox.ItemsSource as List <FileSystemEntity> ?? new List <FileSystemEntity>(); string strFolderName; while (true) { strFolderName = CustomMessageBox.Prompt("请输入文件夹名称"); if (string.IsNullOrEmpty(strFolderName)) { return; } if (source.Any(o => o.Name == strFolderName && o.Type == FileSystemEntityType.Folder)) { if (CustomMessageBox.Ask("文件夹名重复,是否重新指定?")) { continue; } return; } break; } var folder = new DocumentFolder { FolderId = 0, ParentId = FolderId, Name = strFolderName, CreatedBy = AuthenticateStatus.CurrentUser.UserId, CreateTime = DateTime.Now, OrganizationId = orgId, Status = ActiveStatus.Active }; BusyIndicator1.IsBusy = true; BusyIndicator1.BusyContent = "正在创建文件夹..."; documentContext.CreateFolder(folder, obj => { BusyIndicator1.IsBusy = false; if (Utility.Utility.CheckInvokeOperation(obj)) { OpenFolder(FolderId); } }, null); } }
private void OnRenameContextMenuClick(object sender, RoutedEventArgs e) { var fse = mouseElement.DataContext as FileSystemEntity; if (fse == null) { return; } string strName = CustomMessageBox.Prompt("请输入新的文件夹名称:"); if (string.IsNullOrEmpty(strName) || strName.Equals(fse.Name, StringComparison.CurrentCultureIgnoreCase)) { return; } var source = FileEntityListBox.ItemsSource as List <FileSystemEntity>; if (source != null && source.Any(o => o.Type == FileSystemEntityType.Folder && o.Name.Equals(strName, StringComparison.CurrentCultureIgnoreCase) && o.FolderId != fse.FolderId)) { CustomMessageBox.Alert("新的文件夹名称与其他文件夹名重复!"); return; } BusyIndicator1.IsBusy = true; BusyIndicator1.BusyContent = "正在执行..."; documentContext.RenameFolder(fse.FolderId, strName, obj => { BusyIndicator1.IsBusy = false; if (Utility.Utility.CheckInvokeOperation(obj)) { if (obj.Value > 0) { fse.Name = strName; } else { CustomMessageBox.Show("重命名失败!错误码:" + obj.Value); } } }, null); }