예제 #1
0
        private void DeployBtn_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new FolderBrowserDialog()
            {
                ShowNewFolderButton = true,
                Description         = "Select a destination folder"
            };

            if (Properties.Settings.Default.LastDeploymentFolder != string.Empty)
            {
                dialog.SelectedPath = Properties.Settings.Default.LastDeploymentFolder;
            }

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // path is fine?
                if (dialog.SelectedPath == Gibbo.Library.SceneManager.GameProject.ProjectPath)
                {
                    System.Windows.Forms.MessageBox.Show("You cannot select the folder of your project.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                Properties.Settings.Default.LastDeploymentFolder = dialog.SelectedPath;
                Properties.Settings.Default.Save();

                bool previousDebugMode = Gibbo.Library.SceneManager.GameProject.Debug;
                Gibbo.Library.SceneManager.GameProject.Debug = false;
                Gibbo.Library.SceneManager.GameProject.Save();

                if (GlobalCommands.DeployProject(Gibbo.Library.SceneManager.GameProject.ProjectPath, dialog.SelectedPath, selectedOption))
                {
                    // deployed with success!
                    if (System.Windows.Forms.MessageBox.Show("Deployed successfully!\n\nOpen output directory?", "Success", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)
                    {
                        System.Diagnostics.Process.Start(dialog.SelectedPath);
                    }
                }

                Gibbo.Library.SceneManager.GameProject.Debug = previousDebugMode;
                Gibbo.Library.SceneManager.GameProject.Save();
            }
        }