public bool ImportSourceMessageScript() { using (var messageImporter = new ScriptImport()) { var importCont = new ImportExportController(messageImporter, ""); if (messageImporter.ShowDialog() == DialogResult.OK) { if (sourceConv.File.LoadFromString(importCont.MessageScript)) { sourceView.SetSourceMessageList(sourceConv.File.MessageList); return(true); } else { MessageBox.Show( "There was a problem parsing the message. Please double-check the text and try again.", "Failed to Import Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } return(false); } }
public bool ImportMessageScript() { var messageImporter = new ScriptImport(); try { var importCont = new ImportExportController(messageImporter, ""); var dialogResult = messageImporter.ShowDialog(); if (dialogResult == DialogResult.OK) { if (MainConversation.File.LoadFromString(importCont.MessageScript)) { MainView.SetMessageList(MainConversation.File.MessageList); } else { MessageBox.Show( "There was a problem parsing the message. Please double-check the text and try again.", "Failed to Import Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } } finally { messageImporter.Dispose(); } return(true); }
public static PageViewDefinition IncludeScript(this PageViewDefinition viewDefintion, string scriptSource) { var script = new ScriptImport { Src = scriptSource }; EnsureData(viewDefintion); if (viewDefintion.Data.Scripts == null) { viewDefintion.Data.Scripts = new List <ScriptImport>(); } viewDefintion.Data.Scripts.Add(script); return(viewDefintion); }