public int Link(out string strError) { strError = ""; for (int i = 0; i < this.Count; i++) { LinkInfo info = (LinkInfo)this[i]; int nRet = info.Link(out strError); if (nRet == -1) { return(-1); } } return(0); }
void menu_modify_Click(object sender, System.EventArgs e) { Debug.Assert(this.LinkInfos != null, ""); if (this.listView_linkInfo.SelectedIndices.Count == 0) { MessageBox.Show(this, "尚未选定要修改的事项"); return; } OneLinkInfoDlg dlg = new OneLinkInfoDlg(); dlg.Font = GuiUtil.GetDefaultFont(); dlg.Text = "修改一个连接关系"; dlg.textBox_serverPath.Text = this.listView_linkInfo.SelectedItems[0].Text; dlg.textBox_localPath.Text = this.listView_linkInfo.SelectedItems[0].SubItems[1].Text; dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) { return; } LinkInfo info = (LinkInfo)LinkInfos[this.listView_linkInfo.SelectedIndices[0]]; info.ServerPath = dlg.textBox_serverPath.Text; info.LocalPath = dlg.textBox_localPath.Text; this.LinkInfos.Changed = true; FillList(); int nRet = 0; string strError = ""; nRet = info.Link(out strError); if (nRet == -1) { MessageBox.Show(this, strError); } }
void NewItem(string strServerPath) { Debug.Assert(this.LinkInfos != null, ""); OneLinkInfoDlg dlg = new OneLinkInfoDlg(); dlg.Font = GuiUtil.GetDefaultFont(); dlg.Text = "指定一个新的连接关系"; dlg.textBox_serverPath.Text = strServerPath; dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) { return; } LinkInfo info = new LinkInfo(); info.ServerPath = dlg.textBox_serverPath.Text; info.LocalPath = dlg.textBox_localPath.Text; this.LinkInfos.Add(info); this.LinkInfos.Changed = true; FillList(); int nRet = 0; string strError = ""; nRet = info.Link(out strError); if (nRet == -1) { MessageBox.Show(this, strError); } }
void NewItem(string strServerPath) { Debug.Assert(this.LinkInfos != null, ""); OneLinkInfoDlg dlg = new OneLinkInfoDlg(); dlg.Font = GuiUtil.GetDefaultFont(); dlg.Text = "指定一个新的连接关系"; dlg.textBox_serverPath.Text = strServerPath; dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) return; LinkInfo info = new LinkInfo(); info.ServerPath = dlg.textBox_serverPath.Text; info.LocalPath = dlg.textBox_localPath.Text; this.LinkInfos.Add(info); this.LinkInfos.Changed = true; FillList(); int nRet = 0; string strError = ""; nRet = info.Link(out strError); if (nRet == -1) MessageBox.Show(this, strError); }