コード例 #1
0
        private void WAQSInitVMCallback(object sender, EventArgs e)
        {
            var dte       = GetService(typeof(DTE)) as DTE;
            var viewModel = dte.SelectedItems.Item(1).ProjectItem;

            if (!viewModel.Name.EndsWith(".cs"))
            {
                MessageBox.Show(Application.Current.MainWindow, "The view model must be a C# file", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            var componentModel    = (IComponentModel)GetService(typeof(SComponentModel));
            var installerServices = componentModel.GetService <IVsPackageInstallerServices>();
            var wizard            = new ViewModelWizard(dte, viewModel, installerServices);

            wizard.Owner = Application.Current.MainWindow;
            wizard.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            wizard.ShowModal();
        }
コード例 #2
0
ファイル: WAQSPackage.cs プロジェクト: bnjMichel/waqs
 private void WAQSInitVMCallback(object sender, EventArgs e)
 {
     var dte = GetService(typeof(DTE)) as DTE;
     var viewModel = dte.SelectedItems.Item(1).ProjectItem;
     if (! viewModel.Name.EndsWith(".cs"))
     {
         MessageBox.Show(Application.Current.MainWindow, "The view model must be a C# file", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     var componentModel = (IComponentModel)GetService(typeof(SComponentModel));
     var installerServices = componentModel.GetService<IVsPackageInstallerServices>();
     var wizard = new ViewModelWizard(dte, viewModel, installerServices);
     wizard.Owner = Application.Current.MainWindow;
     wizard.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     wizard.ShowModal();
 }