Esempio n. 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()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this));
            base.Initialize();

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = this.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            Settings settings = Settings.LoadSettings(VSFoldersPackage.GetSettingsFilePath());

            Factory.Register(settings);
            settings.PropertyChanged += VSFoldersPackage.SettingsOnPropertyChanged;

            if (settings.OpenFolders == null)
            {
                settings.OpenFolders = new ObservableCollection <string>();
            }

            settings.OpenFolders.CollectionChanged += VSFoldersPackage.OpenFoldersOnCollectionChanged;

            Factory.Register <IServiceProvider>(this);
            Factory.Resolve <SearchProvider>().Initialize();

            if (null != mcs)
            {
                // Create the command for the tool window
                CommandID   toolwndFoldersID = new CommandID(GuidList.GuidVsFoldersCmdSet, (int)PkgCmdIDList.cmdidFolders);
                MenuCommand menuFoldersWin   = new MenuCommand(this.ShowToolFoldersWindow, toolwndFoldersID);
                mcs.AddCommand(menuFoldersWin);
            }
        }
Esempio n. 2
0
 /// <summary>
 ///     Opens the folders on collection changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="notifyCollectionChangedEventArgs">
 ///     The <see cref="NotifyCollectionChangedEventArgs" /> instance containing
 ///     the event data.
 /// </param>
 private static void OpenFoldersOnCollectionChanged(
     object sender,
     NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
 {
     Factory.Resolve <Settings>().Save(VSFoldersPackage.GetSettingsFilePath());
 }
Esempio n. 3
0
 /// <summary>
 ///     Settingses the on property changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="propertyChangedEventArgs">The <see cref="PropertyChangedEventArgs" /> instance containing the event data.</param>
 private static void SettingsOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
 {
     Factory.Resolve <Settings>().Save(VSFoldersPackage.GetSettingsFilePath());
 }