예제 #1
0
파일: MainForm.cs 프로젝트: monstrim/Ares
        private void exportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (m_CurrentProject == null)
            {
                return;
            }
            if (m_CurrentProject.Changed && !SaveProject())
            {
                return;
            }

            String exportFileName = m_CurrentProject.FileName;

            if (exportFileName.EndsWith(".ares", StringComparison.InvariantCultureIgnoreCase))
            {
                exportFileName = exportFileName.Substring(0, exportFileName.Length - 5);
            }
            exportFileName            = exportFileName + ".apkg";
            exportFileDialog.FileName = exportFileName;

            DialogResult result = exportFileDialog.ShowDialog(this);

            if (result != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            Ares.CommonGUI.ProgressMonitor monitor = new Ares.CommonGUI.ProgressMonitor(this, StringResources.Exporting);
            Ares.ModelInfo.Exporter.Export(monitor, m_CurrentProject, m_CurrentProject.FileName, exportFileDialog.FileName, error =>
            {
                monitor.Close();
                if (error != null)
                {
                    System.Windows.Forms.MessageBox.Show(String.Format(StringResources.ExportError, error.Message), StringResources.Ares,
                                                         System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
            });
        }