예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }