public static IList <ImageInformationSet> CreateDefaultLeftCursorImageInformationSetList() { var src = ImageInformationSet.CreateDefaultImageInformationSetList(CursorImageSetListFolderRelativePath); var ret = src.Select(e => { e.AddImage((int)CursorImageIndexLabels.OpenHand, "Left_OpenHand.png"); e.AddImage((int)CursorImageIndexLabels.CloseHand, "Left_CloseHand.png"); //e.AddImage((int)CursorImageIndexLabelsForPowerPointViewer.OpenHandWithRightArrow, "Left_OpenHandWithRightArrow.png"); //e.AddImage((int)CursorImageIndexLabelsForPowerPointViewer.OpenHandWithLeftArrow, "Left_OpenHandWithLeftArrow.png"); return(e); }).ToList(); return(ret); }
internal static IList <ImageInformationSet> CreateDefaultCameraViewUserControlImagesFolderRelativePath() { var imageInfoSetList = ImageInformationSet.CreateDefaultImageInformationSetList(CameraViewUserControlImagesFolderRelativePath); var ret = imageInfoSetList.Select(oneImageSetInfo => { var imageFilePaths = Directory.GetFiles(oneImageSetInfo.FolderPath); int imageIndex = 0; foreach (var imagefilePath in imageFilePaths) { oneImageSetInfo.AddImage(imageIndex++, Path.GetFileName(imagefilePath)); } return(oneImageSetInfo); }).ToList(); return(ret); }
public static IList <ImageInformationSet> CreateDefaultImageInformationSetList(string basePath) { var ret = new List <ImageInformationSet>(); // TODO: Let it get not "C:\Windows\system32" but a correct path, also in editing XAML. var directoryPath = ""; var projectDir = ""; if (false) { // NOTE: The path is correct when the app is running. But in editing XAML, this path become "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE" projectDir = System.AppDomain.CurrentDomain.BaseDirectory; projectDir = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); projectDir = Path.GetDirectoryName(typeof(ImageInformationSet).Assembly.Location); // NOTE: Maybe it is cannot be converted to a folder path. var uri = new Uri("pack://application:,,,/Assembly;component/" + ImageInformationSet.CursorImageSetListFolderRelativePath); } directoryPath = Path.Combine("", basePath); if (Directory.Exists(directoryPath)) { var directories = Directory.GetDirectories(directoryPath); int i = 0; foreach (var directory in directories) { var newSet = new ImageInformationSet(); newSet.ImageSetIndex = i++; newSet.FolderPath = directory; newSet.Description = directory.Split(Path.DirectorySeparatorChar).Last().Split('_').Last(); newSet.SampleImageFileRelativePath = newSet.FolderPath + "/Sample.png"; ret.Add(newSet); } } else { Debugger.Break(); for (int i = 0; i < 12; i++) { var newSet = new ImageInformationSet(); newSet.ImageSetIndex = i; newSet.FolderPath = ""; newSet.Description = i.ToString("D2", CultureInfo.InvariantCulture); ret.Add(newSet); } } return(ret); }