Ejemplo n.º 1
0
 public UninstallSuggestedAction(SuggestedActionProvider provider, ILibraryCommandService libraryCommandService)
     : base(provider.TextBuffer, provider.TextView, GetDisplayText(provider), Guid)
 {
     _libraryCommandService = libraryCommandService;
     _provider   = provider;
     IconMoniker = KnownMonikers.Cancel;
 }
        public InstallDialogViewModel(Dispatcher dispatcher, ILibraryCommandService libraryCommandService, string configFileName, IDependencies deps, string targetPath, Action <bool> closeDialog)
        {
            _libraryCommandService = libraryCommandService;
            _configFileName        = configFileName;
            _targetPath            = targetPath;
            _deps            = deps;
            _dispatcher      = dispatcher;
            _closeDialog     = closeDialog;
            _anyFileSelected = false;
            _isTreeViewEmpty = true;

            List <IProvider> providers = new List <IProvider>();

            foreach (IProvider provider in deps.Providers.OrderBy(x => x.Id))
            {
                ILibraryCatalog catalog = provider.GetCatalog();

                if (catalog == null)
                {
                    continue;
                }

                if (_catalog == null)
                {
                    _activeProvider = provider;
                    _catalog        = catalog;
                }

                providers.Add(provider);
            }

            Providers             = providers;
            InstallPackageCommand = ActionCommand.Create(InstallPackageAsync, CanInstallPackage, false);
            Task t = LoadPackagesAsync();
        }
        private InstallLibraryCommand(OleMenuCommandService commandService, ILibraryCommandService libraryCommandService)
        {
            CommandID      cmdId = new CommandID(PackageGuids.guidLibraryManagerPackageCmdSet, PackageIds.InstallPackage);
            OleMenuCommand cmd   = new OleMenuCommand(ExecuteHandlerAsync, cmdId);

            cmd.BeforeQueryStatus += BeforeQueryStatusHandlerAsync;
            commandService.AddCommand(cmd);

            _libraryCommandService = libraryCommandService;
        }
Ejemplo n.º 4
0
        private RestoreCommand(AsyncPackage package, OleMenuCommandService commandService, ILibraryCommandService libraryCommandService)
        {
            _libraryCommandService = libraryCommandService;

            var cmdId = new CommandID(PackageGuids.guidLibraryManagerPackageCmdSet, PackageIds.Restore);
            var cmd   = new OleMenuCommand((s, e) => package.JoinableTaskFactory.RunAsync(() => ExecuteAsync(s, e)),
                                           cmdId);

            cmd.BeforeQueryStatus += (s, e) => package.JoinableTaskFactory.RunAsync(() => BeforeQueryStatusAsync(s, e));
            commandService.AddCommand(cmd);
        }
Ejemplo n.º 5
0
        private RestoreCommand(Package package, OleMenuCommandService commandService, ILibraryCommandService libraryCommandService)
        {
            _package = package;
            _libraryCommandService = libraryCommandService;

            var cmdId = new CommandID(PackageGuids.guidLibraryManagerPackageCmdSet, PackageIds.Restore);
            var cmd   = new OleMenuCommand(ExecuteHandlerAsync, cmdId);

            cmd.BeforeQueryStatus += BeforeQueryStatusHandlerAsync;
            commandService.AddCommand(cmd);
        }
Ejemplo n.º 6
0
        private ManageLibrariesCommand(AsyncPackage package, OleMenuCommandService commandService, ILibraryCommandService libraryCommandService, IDependenciesFactory dependenciesFactory)
        {
            _libraryCommandService = libraryCommandService;
            _dependenciesFactory   = dependenciesFactory;

            var cmdId = new CommandID(PackageGuids.guidLibraryManagerPackageCmdSet, PackageIds.ManageLibraries);
            var cmd   = new OleMenuCommand((s, e) => package.JoinableTaskFactory.RunAsync(() => ExecuteAsync(s, e)),
                                           cmdId);

            cmd.BeforeQueryStatus += BeforeQueryStatus;
            commandService.AddCommand(cmd);
        }
        private InstallLibraryCommand(AsyncPackage package, OleMenuCommandService commandService, ILibraryCommandService libraryCommandService, IDependenciesFactory dependenciesFactory)
        {
            CommandID      cmdId = new CommandID(PackageGuids.guidLibraryManagerPackageCmdSet, PackageIds.InstallPackage);
            OleMenuCommand cmd   = new OleMenuCommand((s, e) => package.JoinableTaskFactory.RunAsync(() => ExecuteAsync(s, e)),
                                                      cmdId);

            cmd.BeforeQueryStatus += (s, e) => package.JoinableTaskFactory.RunAsync(() => BeforeQueryStatusAsync(s, e));
            commandService.AddCommand(cmd);

            _libraryCommandService = libraryCommandService;
            _dependenciesFactory   = dependenciesFactory;
        }
Ejemplo n.º 8
0
        private ManageLibrariesCommand(Package package, OleMenuCommandService commandService, ILibraryCommandService libraryCommandService, IDependenciesFactory dependenciesFactory)
        {
            _package = package;
            _libraryCommandService = libraryCommandService;
            _dependenciesFactory   = dependenciesFactory;

            var cmdId = new CommandID(PackageGuids.guidLibraryManagerPackageCmdSet, PackageIds.ManageLibraries);
            var cmd   = new OleMenuCommand(ExecuteHandlerAsync, cmdId);

            cmd.BeforeQueryStatus += BeforeQueryStatus;
            commandService.AddCommand(cmd);
        }
