public void ChooseBackgroundVideo() { string videoFilename = BackgroundVideoFilename; string initialPath = string.IsNullOrEmpty(videoFilename) ? null : DosPathHelper.GetDirectory(videoFilename); Guid dialogHandle = ServiceRegistration.Get <IPathBrowser>().ShowPathBrowser(RES_HEADER_CHOOSE_VIDEO, true, false, string.IsNullOrEmpty(initialPath) ? null : LocalFsResourceProviderBase.ToResourcePath(initialPath), path => { string choosenPath = LocalFsResourceProviderBase.ToDosPath(path.LastPathSegment.Path); if (string.IsNullOrEmpty(choosenPath)) { return(false); } return(MediaItemHelper.IsValidVideo(MediaItemHelper.CreateMediaItem(choosenPath))); }); if (_pathBrowserCloseWatcher != null) { _pathBrowserCloseWatcher.Dispose(); } _pathBrowserCloseWatcher = new PathBrowserCloseWatcher(this, dialogHandle, choosenPath => { BackgroundVideoFilename = LocalFsResourceProviderBase.ToDosPath(choosenPath); }, null); }
public void ChooseImportFile() { string importFile = ImportFile; string initialPath = string.IsNullOrEmpty(importFile) ? null : DosPathHelper.GetDirectory(importFile); Guid dialogHandle = ServiceRegistration.Get <IPathBrowser>().ShowPathBrowser(Consts.RES_CHOOSE_IMPORT_FILE_DIALOG_HEADER, true, false, string.IsNullOrEmpty(initialPath) ? null : LocalFsResourceProviderBase.ToResourcePath(initialPath), path => { string choosenPath = LocalFsResourceProviderBase.ToDosPath(path.LastPathSegment.Path); if (string.IsNullOrEmpty(choosenPath)) { return(false); } string extension = StringUtils.TrimToEmpty(DosPathHelper.GetExtension(choosenPath)).ToLowerInvariant(); return((extension == ".m3u" || extension == ".m3u8") && File.Exists(choosenPath)); }); if (_pathBrowserCloseWatcher != null) { _pathBrowserCloseWatcher.Dispose(); } _pathBrowserCloseWatcher = new PathBrowserCloseWatcher(this, dialogHandle, choosenPath => { ImportFile = LocalFsResourceProviderBase.ToDosPath(choosenPath); }, null); }
public override void ExecuteConfiguration() { if (_pathBrowserCloseWatcher != null) { _pathBrowserCloseWatcher.Dispose(); } var pathEntry = Setting as PathEntry; if (pathEntry == null) { return; } Guid dialogHandle = ServiceRegistration.Get <IPathBrowser>().ShowPathBrowser(Help.Evaluate(), pathEntry.PathType == PathEntry.PathSelectionType.File, false, string.IsNullOrEmpty(pathEntry.Path) ? null : LocalFsResourceProviderBase.ToResourcePath(pathEntry.Path), path => { string choosenPath = LocalFsResourceProviderBase.ToDosPath(path.LastPathSegment.Path); return(!string.IsNullOrEmpty(choosenPath)); }); _pathBrowserCloseWatcher = new PathBrowserCloseWatcher(this, dialogHandle, choosenPath => { pathEntry.Path = LocalFsResourceProviderBase.ToDosPath(choosenPath); Save(); _pathBrowserCloseWatcher.Dispose(); _pathBrowserCloseWatcher = null; }, null); }
public void OpenSelectUserImageDialog() { string imageFilename = _imagePath; string initialPath = string.IsNullOrEmpty(imageFilename) ? null : DosPathHelper.GetDirectory(imageFilename); Guid dialogHandle = ServiceRegistration.Get <IPathBrowser>().ShowPathBrowser(Consts.RES_SELECT_USER_IMAGE, true, false, string.IsNullOrEmpty(initialPath) ? null : LocalFsResourceProviderBase.ToResourcePath(initialPath), path => { string choosenPath = LocalFsResourceProviderBase.ToDosPath(path.LastPathSegment.Path); if (string.IsNullOrEmpty(choosenPath)) { return(false); } return(IsValidImage(choosenPath)); }); if (_pathBrowserCloseWatcher != null) { _pathBrowserCloseWatcher.Dispose(); } _pathBrowserCloseWatcher = new PathBrowserCloseWatcher(this, dialogHandle, choosenPath => { ImagePath = LocalFsResourceProviderBase.ToDosPath(choosenPath); }, null); }
public void SearchApp() { string initialPath = "C:\\"; Guid dialogHandle = ServiceRegistration.Get <IPathBrowser>().ShowPathBrowser(S_APP, true, false, string.IsNullOrEmpty(initialPath) ? null : LocalFsResourceProviderBase.ToResourcePath(initialPath), path => { string choosenPath = LocalFsResourceProviderBase.ToDosPath(path.LastPathSegment.Path); if (string.IsNullOrEmpty(choosenPath)) { return(false); } return(true); }); if (_pathBrowserCloseWatcher != null) { _pathBrowserCloseWatcher.Dispose(); } _pathBrowserCloseWatcher = new PathBrowserCloseWatcher(this, dialogHandle, choosenPath => { AppPath = LocalFsResourceProviderBase.ToDosPath(choosenPath); ShortName = choosenPath.FileName.Substring(0, choosenPath.FileName.LastIndexOf(".", System.StringComparison.Ordinal)); var icon = Icon.ExtractAssociatedIcon(AppPath); if (icon != null) { IconPath = Help.GetIconPfad(choosenPath.FileName, icon.ToBitmap()); } }, null); }
public void Dispose() { if (_pathBrowserCloseWatcher != null) { _pathBrowserCloseWatcher.Dispose(); } _pathBrowserCloseWatcher = null; if (_queue != null) { _queue.Shutdown(); } _queue = null; }
public void ShowWorkingDirectoryDialog() { string workingDirectory = WorkingDirectory; ResourcePath initialPath = string.IsNullOrEmpty(workingDirectory) ? null : LocalFsResourceProviderBase.ToResourcePath(workingDirectory); Guid dialogHandle = ServiceRegistration.Get <IPathBrowser>().ShowPathBrowser("[Emulators.Config.WorkingDirectory.Label]", false, false, initialPath, path => { string chosenPath = LocalFsResourceProviderBase.ToDosPath(path.LastPathSegment.Path); return(!string.IsNullOrEmpty(chosenPath)); }); if (_pathBrowserCloseWatcher != null) { _pathBrowserCloseWatcher.Dispose(); } _pathBrowserCloseWatcher = new PathBrowserCloseWatcher(this, dialogHandle, chosenPath => WorkingDirectory = LocalFsResourceProviderBase.ToDosPath(chosenPath), null); }
public void SearchIcon() { string initialPath = "C:\\"; Guid dialogHandle = ServiceRegistration.Get <IPathBrowser>().ShowPathBrowser(S_ICO, true, false, string.IsNullOrEmpty(initialPath) ? null : LocalFsResourceProviderBase.ToResourcePath(initialPath), path => { string choosenPath = LocalFsResourceProviderBase.ToDosPath(path.LastPathSegment.Path); if (string.IsNullOrEmpty(choosenPath)) { return(false); } return(true); }); if (_pathBrowserCloseWatcher != null) { _pathBrowserCloseWatcher.Dispose(); } _pathBrowserCloseWatcher = new PathBrowserCloseWatcher(this, dialogHandle, choosenPath => { IconPath = LocalFsResourceProviderBase.ToDosPath(choosenPath); }, null); }