void menu_modify(object sender, EventArgs e) { if (this.listView_map.SelectedItems.Count == 0) { MessageBox.Show(this, "尚未选择要修改的事项"); return; } DbNameMapItemDlg dlg = new DbNameMapItemDlg(); dlg.Font = GuiUtil.GetDefaultFont(); dlg.SearchPanel = this.SearchPanel; dlg.Origin = ResPath.GetRegularRecordPath(this.listView_map.SelectedItems[0].SubItems[0].Text); dlg.Target = ResPath.GetRegularRecordPath(this.listView_map.SelectedItems[0].SubItems[1].Text); dlg.WriteMode = this.listView_map.SelectedItems[0].SubItems[2].Text; dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) { return; } this.listView_map.SelectedItems[0].SubItems[0].Text = ResPath.GetReverseRecordPath(dlg.Origin); this.listView_map.SelectedItems[0].SubItems[1].Text = ResPath.GetReverseRecordPath(dlg.Target); this.listView_map.SelectedItems[0].SubItems[2].Text = ResPath.GetReverseRecordPath(dlg.WriteMode); }
void OnLoadDetail() { if (this.OpenDetail == null) { return; } if (this.listView_records.SelectedItems.Count == 0) { return; } string[] paths = new string[this.listView_records.SelectedItems.Count]; for (int i = 0; i < this.listView_records.SelectedItems.Count; i++) { string strPath = this.listView_records.SelectedItems[i].Text; paths[i] = ResPath.GetRegularRecordPath(strPath); } OpenDetailEventArgs args = new OpenDetailEventArgs(); args.Paths = paths; args.OpenNew = true; this.listView_records.Enabled = false; this.OpenDetail(this, args); this.listView_records.Enabled = true; }
/// <summary> /// 装入第一条记录到详细窗 /// </summary> /// <param name="bCloseWindow"></param> public void LoadFirstDetail(bool bCloseWindow) { if (this.listView_records.Items.Count == 0) { return; } string[] paths = new string[1]; paths[0] = ResPath.GetRegularRecordPath(this.listView_records.Items[0].Text); OpenDetailEventArgs args = new OpenDetailEventArgs(); args.Paths = paths; args.OpenNew = false; this.listView_records.Enabled = false; this.OpenDetail(this, args); this.listView_records.Enabled = true; if (bCloseWindow == true) { this.DialogResult = DialogResult.OK; this.Close(); } }
int BuildMap(out string strError) { strError = ""; this.DbNameMap.Clear(); for (int i = 0; i < this.listView_map.Items.Count; i++) { if (this.DbNameMap.NewItem(ResPath.GetRegularRecordPath(this.listView_map.Items[i].SubItems[0].Text), ResPath.GetRegularRecordPath(this.listView_map.Items[i].SubItems[1].Text), this.listView_map.Items[i].SubItems[2].Text, out strError) == null) { return(-1); } } return(0); }
/// <summary> /// 获取浏览记录 /// </summary> /// <param name="fullpaths">若干记录全路径</param> /// <param name="bReverse">fullpaths中路径是否为反转形式</param> /// <param name="strStyle">检索风格</param> /// <param name="records">返回记录对象</param> /// <param name="strError">返回出错信息</param> /// <returns>-1 error;0 not found;1 found</returns> public int GetBrowseRecord(string[] fullpaths, bool bReverse, string strStyle, out ArrayList records, out string strError) { strError = ""; records = new ArrayList(); int nRet = 0; ArrayList aTempPath = new ArrayList(); ArrayList aTempRecord = new ArrayList(); string strLastUrl = ""; for (int i = 0; i <= fullpaths.Length; i++) { bool bPush = false; ResPath respath = null; if (i < fullpaths.Length) { string strFullPath = fullpaths[i]; if (bReverse == true) { strFullPath = ResPath.GetRegularRecordPath(strFullPath); } respath = new ResPath(strFullPath); if (respath.Url != strLastUrl) { bPush = true; } } else { bPush = true; } if (bPush == true && aTempPath.Count > 0) { string[] temppaths = new string[aTempPath.Count]; for (int j = 0; j < temppaths.Length; j++) { temppaths[j] = (string)aTempPath[j]; } nRet = GetBrowseRecord( strLastUrl, temppaths, strStyle, out aTempRecord, out strError); if (nRet == -1) { return(-1); } records.AddRange(aTempRecord); aTempRecord.Clear(); aTempPath.Clear(); } if (i < fullpaths.Length) { aTempPath.Add(respath.Path); strLastUrl = respath.Url; } } // end of for return(0); }
/// <summary> /// 获取浏览记录。触发事件的版本 /// </summary> /// <param name="fullpaths">若干记录全路径</param> /// <param name="bReverse">fullpaths中路径是否为反转形式</param> /// <param name="strStyle">检索风格</param> /// <param name="strError">返回出错信息</param> /// <returns>-1 error;0 not found;1 found</returns> public int GetBrowseRecord(string[] fullpaths, bool bReverse, string strStyle, out string strError) { strError = ""; int nRet = 0; int nIndex = 0; ArrayList aTempPath = new ArrayList(); ArrayList aTempRecord = new ArrayList(); string strLastUrl = ""; for (int i = 0; i <= fullpaths.Length; i++) { bool bPush = false; ResPath respath = null; if (i < fullpaths.Length) { string strFullPath = fullpaths[i]; if (bReverse == true) { strFullPath = ResPath.GetRegularRecordPath(strFullPath); } respath = new ResPath(strFullPath); if (respath.Url != strLastUrl || aTempPath.Count >= 5) // 最大5条为一批。减少用户等待感 { bPush = true; } } else { bPush = true; } if (bPush == true && aTempPath.Count > 0) { string[] temppaths = new string[aTempPath.Count]; for (int j = 0; j < temppaths.Length; j++) { temppaths[j] = (string)aTempPath[j]; } nRet = GetBrowseRecord( strLastUrl, temppaths, strStyle, out aTempRecord, out strError); if (nRet == -1) { return(-1); } // 触发事件 if (this.BrowseRecord != null) { for (int j = 0; j < aTempRecord.Count; j++) { BrowseRecordEventArgs e = new BrowseRecordEventArgs(); e.SearchCount = 0; e.Index = nIndex++; e.FullPath = strLastUrl + "?" + temppaths[j]; e.Cols = (string[])aTempRecord[j]; this.BrowseRecord(this, e); if (e.Cancel == true) { if (e.ErrorInfo == "") { strError = "用户中断"; } else { strError = e.ErrorInfo; } return(-2); } } } aTempRecord.Clear(); aTempPath.Clear(); } if (i < fullpaths.Length) { aTempPath.Add(respath.Path); strLastUrl = respath.Url; } } // end of for return(0); }