예제 #1
0
        /// <summary>
        /// Delete the selected instance from disk.
        /// </summary>
        /// <param name="sender">The object that is sending this event.</param>
        /// <param name="e">The arguments that describe the event.</param>
        private void btnMakeTemplate_Click(object sender, RoutedEventArgs e)
        {
            var textInputDialog = new Dialogs.TextInputDialog(this, "Template Name");

            if (!textInputDialog.ShowDialog() ?? false)
            {
                return;
            }
            var templateName = textInputDialog.Text;

            //
            // Check if this template already exists.
            //
            if (File.Exists(Path.Combine(Support.GetTemplatesPath(), templateName + ".zip")))
            {
                MessageBox.Show("A template with the name " + templateName + " already exists.", "Cannot make template", MessageBoxButton.OK, MessageBoxImage.Hand);
                return;
            }

            //
            // Compress the RockWeb folder into a template ZIP file.
            //
            var zipFile = Path.Combine(Support.GetTemplatesPath(), templateName + ".zip");
            var items   = (List <string>)cbInstances.ItemsSource;
            var path    = Path.Combine(Support.GetInstancesPath(), items[cbInstances.SelectedIndex], "RockWeb");

            Support.CreateZipFromFolder(zipFile, path);

            TemplatesView.UpdateTemplates();
        }
 /// <summary>
 /// A build has been completed. Update the UI and refresh the list of templates.
 /// </summary>
 /// <param name="sender">The object that sent this event.</param>
 /// <param name="e">The arguments describing this event.</param>
 private void ReleaseBuilder_BuildCompleted(object sender, EventArgs e)
 {
     Dispatcher.Invoke(() =>
     {
         UpdateState();
         TemplatesView.UpdateTemplates();
     });
 }