private void 工单详情_DragDrop(object sender, DragEventArgs e) { foreach (var dragFile in (Array)e.Data.GetData(DataFormats.FileDrop)) { var str = dragFile.ToString(); bool flag; if (Directory.Exists(str)) { flag = false; foreach (TreeListNode tmpNode in treeList1.Nodes) { //if TmpNode.get if (((PostCardAlbum)tmpNode.Tag).SourceFolderInfo.FullName.ToLower() == str.ToLower()) { flag = true; } } if (!flag) { var currentAlbum = new PostCardAlbum(new DirectoryInfo(str)); } } } //ThreadPool.QueueUserWorkItem(CopyMyFile,pm); }
private void OpenMyRootSource(object sender, ItemClickEventArgs e) { var myFolder = new FolderBrowserDialog(); if (myFolder.ShowDialog() == DialogResult.OK) { var postCardAlbum = new PostCardAlbum(new DirectoryInfo(myFolder.SelectedPath)); } }
private void SetPostCardAlbumInformation(PostCardAlbum sender) { sender.MyIni.Refresh(); if (sender.MyIni.Exists) { var iFileStream = new FileStream(sender.MyIni.FullName, FileMode.Open); var myStreamReader = new StreamReader(iFileStream); var tmpProductSize = new Size(); while (!myStreamReader.EndOfStream) { var tmpString = myStreamReader.ReadLine(); if (tmpString.StartsWith("[版式]:")) { sender.Type = Convert.ToInt32(tmpString.Substring(5)); } if (tmpString.StartsWith("[宽度]:")) { tmpProductSize.Width = Convert.ToInt32(tmpString.Substring(5)); } if (tmpString.StartsWith("[高度]:")) { tmpProductSize.Height = Convert.ToInt32(tmpString.Substring(5)); } if (tmpString.StartsWith("[反面]:")) { sender.OppoppositeType = Convert.ToChar(tmpString.Substring(5, 1)); } } myStreamReader.Close(); iFileStream.Close(); //宽度必须大于高度,宽度和高度不得小于20 if (tmpProductSize.Width < tmpProductSize.Height) { tmpProductSize = new Size(tmpProductSize.Height, tmpProductSize.Width); } if (tmpProductSize.Width < 20) { tmpProductSize.Width = 20; } if (tmpProductSize.Height < 20) { tmpProductSize.Height = 20; } sender.ProductSize = tmpProductSize; } else { new FolderInfo(sender).ShowDialog(); //new FolderInfo(sender).ShowDialog(); } }
//TreeListNode currentNode; private void treeList1_FocusedNodeChanged(object sender, FocusedNodeChangedEventArgs e) { cutMyPicture.Enabled = false; recutMyPicture.Enabled = false; _currentPostCard = null; _currentPostCardAlbum = null; if (e.Node != null && e.Node.Tag != null) { if (e.Node.Tag.GetType().Name == "PostCard") { _currentPostCard = (PostCard)e.Node.Tag; groupAlbumPrint.Visibility = LayoutVisibility.Never; groupPostCard.Visibility = LayoutVisibility.Always; layoutControlItem8.Visibility = LayoutVisibility.Always; groupPostCard.Selected = true; } else if (e.Node.Tag.GetType().Name == "PostCardAlbum") { foreach (var tmpPostCard in ((PostCardAlbum)e.Node.Tag).PostCards) { if (tmpPostCard.FinishedFile.Exists == false) { tmpPostCard.Node.Selected = true; return; } } _currentPostCardAlbum = (PostCardAlbum)e.Node.Tag; groupAlbumPrint.Visibility = LayoutVisibility.Always; groupPostCard.Visibility = LayoutVisibility.Never; layoutControlItem8.Visibility = LayoutVisibility.Never; groupAlbumPrint.Selected = true; } } ReFreshMyNode(); }