private void modalButton_Click(object sender, EventArgs e) { Visualizer v = new Visualizer(); v.LoadXmlFromString("<xml>test</xml>"); string modifiedXml = v.ShowDialog(); MessageBox.Show(string.Format("Returned from Xml Visualizer v.2:\r\n{0}", modifiedXml)); }
private void modelessButton_Click(object sender, EventArgs e) { Thread thread = new Thread(delegate(object textObject) { Visualizer v = new Visualizer(); v.OnDisposeEvent += v_OnDisposeEvent; v.LoadXmlFromString(textObject.ToString()); v.Show(); v.Dispose(); }); thread.SetApartmentState(ApartmentState.STA); thread.Start("<xml>test</xml>"); }
public static string ShowModal_LoadXmlFromFile(string fileName) { string modifiedXml; using (Visualizer visualizer = new Visualizer(false)) { visualizer.LoadXmlFromFile(fileName); visualizer.ShowDialog(); modifiedXml = visualizer.GetModifiedXml(); } return modifiedXml; }
public static void ShowModeless_LoadXmlFromString(string xml) { ThreadStart threadDelegate = delegate { using (Visualizer visualizer = new Visualizer(false)) { visualizer.LoadXmlFromString(xml); visualizer.Show(); } }; Thread thread = new Thread(threadDelegate); thread.SetApartmentState(ApartmentState.STA); thread.Start(); }
public static string ShowModal_LoadXmlFromString(string xml, bool replaceable, bool debugMode) { string modifiedXml; using (Visualizer visualizer = new Visualizer(debugMode)) { visualizer.LoadXmlFromString(xml, replaceable); visualizer.ShowDialog(); modifiedXml = visualizer.GetModifiedXml(); } return modifiedXml; }