public FileBoxItem(ObjectInfo objInfo) { InitializeComponent(); objectInfo = objInfo; if (objectInfo.Type == "image") { img_pic.Source = new BitmapImage(new Uri(objInfo.Path, UriKind.Absolute)); img_Item.Source = new BitmapImage(new Uri(ResourcePath + "FileBox_item1.png", UriKind.Absolute)); } else if (objectInfo.Type == "video") { img_Item.Source = new BitmapImage(new Uri(ResourcePath + "FileBox_item2.png", UriKind.Absolute)); } else if (objectInfo.Type == "ppt") { img_Item.Source = new BitmapImage(new Uri(ResourcePath + "FileBox_item3.png", UriKind.Absolute)); } else if (objectInfo.Type == "doc") { img_Item.Source = new BitmapImage(new Uri(ResourcePath + "FileBox_item4.png", UriKind.Absolute)); } else if (objectInfo.Type == "file") { img_Item.Source = new BitmapImage(new Uri(ResourcePath + "FileBox_item5.png", UriKind.Absolute)); } filePath = objInfo.FilePath; text_fileName.Text = objInfo.FileName; this.Tag = "a"; }
public void setInit(Canvas _main, Window target, FrameworkControl fw, MTSmoothContainer cont, double angle, ObjectInfo _objInfo) { objInfo = _objInfo; imgPath = objInfo.Path; img.Source = new BitmapImage(new Uri(imgPath, UriKind.Absolute)); main = _main; window = target; framework = fw; thisCont = cont; thisAngle = angle; }
public void setInit(Canvas _main, Window target, FrameworkControl fw, MTSmoothContainer cont, double angle, ObjectInfo _objInfo) { main = _main; window = target; framework = fw; thisCont = cont; thisAngle = angle; objInfo = _objInfo; ReadPPTfile(objInfo.FilePath); MakePPTIamge(objInfo.DirPath); ViewPPTImage(objInfo.DirPath, 0); }
public FileBoxObject(Window target, Canvas _main, ObjectInfo _objInfo) { objInfo = _objInfo; path = objInfo.Path; fileName = objInfo.FileName; fileType = objInfo.Type; filePath = objInfo.FilePath; InitializeComponent(); iconImg.Source = new BitmapImage(new Uri(objInfo.Path, UriKind.Absolute)); textName.Text = fileName; objTransGroup.Children.Add(objRotateTrans); objTransGroup.Children.Add(objTranslateTrans); }
public void setInit(Canvas _main, System.Windows.Window target, FrameworkControl fw, MTSmoothContainer cont, double angle, ObjectInfo _objInfo) { main = _main; window = target; framework = fw; thisCont = cont; thisAngle = angle; string wordDocument = _objInfo.FilePath; string convertedXpsDoc = string.Concat(System.IO.Path.GetTempPath(), "\\", Guid.NewGuid().ToString(), ".xps"); XpsDocument xpsDocument = ConvertWordToXps(wordDocument, convertedXpsDoc); if (xpsDocument == null) { return; } documentviewWord.Document = xpsDocument.GetFixedDocumentSequence(); // System.Windows.Controls.ContentControl cc = documentviewWord.Template.FindName("PART_FindToolBarHost", documentviewWord) as System.Windows.Controls.ContentControl; // cc.Visibility = Visibility.Collapsed; }
void getFileInDirectoryE(string dirPath) { string[] supportedExtensions = new[] { ".bmp", ".jpeg", ".jpg", ".png", ".tiff", ".pptx", ".ppt", ".doc" , ".docx", ".avi"}; var files = Directory.GetFiles(dirPath, "*.*").Where(s => supportedExtensions.Contains(System.IO.Path.GetExtension(s).ToLower())); filter_all = false; if (filter_img == false && filter_ppt == false && filter_doc == false && filter_video == false) { filter_all = true; } //Console.WriteLine("DIR Path : " + dirPath); foreach (var file in files) { string filePath = ""; string imgPath = ""; string fileType = ""; bool nextFile = false; if (System.IO.Path.GetExtension(file) == ".bmp" || System.IO.Path.GetExtension(file) == ".jpeg" || System.IO.Path.GetExtension(file) == ".jpg" || System.IO.Path.GetExtension(file) == ".png" || System.IO.Path.GetExtension(file) == ".tiff") { if (filter_all == true || filter_img == true) { imgPath = file; filePath = file; fileType = "image"; } else { nextFile = true; } } else if (System.IO.Path.GetExtension(file) == ".ppt" || System.IO.Path.GetExtension(file) == ".pptx") { if (filter_all == true || filter_ppt == true) { imgPath = ResourcePath + "Icon_ppt.png"; filePath = file; fileType = "ppt"; } else { nextFile = true; } } else if (System.IO.Path.GetExtension(file) == ".doc" || System.IO.Path.GetExtension(file) == ".docx") { if (filter_all == true || filter_doc == true) { imgPath = ResourcePath + "Icon_doc.png"; filePath = file; fileType = "doc"; } else { nextFile = true; } } else if (System.IO.Path.GetExtension(file) == ".avi") { if (filter_all == true || filter_video == true) { imgPath = ResourcePath + "Icon_video.png"; filePath = file; fileType = "video"; } else { nextFile = true; } } else { if (filter_all == true) { imgPath = ResourcePath + "Icon_file.png"; filePath = file; fileType = "file"; } } if (nextFile == false) { ObjectInfo id = new ObjectInfo() { UserName = userIP, Name = System.IO.Path.GetFileNameWithoutExtension(file), DirPath = dirPath, Path = imgPath, Type = fileType, FilePath = filePath, FileName = System.IO.Path.GetFileName(file), Extension = System.IO.Path.GetExtension(file), Cnt = _count++ }; BitmapImage img = new BitmapImage(); img.BeginInit(); img.CacheOption = BitmapCacheOption.OnLoad; img.UriSource = new Uri(imgPath, UriKind.Absolute); img.EndInit(); id.Width = img.PixelWidth; id.Height = img.PixelHeight; // I couldn't find file size in BitmapImage FileInfo fi = new FileInfo(file); id.Size = fi.Length; //Console.WriteLine("File Name : " + id.FileName); //objects.Add(id); setItem(id); //Consdlwldole.WriteLine("File Name : " + id.Extension); } } }
void getDirectory(string path) { DirectoryInfo Info = new DirectoryInfo(path); if (Info.Exists) { DirectoryInfo[] CInfo = Info.GetDirectories("*", System.IO.SearchOption.TopDirectoryOnly); foreach (DirectoryInfo info in CInfo) { string str = info.FullName;// + Environment.NewLine; ObjectInfo id = new ObjectInfo() { UserName = userIP, Path = ResourcePath + "Icon_folder.png", FileName = info.Name, Extension = "Folder", Cnt = _count++ }; BitmapImage img = new BitmapImage(); img.BeginInit(); img.CacheOption = BitmapCacheOption.OnLoad; img.UriSource = new Uri(id.Path, UriKind.Absolute); img.EndInit(); id.Width = img.PixelWidth; id.Height = img.PixelHeight; // I couldn't find file size in BitmapImage id.Size = 0; //Console.WriteLine("File Name : " + id.FileName); objects.Add(id); getFileInDirectoryE(str); getDirectory(str); } } }
void setItem(ObjectInfo objInfo) { FileBoxItem fbi = new FileBoxItem(objInfo); itemList.Add(fbi); }
public void Item_TouchDown(PointF p, ObjectInfo objInfo) { //절대 좌표로 변경 PointF globalPt = new PointF(thisCont.ObjectTouches.MoveCenter.X, thisCont.ObjectTouches.MoveCenter.Y); IsSelecting = true; fileBoxObject = new FileBoxObject(window, main, objInfo); main.Children.Add(fileBoxObject); fileBoxObject.setPosition(globalPt, thisAngle + thisCont.RotateFilter.Target); }