예제 #1
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            TraceWriteLine("Package Initialization: Starting");
            IServiceContainer      serviceContainer = this as IServiceContainer;
            ServiceCreatorCallback callback         =
                new ServiceCreatorCallback(CreateGitWrapperService);

            serviceContainer.AddService(typeof(IGitStashWrapper), callback, true);
            serviceContainer.AddService(typeof(IGitStashProjectEvents), callback, true);
            serviceContainer.AddService(typeof(IGitStashTranslator), callback, true);
            gitService = (IGitExt)GetService(typeof(IGitExt));
            gitService.PropertyChanged += GitService_PropertyChanged;
            this.projects = new GitStashProjects(this);
            this.events   = new GitStashFileWatcher();
            if (gitService.ActiveRepositories.FirstOrDefault() != null)
            {
                string path = gitService.ActiveRepositories.FirstOrDefault().RepositoryPath;
                TraceWriteLine("Setting directory: " + path);
                events.ChangeDirectory(path);
            }

            TraceWriteLine("Package Initialization: Done");
            ShowStashPageCommand.Initialize(this);
        }
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(Package package)
 {
     Instance = new ShowStashPageCommand(package);
 }