ImportFile() public method

public ImportFile ( string path ) : void
path string
return void
コード例 #1
0
        private void fromFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (openTeXSourceDialog.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
            string preamble = null, body = null;

            MainForm.ImportFile(openTeXSourceDialog.FileName, out preamble, out body);
            if (preamble == null && body == null)
            {
                return;
            }
            if (preamble == null)
            {
                preamble = body;
            }

            string templatename = null;
            var    parent       = AddTemplateContextMenu.SourceControl;

            if (parent == AddNewButton)
            {
                templatename = GetNewTemplateName();
            }
            else
            {
                templatename = GetSelectedTemplateName();
            }
            if (templatename != null)
            {
                if (!Templates.ContainsKey(templatename))
                {
                    TemplateListBox.Items.Add(templatename);
                }
                Templates[templatename] = preamble;
            }
        }