コード例 #1
0
        protected bool InitConsts(TaskList tasks, string destFilePath, bool silent, Preferences prefs, string sKey)
        {
            // Display a dialog to get the report parameters
            // or to return the last saved template
            using (var dialog = new HtmlReportTemplateForm(m_TypeId, m_Trans, tasks, prefs, sKey))
            {
                if (!silent && (dialog.ShowDialog() != DialogResult.OK))
                {
                    return(false);
                }

                m_Template = dialog.ReportTemplate;
            }

            return(m_Template.HasContents());
        }
コード例 #2
0
        private bool CheckSaveTemplate(bool mustHaveContents, bool newFileName)
        {
            if (mustHaveContents && !m_Template.HasContents())
            {
                return(true);
            }

            if (!newFileName && m_Template.Save())
            {
                m_EditedSinceLastSave = false;

                UpdateCaption();
                return(true);
            }

            // Prompt for a file path
            var dlg = new SaveFileDialog
            {
                //InitialDirectory = LastBrowsedFolder,
                Title = m_Trans.Translate("Save Report Template"),

                AutoUpgradeEnabled = true,
                CheckPathExists    = true,

                Filter           = FileFilter,
                FilterIndex      = 0,
                RestoreDirectory = true,
            };

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (m_Template.Save(dlg.FileName))
                {
                    m_TemplateFilePath    = dlg.FileName;
                    m_EditedSinceLastSave = false;

                    AddFileToTopOfHistory(m_TemplateFilePath);
                    UpdateCaption();

                    return(true);
                }
            }

            return(false);
        }