private void AcceptBtnClick(object sender, RoutedEventArgs e)
        {
            string className = ClassNameTB.Text;

            if (className == "")
            {
                MessageBox.Show("No class name was given");
                this.Close();
                return;
            }
            List <string>    templatesFileNames = new List <string>();
            List <ClassType> types = new List <ClassType>();
            var cbs = CreateClassesGrid.Children.OfType <CheckBox>().ToArray();

            foreach (var cb in cbs)
            {
                if (cb.IsChecked.HasValue && cb.IsChecked.Value && (cb.Tag is TypedComboBox))
                {
                    templatesFileNames.Add(((cb.Tag as TypedComboBox).ComBox.SelectedItem as ComboBoxItem).Content.ToString());
                    types.Add((cb.Tag as TypedComboBox).Type);
                }
            }
            MVVMSolutionManager.FillActiveSolution(types, className, templatesFileNames);
            this.Close();
        }
Exemplo n.º 2
0
        private MenuManager(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            this.package = package;

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                CommandID   createClassesCmdId = new CommandID(CommandSet, CreateClassesCmdId);
                CommandID   settingsCmdId      = new CommandID(CommandSet, SettingsCmdId);
                CommandID   createClassesProjectNodeItemCmdId = new CommandID(CommandSet, CreateClassesProjectNodeItemCmdId);
                MenuCommand createClasses = new MenuCommand(this.CreateClassesMenuItemCallback, createClassesCmdId);
                MenuCommand settings      = new MenuCommand(this.SettingsMenuItemCallback, settingsCmdId);
                MenuCommand createClassesProjectItemNode = new MenuCommand(this.CreateClassesProjectNodeMenuItemCallback, createClassesProjectNodeItemCmdId);
                commandService.AddCommand(createClasses);
                commandService.AddCommand(settings);
                commandService.AddCommand(createClassesProjectItemNode);
            }
            SettingsViewModel.Load();
            DTE dte = (DTE)this.ServiceProvider.GetService(typeof(DTE));

            MVVMSolutionManager.InitializeDTE(dte);
        }