예제 #1
0
        /// <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...");

            if (!(argument is CodeModelFilterFlags))
            {
                throw new ArgumentException("Invalid initialization argument", nameof(argument));
            }

            this.FileName = _optionsService.GetStringOption(this.Feature, "File", this.FileName);
            _search       = _optionsService.GetStringOption(this.Feature, "Search", _search);
            this.Filter   = (CodeModelFilterFlags)argument;
            var filter = (CodeModelFilterFlags)_optionsService.GetIntOption(this.Feature, "Filter", (int)this.Filter);

            if (filter != this.Filter)
            {
                _search = string.Empty;
            }

            ApplyMembers();

            using (_members.DeferRefresh())             // defers filter evaluation until end of using
            {
                _members.Filter += OnFilter;

                OnSearch();
            }

            _log.LogMessage(this.Feature, "Initialized");
        }