Exemplo n.º 1
0
        protected override void OnViewLoaded(object viewObject)
        {
            base.OnViewLoaded(viewObject);
            var view = viewObject as ScriptedObjectDocumentView;

            if (view == null)
            {
                return;
            }
            editor = view.editor;
            EditorLoaded();
            editor.FontFamily           = font ?? new FontFamily("Consolas");
            findTextBox                 = view.findTextBox;
            findTextChangedSubscription = Observable
                                          .FromEventPattern <TextChangedEventArgs>(findTextBox, "TextChanged")
                                          .Select(c => ((TextBox)c.Sender).Text)
                                          .DistinctUntilChanged()
                                          .Throttle(TimeSpan.FromMilliseconds(200))
                                          .ObserveOnDispatcher()
                                          .Subscribe(c => TextSearch(c));

            Observable.FromEventPattern <PropertyChangedEventArgs>(this, "PropertyChanged")
            .Where(pc => pc.EventArgs.PropertyName == "FormatSql")
            .SubscribeOnDispatcher()
            .Subscribe(b => SetSqlFormat());

            sqlTextPropChangedSub = Observable.FromEventPattern <PropertyChangedEventArgs>(this, "PropertyChanged")
                                    .Where(pc => pc.EventArgs.PropertyName == "SqlText")
                                    .SubscribeOnDispatcher()
                                    .Subscribe(b => FindText = new FindTextViewModel(SqlText));
            eventagg.Subscribe(this);
        }
Exemplo n.º 2
0
        public void EditorLoaded()
        {
            var type     = typeof(ScriptedObjectDocumentViewModel);
            var fullName = type.Namespace + ".tsql.xshd";

            IHighlightingDefinition hl;

            using (var stream = type.Assembly.GetManifestResourceStream(fullName))
            {
                using (var reader = new XmlTextReader(stream))
                {
                    hl = HighlightingLoader.Load(reader, HighlightingManager.Instance);
                }
            }

            this.editor.SyntaxHighlighting = hl;

            // AvalonEdit is NOT able to bind its Text property, so we have to JAM it in there...
            editor.Text = SqlText;
            SqlText     = _originalSqlText;
            FindText    = new FindTextViewModel(SqlText);

            // set up the highlighting for search results
            _generalHighlight       = new SearchResultsHighlight("general");
            _curentResultsHighlight = new SearchResultsHighlight("current")
            {
                ForegroundBrush = Brushes.Black,
                BackgroundBrush = Brushes.Orange,
            };

            editor.TextArea.TextView.LineTransformers.Add(_generalHighlight);
            editor.TextArea.TextView.LineTransformers.Add(_curentResultsHighlight);

            editor.TextArea.TextView.Redraw();
        }
 public RetrieveExtensionCommand(FindTextViewModel viewModel, Guid authToken)
 {
     m_FindTextViewModel = viewModel;
     m_AuthToken         = authToken;
 }
Exemplo n.º 4
0
 public BrowseCommand(FindTextViewModel viewModel)
 {
     m_FindTextViewModel = viewModel;
 }
Exemplo n.º 5
0
 public FindCommand(FindTextViewModel viewModel)
 {
     m_FindTextViewModel = viewModel;
 }
Exemplo n.º 6
0
 public ScriptedObjectDocumentViewModel()
 {
     IsLoadingDefinition = true;
     FindText            = new FindTextViewModel("");
 }