public void Load(string path) { AssertThreading(); if (!File.Exists(path)) { throw new FileNotFoundException(path); } if (DisplayedPreviewer != null) { Unload(); } var newType = GetPreviewerClsidForPath(path); var newPreviewer = new TypedPreviewerHandle(this, newType); try { newPreviewer.ShowFirstFile(path); } catch { newPreviewer.Dispose(); throw; } this.DisplayedPreviewer = newPreviewer; this._DisplayedPath = path; this.LastLoadException = null; this.DisplayedPathChanged?.Invoke(this, EventArgs.Empty); }
private void Unload() { AssertThreading(); DisplayedPreviewer?.Dispose(); DisplayedPreviewer = null; }