コード例 #1
0
        public DocumentContext(IWpfTextView textView, GlobalContext globalContext)
        {
            _globalContext = globalContext;
            TextView       = textView;
            DocumentPath   = textView.GetPath();
            _configuration = ConfigurationRepository.Instance.Configuration;

            Document      = globalContext.GetDocumentFromPath(DocumentPath);
            SwitchButtons = new SwitchButton[] {
                new CSharpSwitchButton(this),
                new CssSwitchButton(this),
                new TSSwitchButton(this),
                new HtmlSwitchButton(this)
            };
            foreach (var codeFile in SwitchButtons)
            {
                codeFile.SwitchClick += OnSwitchClick;
                codeFile.SwitchClick += OnSwitchClick;
            }

            globalContext.RegisterDcoument(this);
            _configuration.Changed += UpdateState;
            UpdateState();
        }