/// <summary> /// Initializes data model before UI's shown. /// </summary> /// <param name="argument">Optional argument.</param> public override void OnInitialize(object argument) { _log.LogMessage(this.Feature, "Initializing..."); var model = _solutionProcessor.GetProjects(ProcessorFlags.IncludeFiles | ProcessorFlags.GroupLinkedFiles); var files = model.Files; var solutionName = model.SolutionName; files = ApplyOptions(files); this.SolutionName = _optionsService.GetStringOption(this.Feature, "Solution", this.SolutionName); _search = _optionsService.GetStringOption(this.Feature, "Search", _search); _allFiles = _optionsService.GetBoolOption(this.Feature, "AllFiles", _allFiles); // Reset search on new solution if (!string.IsNullOrEmpty(this.SolutionName) && !string.IsNullOrEmpty(solutionName) && !solutionName.Equals(this.SolutionName, StringComparison.OrdinalIgnoreCase)) { _search = string.Empty; } this.SolutionName = solutionName; _sourceFiles.Clear(); _sourceFiles.AddRange(files); // causes filter to be evaluated using (_files.DeferRefresh()) // defers filter evaluation until end of using { _files.Filter += OnFilter; OnSearch(); } _log.LogMessage(this.Feature, "Initialized"); }
/// <summary> /// Rescans all members. /// </summary> private void ApplyMembers() { var flags = ProcessorFlags.IncludeFileCodeModel; if (_optionsService.GetBoolOption(this.Feature, "XmlDoc")) { flags = flags | ProcessorFlags.IncludeMemberXmlDoc; } var members = _fileProcessor.GetMembers(flags, this.Filter); _sourceMembers.Clear(); _sourceMembers.AddRange(members); // causes filter to be evaluated }
/// <summary> /// Rescans all members. /// </summary> private void ApplyMembers() { var flags = ProcessorFlags.IncludeFileCodeModel; if (_optionsService.GetBoolOption(this.Feature, "XmlDoc")) { flags = flags | ProcessorFlags.IncludeMemberXmlDoc; } var model = _fileProcessor.GetMembers(flags, this.Filter); var members = model.Members; var fileName = model.FileName; this.SameType = model.Members.Count( m => (m.ElementKind == Kind.Class) || (m.ElementKind == Kind.Interface) || (m.ElementKind == Kind.Struct) || (m.ElementKind == Kind.Enum)) <= 1; // Reset search on new file if (!string.IsNullOrEmpty(this.FileName) && !string.IsNullOrEmpty(fileName) && !fileName.Equals(this.FileName, StringComparison.OrdinalIgnoreCase)) { _search = string.Empty; } this.FileName = fileName; string filter = null; if (this.Filter == CodeModelFilterFlags.All) { filter = string.Empty; } else if (this.Filter.HasFlag(CodeModelFilterFlags.ClassesInterfaces)) { filter = "classes and interfaces"; } else if (this.Filter.HasFlag(CodeModelFilterFlags.Methods)) { filter = "methods"; } else if (this.Filter.HasFlag(CodeModelFilterFlags.Properties)) { filter = "properties"; } this.Title = $"USysWare Code Browser {(string.IsNullOrEmpty(filter) ? string.Empty : $"- {filter} ")}- {Path.GetFileName(this.FileName)}";
/// <summary> /// Initializes data model before UI's shown. /// </summary> /// <param name="argument">Optional argument.</param> public override void OnInitialize(object argument) { _log.LogMessage(this.Feature, "Initializing..."); var files = _solutionProcessor.GetProjects(ProcessorFlags.IncludeFiles | ProcessorFlags.GroupLinkedFiles).Files; files = ApplyOptions(files); _search = _optionsService.GetStringOption(this.Feature, "Search", _search); _allFiles = _optionsService.GetBoolOption(this.Feature, "AllFiles", _allFiles); _sourceFiles.Clear(); _sourceFiles.AddRange(files); // causes filter to be evaluated using (_files.DeferRefresh()) // defers filter evaluation until end of using { _files.Filter += OnFilter; OnSearch(); } _log.LogMessage(this.Feature, "Initialized"); }
/// <summary> /// Shows first time use message. /// </summary> private void ShowFirstTimeUse() { if (_firstTimeUseChecked) { return; } try { if (_optionsService.GetBoolOption(KnownFeature.SupportOptions, WELCOME)) { return; } var message = string.Format(WELCOME_TEXT, _packageService.ProductName, _packageService.VSKnownVersion); _shellInfoBarService.ShowInfoBar(message, "Assign Keyboard Shortcuts", AssignShortcuts, true); } finally { _firstTimeUseChecked = true; _optionsService.SetBoolOption(KnownFeature.SupportOptions, WELCOME, true); } }
/// <summary> /// Rescans all members. /// </summary> private void ApplyMembers() { var flags = ProcessorFlags.IncludeFileCodeModel; if (_optionsService.GetBoolOption(this.Feature, "XmlDoc")) { flags = flags | ProcessorFlags.IncludeMemberXmlDoc; } var model = _fileProcessor.GetMembers(flags, this.Filter); var members = model.Members; var fileName = model.FileName; // Reset search on new file if (!string.IsNullOrEmpty(this.FileName) && !string.IsNullOrEmpty(fileName) && !fileName.Equals(this.FileName, StringComparison.OrdinalIgnoreCase)) { _search = string.Empty; } this.FileName = fileName; _sourceMembers.Clear(); _sourceMembers.AddRange(members); // causes filter to be evaluated }