Ejemplo n.º 9
0
        public InstallDialogViewModel(ILibraryCommandService libraryCommandService,
                                      string configFileName,
                                      IDependencies deps,
                                      LibraryIdViewModel libraryIdViewModel,
                                      TargetLocationViewModel targetLocationViewModel,
                                      SelectedProviderBinding selectedProviderBinding,
                                      LibraryNameBinding bindLibraryNameToTargetLocation,
                                      string targetPath,
                                      Project project,
                                      string initialProvider)
        {
            _libraryCommandService = libraryCommandService;
            _configFileName        = configFileName;
            _targetPath            = targetPath;
            _deps                    = deps;
            _anyFileSelected         = false;
            _isTreeViewEmpty         = true;
            _selectedProviderBinding = selectedProviderBinding;
            _libraryNameChange       = bindLibraryNameToTargetLocation;
            _project                 = project;
            _taskFactory             = new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext());

            LibraryIdViewModel      = libraryIdViewModel;
            TargetLocationViewModel = targetLocationViewModel;

            var providers = new List <IProvider>();

            foreach (IProvider provider in deps.Providers.OrderBy(x => x.Id))
            {
                ILibraryCatalog catalog = provider.GetCatalog();

                if (catalog == null)
                {
                    continue;
                }

                if (_catalog == null || provider.Id.Equals(initialProvider, StringComparison.Ordinal))
                {
                    SelectedProvider = provider;
                    _selectedProviderBinding.SelectedProvider = SelectedProvider;
                    _catalog = catalog;
                }

                providers.Add(provider);
            }

            Providers             = providers;
            InstallPackageCommand = ActionCommand.Create(InstallPackage, CanInstallPackage, false);
            Task t = LoadPackagesAsync();

            LibraryIdViewModel.PropertyChanged += LibraryIdViewModel_PropertyChanged;
        }
        public InstallDialog(IDependencies dependencies, ILibraryCommandService libraryCommandService, string configFileName, string fullPath, string rootFolder)
        {
            InstallationFolder.DestinationFolder = fullPath.Replace(rootFolder, "").Replace('\\', '/');

            InitializeComponent();

            _libraryCommandService = libraryCommandService;
            _deps           = dependencies;
            _fullPath       = fullPath;
            _configFileName = configFileName;

            Loaded += OnLoaded;
        }
Ejemplo n.º 11
0
        private CleanCommand(Package package, OleMenuCommandService commandService, ILibraryCommandService libraryCommandService)
        {
            _package = package;
            _libraryCommandService = libraryCommandService;

            var cmdId = new CommandID(PackageGuids.guidLibraryManagerPackageCmdSet, PackageIds.Clean);
            var cmd   = new OleMenuCommand(ExecuteHandlerAsync, cmdId);

            cmd.BeforeQueryStatus += BeforeQueryStatusHandlerAsync;
            commandService.AddCommand(cmd);

            _buildEvents = VsHelpers.DTE.Events.BuildEvents;
            _buildEvents.OnBuildBegin += OnBuildBegin;

            _solutionEvents = VsHelpers.DTE.Events.SolutionEvents;
            _solutionEvents.AfterClosing += AfterClosing;
        }
Ejemplo n.º 12
0
        private CleanCommand(AsyncPackage package, OleMenuCommandService commandService, ILibraryCommandService libraryCommandService)
        {
            _libraryCommandService = libraryCommandService;

            var cmdId = new CommandID(PackageGuids.guidLibraryManagerPackageCmdSet, PackageIds.Clean);
            var cmd   = new OleMenuCommand((s, e) => package.JoinableTaskFactory.RunAsync(() => ExecuteAsync()),
                                           cmdId);

            cmd.BeforeQueryStatus += (s, e) => package.JoinableTaskFactory.RunAsync(() => BeforeQueryStatusAsync(s, e));
            commandService.AddCommand(cmd);

            _buildEvents = VsHelpers.DTE.Events.BuildEvents;
            _buildEvents.OnBuildBegin += OnBuildBegin;

            _solutionEvents = VsHelpers.DTE.Events.SolutionEvents;
            _solutionEvents.AfterClosing += AfterClosing;
        }
Ejemplo n.º 13
0
        public InstallDialog(IDependencies dependencies, ILibraryCommandService libraryCommandService, string configFileName, string fullPath, string rootFolder, Project project)
        {
            string destinationFolder = string.Empty;

            if (fullPath.StartsWith(rootFolder, StringComparison.OrdinalIgnoreCase))
            {
                destinationFolder = fullPath.Substring(rootFolder.Length);
            }

            destinationFolder = destinationFolder.TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
            InstallationFolder.DestinationFolder = destinationFolder.Replace('\\', '/');

            InitializeComponent();

            _libraryCommandService = libraryCommandService;
            _deps           = dependencies;
            _fullPath       = fullPath;
            _configFileName = configFileName;
            _project        = project;

            Loaded += OnLoaded;
        }
Ejemplo n.º 14
0
 public static void Initialize(Package package, OleMenuCommandService commandService, ILibraryCommandService libraryCommandService)
 {
     Instance = new RestoreCommand(package, commandService, libraryCommandService);
 }
Ejemplo n.º 15
0
 public static void Initialize(AsyncPackage package, OleMenuCommandService commandService, ILibraryCommandService libraryCommandService, IDependenciesFactory dependenciesFactory)
 {
     Instance = new ManageLibrariesCommand(package, commandService, libraryCommandService, dependenciesFactory);
 }
Ejemplo n.º 16
0
 public static void Initialize(AsyncPackage package, OleMenuCommandService commandService, ILibraryCommandService libraryCommandService)
 {
     Instance = new CleanCommand(package, commandService, libraryCommandService);
 }
Ejemplo n.º 17
0
 public static void Initialize(OleMenuCommandService commandService, ILibraryCommandService libraryCommandService, IDependenciesFactory dependenciesFactory)
 {
     Instance = new InstallLibraryCommand(commandService, libraryCommandService, dependenciesFactory);
 }