private async void CopyConfiguration(BaseMetroDialog dialog)
        {
            dialog.CommandBindings.Clear();

            dialog.CommandBindings.Add(new CommandBinding(RoutedCommands.AffirmConfigurationDialogCommand,
                                                          AffirmCopyConfigurationDialog, CanAffirmConfigurationDialog));

            dialog.CommandBindings.Add(new CommandBinding(RoutedCommands.CancelConfigurationDialogCommand,
                                                          CancelConfigurationDialog));

            dialog.Title = "Copy Configuration";

            var template = await _templateManager.GetTemplateAsync(_key);

            var configuration = new NewConfiguration
            {
                Name        = template.Product.Name,
                Version     = template.Product.Version,
                Description = template.Product.Description,
                FolderName  = $"{_key} (2)"
            };

            dialog.DataContext = configuration;

            await _mainWindow.ShowMetroDialogAsync(dialog);
        }
        private async Task CopyConfigurationAsync(NewConfiguration configuration)
        {
            var folderName = configuration.FolderName;

            if (string.IsNullOrWhiteSpace(folderName))
            {
                folderName = $"{configuration.Name} {configuration.Version}";
            }

            var libraryPath = await _librarian.CreateLibraryPathAsync(folderName);

            var templatePath = await _librarian.CreateTemplatePathAsync(folderName);

            var template = await _templateManager.GetTemplateAsync(_key);

            template.LibraryPath  = libraryPath;
            template.TemplatePath = templatePath;

            template.Product.Name        = configuration.Name;
            template.Product.Version     = configuration.Version;
            template.Product.Description = configuration.Description;

            _key = await _templateManager.AddTemplateAsync(template);

            _events.GetEvent <SelectTemplateEvent>().Publish(_key);
        }
        private async Task NewConfigurationAsync(NewConfiguration configuration)
        {
            var folderName = configuration.FolderName;

            if (string.IsNullOrWhiteSpace(folderName))
            {
                folderName = $"{configuration.Name} {configuration.Version}";
            }

            var libraryPath = await _librarian.CreateLibraryPathAsync(folderName);

            var templatePath = await _librarian.CreateTemplatePathAsync(folderName);

            var template = new Configuration(libraryPath, templatePath)
            {
                Product = new Product(configuration.Name, configuration.Version, configuration.Description)
            };

            var page = new Page("General Configuration", "true", "[Page description goes here]", "[Page summary goes here]");

            template.Pages.Add(page);

            var section = new Section("Language Configuration", "true", "[Section description goes here]");

            page.Sections.Add(section);

            var option = new Option("languageCode", "Language:", "true");

            section.Options.Add(option);

            var combo = new ComboControl("true", "true");

            option.Control = combo;

            var englishItem = new Item("en", "English");

            combo.Items.Add(englishItem);

            var frenchItem = new Item("fr", "French");

            combo.Items.Add(frenchItem);

            _key = await _templateManager.AddTemplateAsync(template);

            _events.GetEvent <SelectTemplateEvent>().Publish(_key);
        }
        private async void NewConfiguration(BaseMetroDialog dialog)
        {
            dialog.CommandBindings.Clear();

            dialog.CommandBindings.Add(new CommandBinding(RoutedCommands.AffirmConfigurationDialogCommand,
                                                          AffirmNewConfigurationDialog, CanAffirmConfigurationDialog));

            dialog.CommandBindings.Add(new CommandBinding(RoutedCommands.CancelConfigurationDialogCommand,
                                                          CancelConfigurationDialog));

            dialog.Title = "New Configuration";

            var configuration = new NewConfiguration();

            dialog.DataContext = configuration;

            await _mainWindow.ShowMetroDialogAsync(dialog);
        }
Beispiel #5
0
 protected virtual void OnNewConfiguration(EvaluatedConfiguration e)
 {
     NewConfiguration?.Invoke(this, e);
 }