private void menuShareFile_Click(object sender, EventArgs e) { if (fileListView.SelectedItems.Count == 0) { MessageBox.Show("没有选中的文件!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } try { foreach (ListViewItem item in fileListView.SelectedItems) { int res = (int)item.Tag; if (res <= 0) { MessageBox.Show("无法共享选择的资源!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _helper.ShareResource(_currentUser, res); } } catch (Exception ex) { MessageBox.Show("无法共享: " + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void menuShareFolder_Click(object sender, EventArgs e) { try { int res = GetSelectedTreeResource(); if (res <= 0) { MessageBox.Show("无法共享选择的资源!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } helper.ShareResource(_currentUser, res); } catch (Exception ex) { MessageBox.Show("无法共享: " + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } }