/// <summary> /// Loads a remote document through url /// </summary> /// <param name="path">url path in string</param> /// <param name="streaming">whether to use HttpStreamingPartRetriever instead of HttpPartRetriever</param> public void LoadDocument(String path, bool streaming = false) { if (System.ComponentModel.DesignerProperties.IsInDesignTool) { return; } if (path == null || path == String.Empty) { return; } if (myRetriever != null) { myRetriever.CancelAllRequests(); } Uri uri = new Uri(path, UriKind.RelativeOrAbsolute); if (streaming) { myRetriever = new HttpStreamingPartRetriever(uri); } else { myRetriever = new HttpPartRetriever(uri); } FixedDocViewer.LoadAsync(myRetriever, OnLoadAsyncCallback); this.OnDocumentChanged(uri); }
/// <summary> /// Loads a local document from client file system /// </summary> public void LoadLocalDocument() { OpenFileDialog dlg = new OpenFileDialog(); dlg.Multiselect = false; dlg.Filter = "XOD Files (*.xod)|*.xod"; // open dialog bool ok = (bool)dlg.ShowDialog(); if (ok) { if (myRetriever as LocalPartRetriever != null) { ((LocalPartRetriever)myRetriever).Dispose(); } FileStream fileStream = dlg.File.OpenRead(); myRetriever = new LocalPartRetriever(fileStream); FixedDocViewer.LoadAsync(myRetriever, OnLoadAsyncCallback); this.OnDocumentChanged(dlg.File); } }
/// <summary> /// Loads a remote document through url /// </summary> /// <param name="uri">url path in Uri</param> /// <param name="streaming">whether to use HttpStreamingPartRetriever instead of HttpPartRetriever</param> public void LoadDocument(Uri uri, bool streaming = false) { if (System.ComponentModel.DesignerProperties.IsInDesignTool) { return; } if (uri == null) { return; } if (streaming) { myRetriever = new HttpStreamingPartRetriever(uri); } else { myRetriever = new HttpPartRetriever(uri); } FixedDocViewer.LoadAsync(myRetriever, OnLoadAsyncCallback); this.OnDocumentChanged(uri); }