void OpenMenuItem_Click(object sender, RoutedEventArgs e) { OpenFileDialog open = new OpenFileDialog { Filter = "XML Files (*.xml)|*.xml" }; if (open.ShowDialog() == true) { XmlDocument document = new XmlDocument(); try { document.Load(open.FileName); DocumentLoadedEventArgs args = new DocumentLoadedEventArgs() { Path = open.FileName, Document = document, FileName = open.SafeFileName }; OnDocumentLoaded(this, args); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } }
private void saveAsMenuItem_Click(object sender, RoutedEventArgs e) { SaveFileDialog dialog = new SaveFileDialog { Filter = "Load Injector Archive File (*.lia)|*.lia|Load Injector Config File (*.xml)|*.xml" }; if (dialog.ShowDialog() == true) { SaveAsEventArgs args = new SaveAsEventArgs { FileName = dialog.SafeFileName, Path = dialog.FileName }; saveAsArgs = args; loadedArgs = null; SaveAsRequested?.Invoke(this, args); } }
private void newMenuItem_Click(object sender, RoutedEventArgs e) { XmlDocument document = new XmlDocument(); document.LoadXml(Parameters.Template); try { DocumentLoadedEventArgs args = new DocumentLoadedEventArgs() { Path = null, Document = document, FileName = "new.xml" }; saveAsArgs = null; loadedArgs = args; OnDocumentLoaded(this, args); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
void NewMenuItem_Click(object sender, RoutedEventArgs e) { XmlDocument document = new XmlDocument(); document.LoadXml($"<?xml version=\"1.0\" encoding=\"utf - 8\"?><config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"> <settings> </settings><pipes><pipe name=\"Name of Pipe\" id=\"{Guid.NewGuid()}\" numInstances=\"1\" ><input type=\"MSMQ\" id=\"{Guid.NewGuid()}\" name=\"Description of the Node\" /><output type=\"MSMQ\" id=\"{Guid.NewGuid()}\" name=\"Description of the Node\" /></pipe></pipes></config>");; try { DocumentLoadedEventArgs args = new DocumentLoadedEventArgs() { Path = null, Document = document, FileName = "new.xml*" }; OnDocumentLoaded(this, args); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void openMenuItem_Click(object sender, RoutedEventArgs e) { OpenFileDialog open = new OpenFileDialog { Filter = "Config and Archives (*.xml, *.lia)|*.xml;*.lia", InitialDirectory = Directory.GetCurrentDirectory() + "\\Samples" }; if (open.ShowDialog() == true) { XmlDocument document = new XmlDocument(); if (open.FileName.EndsWith("xml") || open.FileName.EndsWith("XML")) { try { document.Load(open.FileName); DocumentLoadedEventArgs args = new DocumentLoadedEventArgs() { Path = open.FileName, Document = document, FileName = open.SafeFileName }; saveAsArgs = null; loadedArgs = args; OnDocumentLoaded(this, args); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } if (open.FileName.EndsWith("lia") || open.FileName.EndsWith("LIA")) { try { string cwd = Utils.GetTemporaryDirectory(); document = LoadInjectorBase.Common.Utils.ExtractArchiveToDirectoryForEdit(open.FileName, cwd, "lia.lia"); DocumentLoadedEventArgs args = new DocumentLoadedEventArgs() { Path = open.FileName, Document = document, FileName = open.SafeFileName, ArchiveRoot = cwd }; saveAsArgs = null; loadedArgs = args; OnDocumentLoaded(this, args); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } } }
//void commandBarView_SearchRequested(object sender, SearchRequestedEventArgs e) { // this.editorsVM.ActiveEditor.FindElementCommand.Execute(e.XPath); //} void CommandBarView_DocumentLoaded(object sender, DocumentLoadedEventArgs e) { var xmlTreeViewModel = new TreeEditorViewModel(e.Document, e.Path, e.FileName); editorsVM.Add(xmlTreeViewModel); }
private void PdfViewer_DocumentLoaded(object sender, DocumentLoadedEventArgs e) { MessageBox.Show("Document " + e.FileName + " was loaded"); }
public void OnDocumentLoaded(object sender, DocumentLoadedEventArgs e) { DocumentLoaded?.Invoke(sender, e); }
private void DocumentViewer1_DocumentLoaded(object sender, DocumentLoadedEventArgs e) { textSearchResult = null; txtSearchText.Text = ""; }