/// <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); }
public GitStashWrapper(IGitStashProjectEvents eventsService, IGitStashOutputLogger logger, IGitStashProjects projects, Translator T) { this.Logger = logger; this.eventsService = eventsService; this.projects = projects; this.T = T; eventsService.ProjectDirectoryChanged += EventsService_ProjectDirectoryChanged; eventsService.StashesChangedEvent += EventsService_StashesChangedEvent; T.RegisterTranslationsByCulture(@"po\*.po"); }
public GitStashWrapper(string path, IGitStashProjectEvents eventsService, IGitStashOutputLogger logger, IGitStashProjects projects, Translator T) : this(eventsService, logger, projects, T) { repo = new Repository(path); }