public void SelectObject(RadTreeNode info) { bool flag = info == null; if (flag) { this.listView1.Items.Clear(); } else { NBatchInfo nBatchInfo = info.Tag as NBatchInfo; bool flag2 = nBatchInfo != null; if (flag2) { this.SelectObject(nBatchInfo); } else { NFileInfo nFileInfo = info.Tag as NFileInfo; bool flag3 = nFileInfo != null; if (flag3) { this.SelectObject(nFileInfo); } else { this.SelectObject(nFileInfo); } } } }
public void UploadBatch(NBatchInfo batch) { NResultInfo nResultInfo = new NResultInfo(); nResultInfo.Status = EResultStatus.eSuccess; NResultInfo result; try { string transMode = AppContext.GetInstance().Config.GetConfigParamValue("NetSetting", "TransMode"); //batch.TransMode = (ETransMode)Enum.Parse(typeof(ETransMode), transMode); if (transMode.Equals(ConstString.TRANSMODE_FULL)) { HttpClientManager.FullUpload(batch); //完全方式提交 } else if (transMode.Equals(ConstString.TRANSMODE_BROKE)) { HttpClientManager.BroekUpload(batch); //断点方式提交 } this.ReportMsg(ENetTransferStatus.Success, batch.BatchNO, "", 0.0, 0.0); } //catch (WebException ex) //{ // this.ReportMsg(ENetTransferStatus.Error, batch.BatchNO, ExceptionHelper.GetFirstException(ex).Message, 0.0, 0.0); //} catch (Exception e) { this.ReportMsg(ENetTransferStatus.Error, batch.BatchNO, ExceptionHelper.GetFirstException(e).Message, 0.0, 0.0); } //this._uploadresult = nResultInfo; //result = nResultInfo; //return result; }
NBatchInfo INetTransfer.DownloadBatch(NQueryBatchInfo queryinfo) { this._downloadresult = null; string fileName = this.GetFileName(queryinfo.BatchNO); NBatchInfo nBatchInfo = new NBatchInfo(); this.ReportMsg(ENetTransferStatus.Start, queryinfo.BatchNO, "", 0.0, 0.0); bool flag = File.Exists(fileName); if (flag) { nBatchInfo = NBatchInfo.FromPBFile(fileName); nBatchInfo.Operation = EOperType.eFROM_SERVER_NOTCHANGE; foreach (NFileInfo current in nBatchInfo.FileInfos) { current.Operation = EOperType.eFROM_SERVER_NOTCHANGE; } this._downloadresult = nBatchInfo; this.ReportMsg(ENetTransferStatus.Success, queryinfo.BatchNO, "完成", 0.0, 0.0); } else { this.ReportMsg(ENetTransferStatus.Error, queryinfo.BatchNO, "服务器不存在此批次信息", 0.0, 0.0); nBatchInfo.ResultInfo = new NResultInfo { Status = EResultStatus.eFailed, Msg = "服务器不存在此批次信息" }; } return(nBatchInfo); }
private void btn_UploadBatch_Click(object sender, EventArgs e) { bool flag = false; NBatchInfoGroup nBatchInfoGroup = new NBatchInfoGroup(); foreach (ListViewItem listViewItem in this.listView1.Items) { bool flag2 = listViewItem.Checked && listViewItem.SubItems[1].Text != "成功"; if (flag2) { NBatchInfo nBatchInfo = listViewItem.Tag as NBatchInfo; nBatchInfo.SetupBatchInfo(); nBatchInfoGroup.Batchs.Add(nBatchInfo); flag = true; } } bool flag3 = !flag; if (flag3) { MessageBox.Show("请勾选影像批次"); } else { foreach (NBatchInfo current in nBatchInfoGroup.Batchs) { this._transfer = INetTransferFactory.GetNetTransfer(); this._transfer.OnNotify -= new EventHandler <TEventArg <NetTransferNotifyMsg> >(this.OnTransferNotify); this._transfer.OnNotify += new EventHandler <TEventArg <NetTransferNotifyMsg> >(this.OnTransferNotify); this._transfer.UploadBatch(current); } } }
//return !string.IsNullOrWhiteSpace(input) ? Regex.Match(input, @"http://\w*\.directupload\.net/images/\d*/\w*\.[a-z]{3}").Value : null; /// <summary> /// 断点续传方式提交批次,通信两次,第一次提交批次和文件信息,第二次提交文件数据 /// </summary> /// <param name="batchInfo"></param> /// <returns></returns> public static void BroekUpload(NBatchInfo batchInfo) { batchInfo.Status = EBatchStatus.NEW; string url = HttpUtil.GetHttpBrokeUploadBatchURL(); byte[] batchBytes = batchInfo.ToPbMsgWithoutData().ToByteArray(); //提交批次信息 byte[] resultBytes = PostWithContent(url, batchBytes, batchInfo.BatchNO).Result; NResultInfo resultInfo = NResultInfo.FromNetMsg(MsgResultInfo.ParseFrom(resultBytes)); resultInfo.EnsureResultSuccess(); IList <string> processingFileIds = resultInfo.ProcessingFileIds; //List<NFileInfo> processingFileInfos = batchInfo.FileInfos.Where(x => processingFileIds.Contains(x.FileNO)).ToList(); //选出处理中的文件继续提交 batchInfo.FileInfos = batchInfo.FileInfos.Where(x => processingFileIds.Contains(x.FileNO)).ToList(); //选出处理中的文件继续提交 foreach (NFileInfo fileInfo in batchInfo.FileInfos) //提交剩余文件 { batchInfo.Status = EBatchStatus.PROCESSING; //url = HttpUtil.GetHttpBrokeUploadFileURL(); batchBytes = batchInfo.ToPbMsgWithData().ToByteArray(); resultBytes = PostWithContent(url, batchBytes, batchInfo.BatchNO).Result; resultInfo = NResultInfo.FromNetMsg(MsgResultInfo.ParseFrom(resultBytes)); resultInfo.EnsureResultSuccess(); } //发送批次完成请求 url = HttpUtil.GetHttpFinishBrokeBatchURL(batchInfo.BatchNO); resultBytes = Post(url, batchInfo.BatchNO).Result; resultInfo = NResultInfo.FromNetMsg(MsgResultInfo.ParseFrom(resultBytes)); resultInfo.EnsureResultSuccess(); }
private void SetupShenHeList(NBatchInfo data) { this.listView1.Items.Clear(); bool flag = data == null; if (!flag) { bool flag2 = data.ExShenheResult != 0; if (flag2) { ListViewItem listViewItem = this.listView1.Items.Add(data.BatchNO); listViewItem.SubItems.Add(data.ExShenheResult.ToString()); listViewItem.SubItems.Add(data.ExShenheRemark); listViewItem.Tag = data; } foreach (NFileInfo current in data.FileInfos) { bool flag3 = data.ExShenheResult != 0; if (flag3) { ListViewItem listViewItem2 = this.listView1.Items.Add(current.FileName); listViewItem2.SubItems.Add(current.ExShenheResult.ToString()); listViewItem2.SubItems.Add(current.ExShenheRemark); } } } }
public void FromBatch(NBatchInfoGroup group) { if (((group != null) && (group.Batchs != null)) && (group.Batchs.Count > 0)) { NBatchInfo batchInfo = group.Batchs[0]; RadTreeNode batchNode = CreateBatchNode(batchInfo); List <NFileInfo> fileInfos = batchInfo.FileInfos; //fileInfos.ForEach(x => x.FileName = x.FileNO); //HashSet<String> categorys = new HashSet<string>(); foreach (NFileInfo fileInfo in fileInfos) { string category = fileInfo.Category; if (String.IsNullOrEmpty(category)) //没有分类的文件 { CreateFileNodeFromServer(batchNode, fileInfo, batchInfo); } else { String path = batchNode.Text + "." + category; RadTreeNode categoryNode = navigateTree.GetNodeByPath(path, "."); if (categoryNode == null) { categoryNode = navigateTree.AddNodeByPath(path, "."); UpdateCategoryNode(categoryNode); categoryNode.Parent.Nodes.Move(categoryNode.Index, 0); //将分类节点移到父节点最前面的位置 } CreateFileNodeFromServer(categoryNode, fileInfo, batchInfo); } } batchNode.ExpandAll(); UpdateBatchNodeTitle(batchNode); } }
public static NBatchInfo GetBatch(string batchNo) { string url = HttpUtil.GetHttpGetBatchURL(batchNo); //提交批次信息 byte[] resultBytes = Post(url, batchNo).Result; NResultInfo resultInfo = NResultInfo.FromNetMsg(MsgResultInfo.ParseFrom(resultBytes)); resultInfo.EnsureResultSuccess(); NBatchInfo batchInfo = resultInfo.BatchInfo; IList <NFileInfo> fileInfos = batchInfo.FileInfos; string tmpDir = AppContext.GetInstance().Config.GetConfigParamValue("AppSetting", "TmpFileDir"); string batchDir = Path.Combine(tmpDir, batchInfo.BatchNO); Directory.CreateDirectory(batchDir); TmpDirMgr.AddTmpDir(batchDir); foreach (NFileInfo fileInfo in fileInfos) { string filePath = Path.Combine(batchDir, fileInfo.FileNO); fileInfo.LocalPath = filePath; File.WriteAllBytes(filePath, fileInfo.Data); TmpFileMgr.AddTmpFile(filePath); } return(batchInfo); }
public void UploadBatch(NBatchInfo info) { ParameterizedThreadStart start = new ParameterizedThreadStart(this.ThreadJobUploadImp); Thread thread = new Thread(start); thread.Start(info); //return null; }
/// <summary> /// 全批次上传,只通信一次,批次信息+批次数据 /// </summary> /// <param name="batchInfo"></param> public static void FullUpload(NBatchInfo batchInfo) { string url = HttpUtil.GetHttpFullUploadBatchURL(); byte[] batchBytes = batchInfo.ToPbMsgWithData().ToByteArray(); //提交批次信息 byte[] resultBytes = PostWithContent(url, batchBytes, batchInfo.BatchNO).Result; NResultInfo resultInfo = NResultInfo.FromNetMsg(MsgResultInfo.ParseFrom(resultBytes)); }
public static NBatchInfo CreateTmpNBatchInfo(this RadTreeNode node) { NBatchInfo info = new NBatchInfo { BatchNO = (node.Tag as NBatchInfo).BatchNO, Author = AccountSetting.GetInstance().AccountName }; info.FileInfos.AddRange(node.GetChildren().SelectNFileNode().Select <RadTreeNode, NFileInfo>(o => o.Tag as NFileInfo)); return(info); }
public void SelectObject(NBatchInfo info) { this.listView1.Items.Clear(); bool flag = info != null; if (flag) { this.AddItem("编号", info.BatchNO); this.AddItem("条形码", info.BarCode); this.AddItem("操作员", info.TellerNO); this.AddItem("提交时间", info.CreateTime.ToString()); } }
void INetTransfer.UploadBatch(NBatchInfo info) { this.ReportMsg(ENetTransferStatus.Start, info.BatchNO, "", 0.0, 0.0); string fileName = this.GetFileName(info.BatchNO); info.ToPBFile(fileName, AppContext.GetInstance().Config.GetConfigParamValue("NetSetting", "TransModel")); AppContext.GetInstance().MS.LogDebug("localserver mode save to " + fileName); this.ReportMsg(ENetTransferStatus.Success, info.BatchNO, "", 0.0, 0.0); NResultInfo nResultInfo = new NResultInfo(); nResultInfo.Status = EResultStatus.eSuccess; this._uploadresult = nResultInfo; //return nResultInfo; }
/* * private RadTreeNode SetBatchNodeDefaultProperty(RadTreeNode node) * { * if (node != null) * { * node.AllowDrop = false; * node.Checked = true; * node.Checked = true; * node.ItemHeight = UISetting.GetInstance().BatchNodeHeight; * node.Font = new Font(this.Font.Name, navigateTree.Lev1NodeFontSize); * node.ContextMenu = this._menudefaultbatchnode; * node.PropertyChanged += new PropertyChangedEventHandler(this.BatchNode_PropertyChanged); * } * return node; * } * * private void SetCategoryNodeDefaultProperty(RadTreeNode node) * { * node.ContextMenu = this._menuCategoryNode; * node.ShowCheckBox = false; * } * * public RadTreeNode SetFileNodeDefualtProperty(RadTreeNode node) * { * if ((node.Tag as NFileInfo).Operation == EOperType.eFROM_SERVER_NOTCHANGE) * { * node.ContextMenu = this._menuFileNode; * } * else * { * node.ContextMenu = this._menuFileNode; * } * node.ItemHeight = UISetting.GetInstance().ThumbImgSize; * node.Checked = true; * node.TextAlignment = ContentAlignment.MiddleCenter; * node.PropertyChanged += new PropertyChangedEventHandler(this.FileNode_PropertyChanged); * return node; * } * * * * private void SetupNodeDefaultProperty(RadTreeNode node) * { * if ((node.Tag != null) && (node.Tag is NCategoryInfo)) * { * this.SetCategoryNodeDefaultProperty(node); * } * if ((node.Tag != null) && (node.Tag is NFileInfo)) * { * this.SetFileNodeDefualtProperty(node); * } * if ((node.Tag != null) && (node.Tag is NBatchInfo)) * { * this.SetBatchNodeDefaultProperty(node); * } * }*/ public void TestFromFileToTree(object param = null) { OpenFileDialog dialog = new OpenFileDialog(); if (dialog.ShowDialog() == DialogResult.OK) { NBatchInfo info = NBatchInfo.FromPBFile(dialog.FileName); info.ExtractFileData(LibCommon.AppContext.GetInstance().GetVal <AppSetting>(typeof(AppSetting)).TmpFileDir); NBatchInfoGroup group = new NBatchInfoGroup { Batchs = { info } }; navigateTree.FromBatch(group); } }
private void btn_DelBatch_Click(object sender, EventArgs e) { bool flag = string.IsNullOrEmpty(this.txtBox_BatchNO.Text); if (!flag) { NBatchInfo nBatchInfo = new NBatchInfo(); nBatchInfo.BatchNO = this.txtBox_BatchNO.Text; nBatchInfo.Operation = EOperType.eDEL; this._transfer = INetTransferFactory.GetNetTransfer(); this._transfer.OnNotify -= this.OnReportDelete; this._transfer.OnNotify += this.OnReportDelete; this._transfer.UploadBatch(nBatchInfo); } }
public RadTreeNode CreateBatchNode(NBatchInfo batchInfo) { RadTreeNode batchNode = navigateTree.Nodes.Add(batchInfo.DisplayName); batchNode.Tag = batchInfo; batchNode.AllowDrop = false; batchNode.ItemHeight = 50; batchNode.TextAlignment = ContentAlignment.MiddleCenter; batchNode.Image = Properties.Resources.BatchIcno.GetThumbnailImage(40, 40, null, IntPtr.Zero); batchNode.Font = new Font(Lev1NodeFont, Lev1NodeFontSize); batchNode.ContextMenu = batchContextMenu; navigateTree.Refresh(); batchNode.Selected = true; return(batchNode); }
public void DoNewBatch(object param = null) { string str = BatchNoMaker.Cur.FromInputDialog(""); if (!string.IsNullOrEmpty(str)) { NBatchInfo batchInfo = new NBatchInfo { Operation = EOperType.eADD, BatchNO = str }; //RadTreeNode node = BatchTemplateDef.CreateRadTreeFromTemplate(navigateTree, BatchNoMaker.Cur.SelectedTemplate, str); navigateTree.FromBatchTemplate(BatchNoMaker.Cur.SelectedTemplate, batchInfo); //this.UpdateAllNodeMenu(node); } }
public RadTreeNode FromBatchTemplate(BatchTemplateDef template, NBatchInfo batchInfo) { RadTreeNode batchNode = null; TemplateNode templateRoot = template.RootNode; if (templateRoot != null) { batchNode = CreateBatchNode(batchInfo); if (templateRoot.HasChildren()) { foreach (TemplateNode templateChild in templateRoot.Children) { AddCategoryNodeByTemplateNode(batchNode, templateChild); } } } return(batchNode); }
public NBatchInfo DownloadBatch(NQueryBatchInfo queryinfo) { NResultInfo resultInfo = new NResultInfo(); this._downloadresult = null; string url = HttpUtil.GetHttpGetBatchURL(queryinfo.BatchNO); this.ReportMsg(ENetTransferStatus.Start, queryinfo.BatchNO, "", 0.0, 0.0); try { NBatchInfo batchInfo = HttpClientManager.GetBatch(queryinfo.BatchNO); //HTTP请求获取批次信息 this._downloadresult = batchInfo; this.ReportMsg(ENetTransferStatus.Success, queryinfo.BatchNO, "", 0.0, 0.0); } catch (Exception ex) { this.ReportMsg(ENetTransferStatus.Error, queryinfo.BatchNO, ExceptionHelper.GetFirstException(ex).Message, 0.0, 0.0); } return(null); }
private void Menucategoryadd_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog { InitialDirectory = LibCommon.AppContext.GetInstance().Config.GetConfigParamValue("UISetting", "LastAccessDir"), Multiselect = true }; if (dialog.ShowDialog() == DialogResult.OK) { LibCommon.AppContext.GetInstance().Config.SetConfigParamValue("UISetting", "LastAccessDir", FileHelper.GetFileDir(dialog.FileNames[0])); RadTreeNode selectedNode = navigateTree.SelectedNode; RadTreeNode batchNode = selectedNode.GetBatchNode(); NBatchInfo batchInfo = batchNode.Tag as NBatchInfo; List <NFileInfo> fileInfos = BeanUtil.FileDialog2FileInfo(dialog, batchInfo.BatchNO); AddNodeWithFileInfo(selectedNode, fileInfos, batchInfo); UpdateBatchNodeTitle(batchNode); batchNode.ExpandAll(); } }
public static bool Batch2PDF(NBatchInfo batch, string pdffname) { PdfDocument pdfDocument = new PdfDocument(); pdfDocument.Info.Title = batch.BatchNO; pdfDocument.Info.Author = batch.Author; pdfDocument.Info.Subject = batch.Title; foreach (NFileInfo current in batch.FileInfos) { bool flag = FileHelper.IsImageExt(current.LocalPath); if (flag) { PdfPage page = pdfDocument.AddPage(); XGraphics xGraphics = XGraphics.FromPdfPage(page); XImage xImage = XImage.FromFile(current.LocalPath); xGraphics.DrawImage(xImage, 0.0, 0.0, xImage.Width, xImage.Height); } } pdfDocument.Save(pdffname); return(true); }
private void BatchNode_AddLocalF_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog { InitialDirectory = LibCommon.AppContext.GetInstance().Config.GetConfigParamValue("UISetting", "LastAccessDir"), Multiselect = true }; if (dialog.ShowDialog() == DialogResult.OK) { LibCommon.AppContext.GetInstance().Config.SetConfigParamValue("UISetting", "LastAccessDir", FileHelper.GetFileDir(dialog.FileNames[0])); RadTreeNode selectedNode = navigateTree.SelectedNode; //string str = selectedNode.FullPath.ToString().Substring(selectedNode.FullPath.ToString().LastIndexOf("]") + 1); NBatchInfo batchInfo = selectedNode.Tag as NBatchInfo; //新增文件转为NFileInfo对象 List <NFileInfo> fileInfos = BeanUtil.FileDialog2FileInfo(dialog, batchInfo.BatchNO); //批次节点下增加文件节点 AddNodeWithFileInfo(selectedNode, fileInfos, batchInfo); UpdateBatchNodeTitle(selectedNode); selectedNode.ExpandAll(); } }
private void AddNodeWithFileInfo(RadTreeNode parentNode, List <NFileInfo> fileInfos, NBatchInfo batchInfo) { foreach (NFileInfo fileInfo in fileInfos) { batchInfo.LastNO++; fileInfo.FileNO = batchInfo.LastNO.ToString(); RadTreeNode node = parentNode.Nodes.Add(fileInfo.DisplayName); node.TextAlignment = ContentAlignment.MiddleCenter; node.SetImageIcon(fileInfo.LocalPath, ThumbImgSize, ThumbImgSize); node.Tag = fileInfo; if (fileInfo.Operation == EOperType.eFROM_SERVER_NOTCHANGE) { node.ContextMenu = this.fileContextMenu; } else { node.ContextMenu = this.fileContextMenu; } node.ItemHeight = UISetting.GetInstance().ThumbImgSize; node.Checked = true; node.TextAlignment = ContentAlignment.MiddleCenter; node.PropertyChanged += new PropertyChangedEventHandler(this.FileNode_PropertyChanged); Application.DoEvents(); } }
public NBatchInfoGroup ToBatch() { NBatchInfoGroup group = new NBatchInfoGroup(); foreach (RadTreeNode node in navigateTree.Nodes) { NBatchInfo batchInfo = node.Tag as NBatchInfo; batchInfo.FileInfos.Clear(); //List<String> categoryNames = node.Nodes.Where<RadTreeNode>(x => x.Tag is NCategoryInfo).ToList().Select<RadTreeNode, String>(x => (x.Tag as NCategoryInfo).CategoryName).ToList(); //batchInfo.Categorys = categoryNames; int count = node.Nodes.Count; if (batchInfo.Operation == EOperType.eADD) { //获取所有文件节点 List <RadTreeNode> fileNodes = NavigateTreeHelper.GetAllChildFileNodes(node); foreach (RadTreeNode fileNode in fileNodes) { fileNode.UpdateFileNodeCatInfo(); batchInfo.FileInfos.Add(fileNode.Tag as NFileInfo); } group.Batchs.Add(batchInfo); } else { if (batchInfo.Operation == EOperType.eFROM_SERVER_NOTCHANGE || batchInfo.Operation == EOperType.eUPD) { int version; int num3 = 1; batchInfo.FileInfos.Clear(); List <RadTreeNode> list2 = NavigateTreeHelper.GetAllChildFileNodes(node); foreach (RadTreeNode node3 in list2) { node3.UpdateNodeNInfo(); NFileInfo info3 = node3.Tag as NFileInfo; info3.SetupFileInfo(); if (info3.OrigData == null) //本地添加文件 { info3.Operation = EOperType.eADD; batchInfo.Operation = EOperType.eUPD; batchInfo.FileInfos.Add(node3.Tag as NFileInfo); } else if (info3.Operation == EOperType.eDEL) //要删除的文件, 清空数据,减少数据传输 { info3.Data = null; batchInfo.Operation = EOperType.eUPD; batchInfo.FileInfos.Add(node3.Tag as NFileInfo); } else if (info3.FileMD5 != info3.OrigData.FileMD5) //判断文件内容是否变化,有问题,操作节点时不操作Info对象 { info3.Operation = EOperType.eUPDATEFILE; NFileInfo origData = info3.OrigData; version = origData.Version; origData.Version = version + 1; info3.Version = version; batchInfo.Operation = EOperType.eUPD; batchInfo.FileInfos.Add(node3.Tag as NFileInfo); } else if (!info3.MyEqual(info3.OrigData)) //判断文件属性是否变化 { info3.Operation = EOperType.eUPDATEBASIC; info3.Version = (info3.OrigData.Version++); info3.Data = null; batchInfo.Operation = EOperType.eUPD; batchInfo.FileInfos.Add(node3.Tag as NFileInfo); } //没有任何变化不传输 } } if (batchInfo.Operation == EOperType.eUPD) { batchInfo.Version++; group.Batchs.Add(batchInfo); } } } return(group); }
protected virtual void OnFileAcquied(string FilePath) { NFileInfo fileInfo = new NFileInfo(); fileInfo.SetDate(DateTime.Now); fileInfo.Author = AccountSetting.GetInstance().AccountName; fileInfo.LocalPath = FilePath; fileInfo.FileName = FileHelper.GetFileName(FilePath); fileInfo.Operation = EOperType.eADD; NBatchInfo batchInfo = null; RadTreeNode batchNode; if (this._lastScanOpeType == ScanOpe.Add) { if (navigateTree.GetRadTree().Nodes.Count == 0) { string batchNo = BatchNoMaker.Cur.FromInputDialog(FilePath); if (string.IsNullOrEmpty(batchNo)) { return; } batchInfo = new NBatchInfo { BatchNO = batchNo }; batchNode = navigateTree.CreateBatchNode(batchInfo); } else if (navigateTree.GetRadTree().SelectedNode != null) { batchNode = navigateTree.GetRadTree().SelectedNode.GetBatchNode(); batchInfo = batchNode.Tag as NBatchInfo; } else { batchNode = navigateTree.GetRadTree().Nodes[navigateTree.GetRadTree().Nodes.Count - 1]; batchInfo = batchNode.Tag as NBatchInfo; } RadTreeNode fileNode = navigateTree.CreateFileNodeFromLocal(batchNode, fileInfo, batchInfo); batchNode.ExpandAll(); navigateTree.UpdateBatchNodeTitle(batchNode); Application.DoEvents(); } else if (this._lastScanOpeType == ScanOpe.ReplaceCurrent) { RadTreeNode selectedNode = navigateTree.SelectedNode.UpdateFileNode(fileInfo); //this.OnItemSelectChanged(this, new TEventArg<RadTreeNode>(selectedNode)); } else if (this._lastScanOpeType == ScanOpe.AddToCur) { //TODO AddToCur? /*RadTreeNode node = navigateTree.SelectedNode; * if (node.Tag is NFileInfo) * { * node = node.Parent; * }*/ batchNode = navigateTree.SelectedNode; batchInfo = batchNode.Tag as NBatchInfo; //NFileInfo info4 = new NFileInfo(); //info4.SetDate(DateTime.Now); //info4.LocalPath = FilePath; //info4.FileName = FileHelper.GetFileName(FilePath); //info4.Operation = EOperType.eADD; //RadTreeNode node5 = node.Nodes.Add(info4.DisplayName); //node.TextAlignment = ContentAlignment.MiddleCenter; //node5.SetImageIcon(info4.LocalPath, this._viewfileinfoicon); //node5.Tag = info4; //this.SetFileNodeDefualtProperty(node5); //node5.Selected = true; //node5.ToolTipText = info4.ToUITipString(); //node.ExpandAll(); RadTreeNode fileNode = navigateTree.CreateFileNodeFromLocal(batchNode, fileInfo, batchInfo); navigateTree.UpdateBatchNodeTitle(batchNode); Application.DoEvents(); } }
/// <summary> /// 创建来自服务器文件的节点,根据FileNo更新BatchInfo的LastNo /// </summary> /// <param name="parentNode"></param> /// <param name="fileInfo"></param> /// <param name="contextMenu"></param> /// <param name="batchInfo"></param> /// <returns></returns> public RadTreeNode CreateFileNodeFromServer(RadTreeNode parentNode, NFileInfo fileInfo, NBatchInfo batchInfo) { RadTreeNode fileNode = parentNode.Nodes.Add(fileInfo.DisplayName); fileNode.SetImageIcon(fileInfo.LocalPath, ThumbImgSize, ThumbImgSize); //node2.Image = ImageHelper.LoadSizedImage(info.LocalPath, this.GetSetting().ThumbImgSize, this.GetSetting().ThumbImgSize); fileNode.Tag = fileInfo; fileNode.Selected = true; fileNode.ToolTipText = fileInfo.ToUITipString(); fileNode.ContextMenu = fileContextMenu; fileNode.ItemHeight = ThumbImgSize; fileNode.Checked = true; fileNode.TextAlignment = ContentAlignment.MiddleCenter; int fileNo = fileInfo.FileNO.ToInt(); if (batchInfo.LastNO < fileNo) { batchInfo.LastNO = fileNo; } return(fileNode); }