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 Dispose() { if (_pathBrowserCloseWatcher != null) { _pathBrowserCloseWatcher.Dispose(); _pathBrowserCloseWatcher = null; } }
public void ShowPathSelect(string displayLabel, string initialPath, bool fileSelect, Func<string, bool> validate, Action<string> completed) { initialPath = string.IsNullOrEmpty(initialPath) ? null : DosPathHelper.GetDirectory(initialPath); Guid dialogHandle = ServiceRegistration.Get<IPathBrowser>().ShowPathBrowser(displayLabel, fileSelect, false, string.IsNullOrEmpty(initialPath) ? null : LocalFsResourceProviderBase.ToResourcePath(initialPath), path => { string choosenPath = LocalFsResourceProviderBase.ToDosPath(path.LastPathSegment.Path); return validate(choosenPath); }); if (_pathBrowserCloseWatcher != null) _pathBrowserCloseWatcher.Dispose(); _pathBrowserCloseWatcher = new PathBrowserCloseWatcher(this, dialogHandle, chosenPath => completed(LocalFsResourceProviderBase.ToDosPath(chosenPath)), null); }
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 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); }
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 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 void Dispose() { if (_pathBrowserCloseWatcher != null) _pathBrowserCloseWatcher.Dispose(); _pathBrowserCloseWatcher = null; if (_queue != null) _queue.Shutdown(); _queue = null; }