Beispiel #1
0
        public void AugmentQuickInfoSession(IQuickInfoSession session, IList <object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            var subjectTriggerPoint = session.GetTriggerPoint(_buffer.CurrentSnapshot);

            if (!subjectTriggerPoint.HasValue)
            {
                applicableToSpan = null;
                return;
            }

            var currentSnapshot = subjectTriggerPoint.Value.Snapshot;

            //look for occurrences of our QuickInfo words in the span
            var navigator = NavigatorService.GetTextStructureNavigator(_buffer);
            var extent    = navigator.GetExtentOfWord(subjectTriggerPoint.Value);
            var result    = _compilerService.LatestResult?.GetFile(_document.FilePath);

            applicableToSpan = null;

            if (result == null)
            {
                return;
            }

            bool foundSomething;

            SpanToSymbol(quickInfoContent, new NSpan(extent.Span.Start, extent.Span.End), result.Ast, out foundSomething);

            if (foundSomething)
            {
                applicableToSpan = currentSnapshot.CreateTrackingSpan(extent.Span.Start, extent.Span.Length, SpanTrackingMode.EdgeInclusive);
            }
        }
 public OrderCreatorViewModel(Order order)
 {
     _order            = order ?? new Order();
     SaveOrderCommand  = new RelayCommand(SaveOrder);
     dataBaseService   = DataBaseService.GetInstance();
     _navigatorService = NavigatorService.Instance;
 }
Beispiel #3
0
        public EmployeesCreatorViewModel(Employee employee)
        {
            _employee           = employee ?? new Employee();
            SaveEmployeeCommand = new RelayCommand(SaveEmployee);

            _navigatorService = NavigatorService.Instance;
        }
        public IMouseProcessor GetAssociatedProcessor(IWpfTextView wpfTextView)
        {
            var           navigator = NavigatorService.GetTextStructureNavigator(wpfTextView.TextBuffer);
            ITextDocument textDocument;

            TextDocumentFactoryService.TryGetTextDocument(wpfTextView.TextBuffer, out textDocument);
            return(new ImagePreviewToolTipMouseProcessor(wpfTextView, navigator, ToolTipProviderFactory, textDocument));
        }
        public EmployeesViewModel()
        {
            _navigatorService = NavigatorService.Instance;
            Employees         = new ObservableCollection <EmployeesListItem>();

            CreateEmployeeCommand = new RelayCommand <Employee>((employee) => CreateEmployee(employee), (o) => true);
            RemoveEmployeeCommand = new RelayCommand(RemoveEmployee);
        }
Beispiel #6
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            // MVVMbasics-specific initialization
            NavigatorService navigatorService = new NavigatorService();
            navigatorService.RegisterAll("CodeChallengeSample.App.Views.*");
            Services.Register(navigatorService);
        }
        public OrdersViewModel()
        {
            _navigatorService     = NavigatorService.Instance;
            OpenCreatePageCommand = new RelayCommand <Order>((order) => OpenCreatePage(order), (o) => true);
            RemoveOrderCommand    = new RelayCommand(RemoveOrder);
            DataBaseService       = DataBaseService.GetInstance();
            var DataBaseOrder = DataBaseService.GetAllOrders();

            Orders = new ObservableCollection <OrderListItem>(DataBaseOrder.Select(o => new OrderListItem(o)));
        }
Beispiel #8
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            // MVVMbasics-specific initialization
            NavigatorService navigatorService = new NavigatorService();

            navigatorService.RegisterAll("CodeChallengeSample.App.Views.*");
            Services.Register(navigatorService);
        }
Beispiel #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 public App()
 {
     // MVVMbasics-specific initialization
     NavigatorService navigatorService = new NavigatorService();
     //TODO: Modify the following line to automatically or manually register your Views
     navigatorService.RegisterAll("Views.*");
     ServiceLocator.Register(navigatorService);
     ServiceLocator.Register<MessageboxService>();
     //TODO: Modify the following line to automatically or manually register your Services
     ServiceLocator.RegisterAll("Services.*");
 }
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView textView = AdapterService.GetWpfTextView(textViewAdapter);

            if (textView != null)
            {
                var textNavigator = NavigatorService.GetTextStructureNavigator(textView.TextBuffer);

                textView.Properties.GetOrCreateSingletonProperty(() =>
                                                                 new CommandFilter(textViewAdapter, textView, textNavigator, SignatureHelpBroker));
            }
        }
Beispiel #11
0
        public App()
        {
            // MVVMbasics-specific initialization
            NavigatorService navigatorService = new NavigatorService();

            //TODO: Modify the following line to automatically or manually register your Views
            navigatorService.RegisterAll("MvvmApp.WPF.Views.*");
            base.Services.Register(navigatorService);
            base.Services.Register <MessageboxService>();
            //TODO: Modify the following lines to automatically or manually register your Services
            base.Services.Register <SamplePlatformspecificService>();
            base.Services.Register <SamplePortableService>();
        }
Beispiel #12
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            ITextView textView = AdapterService.GetWpfTextView(textViewAdapter);

            if (textView == null)
            {
                return;
            }

            textView.Properties.GetOrCreateSingletonProperty(
                () => new ProbeSignatureHelpCommandHandler(textViewAdapter,
                                                           textView,
                                                           NavigatorService.GetTextStructureNavigator(textView.TextBuffer),
                                                           SignatureHelpBroker,
                                                           this));
        }
Beispiel #13
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            // MVVMbasics-specific initialization
            NavigatorService navigatorService = new NavigatorService();

            //TODO: Modify the following line to automatically or manually register your Views
            navigatorService.RegisterAll("MvvmApp.UWP.Views.*");
            Services.Register(navigatorService);

            //TODO: Modify the following lines to automatically or manually register your Services
            Services.Register <MessageboxService>();
            Services.Register <SamplePlatformspecificService>();
            Services.Register <SamplePortableService>();
        }
Beispiel #14
0
        public App()
        {
            InitializeComponent();

            // MVVMbasics-specific initialization
            NavigatorService navigatorService = new NavigatorService();

            //TODO: Modify the following line to automatically or manually register your Views
            navigatorService.RegisterAll("MvvmApp.XamarinForms.Views.*", typeof(App).GetTypeInfo().Assembly);
            Services.Register(navigatorService);

            //TODO: Modify the following lines to automatically or manually register your Services
            Services.Register <MessageboxService>();
            Services.Register <SamplePlatformspecificService>();
            Services.Register <SamplePortableService>();

            SetStartupPage <MainPage>();
        }
Beispiel #15
0
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            if (buffer == null || textView == null)
            {
                return(null);
            }

            if (buffer == textView.TextBuffer)
            {
                ITextStructureNavigator textStructureNavigator = NavigatorService.GetTextStructureNavigator(buffer);

                return(new B4SmartTagger(buffer, textView, this, TextSearchService, textStructureNavigator,
                                         (DTE)ServiceProvider.GetService(typeof(DTE))) as ITagger <T>);
            }
            else
            {
                return(null);
            }
        }
Beispiel #16
0
        /// <summary>
        /// Defines the application's main page. If the provided page is not of type <code>NavigationPage</code> and
        /// a <see cref="MVVMbasics.Services.NavigatorService">NavigatorService</see> with more than one
        /// View-to-Viewmodel mapping is registered, it is automatically wrapped within a <code>NavigationPage</code>.
        /// </summary>
        /// <param name="page">The application's main page.</param>
        protected void SetStartupPage(Page page)
        {
            // If the given startup page is of type NavigationPage, just register it as MainPage. Otherwise...
            if (!(page is NavigationPage))
            {
                // ...check whether a NavigatorService is registered somewhere in the application
                NavigatorService navigatorService = null;

                try
                {
#pragma warning disable 618
                    if (ServiceLocator != null && ServiceLocator.Contains <INavigatorService>())
                    {
                        navigatorService = ServiceLocator.Retrieve <INavigatorService>() as NavigatorService;
                    }
                    else
                    {
                        navigatorService = Resolve(typeof(INavigatorService)) as NavigatorService;
                    }
#pragma warning restore 618
                }
                catch (Exception)
                {
                    navigatorService = null;
                }

                // ...and check whether more than one View/Viewmodel mapping has been registered to this
                // NavigatorService
                if (navigatorService != null)
                {
                    if (navigatorService.Mappings.Count > 1)
                    {
                        // If so, wrap the given page within a NavigationPage and set this as MainPage
                        MainPage = new NavigationPage(page);
                        return;
                    }
                }
            }

            // If no NavigatorService has been found, or only one View/Viewmodel mapping is present, it's not
            // necessary to wrap the given page within a NavigationPage, so just register it as MainPage
            MainPage = page;
        }
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
                Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
                Microsoft.ApplicationInsights.WindowsCollectors.Session);
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            // MVVMbasics-specific initialization
            NavigatorService navigatorService = new NavigatorService();

            //TODO: Modify the following line to automatically or manually register your Views
            navigatorService.RegisterAll("StoreApp1.Views.*");
            Services.Register(navigatorService);

            //TODO: Modify the following lines to automatically or manually register your Services
            Services.Register <MessageboxService>();
            Services.Register <SamplePlatformspecificService>();
            Services.Register <SamplePortableService>();
        }
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            var textView = AdapterService.GetWpfTextView(textViewAdapter);

            textView?.Properties.GetOrCreateSingletonProperty(() => new SignatureHelpCommandHandler(textViewAdapter,
                                                                                                    textView,
                                                                                                    NavigatorService.GetTextStructureNavigator(textView.TextBuffer),
                                                                                                    SignatureHelpBroker));
        }
Beispiel #19
0
 protected BaseViewModel()
 {
     navigatorService = new NavigatorService();
 }
Beispiel #20
0
 public StartViewModel(Page startPage)
 {
     _currentPage         = startPage;
     GoHomePageCommand    = new AwaitableDelegateCommand(async() => CurrentPage = await NavigatorService.GoPage(CurrentPage, "HomePage"));
     GoCpuPageCommand     = new AwaitableDelegateCommand(async() => CurrentPage = await NavigatorService.GoPage(CurrentPage, "CpuPage"));
     GoProcessPageCommand = new AwaitableDelegateCommand(async() => CurrentPage = await NavigatorService.GoPage(CurrentPage, "ProcessPage"));
 }
Beispiel #21
0
        public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
        {
            ISQLanguageService service = SQVSUtils.GetService <ISQLanguageService>();

            return(new SQCompletionSource(GlyphService, NavigatorService.GetTextStructureNavigator(textBuffer), textBuffer, service as SQLanguageServiceEX));
        }
Beispiel #22
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IVsTextLines textlines;

            textViewAdapter.GetBuffer(out textlines);
            if (textlines != null)
            {
                Guid langId;
                textlines.GetLanguageServiceID(out langId);
                IWpfTextView textView = AdaptersFactory.GetWpfTextView(textViewAdapter);
                Debug.Assert(textView != null);
                // Note that this may get called after the classifier has been instantiated

                if (langId == GuidStrings.guidLanguageService)          // is our language service active ?
                {
                    string fileName = FilePathUtilities.GetFilePath(textlines);
                    if (!IsOurSourceFile(fileName))       // is this a file node from Vulcan ?
                    {
                        // we always register the file in the classifier.
                        if (textView.TextBuffer.Properties.ContainsProperty(typeof(XSharpModel.XFile)))
                        {
                            textView.TextBuffer.Properties.RemoveProperty(typeof(XSharpModel.XFile));
                        }

                        Guid guidVulcanLanguageService = GuidStrings.guidVulcanLanguageService;
                        textlines.SetLanguageServiceID(guidVulcanLanguageService);
                        return;
                    }
                    //
                    // Only capturing keystroke for OUR languageService... ???
                    //

                    // Get XFile and assign it to the textbuffer
                    if (!textView.TextBuffer.Properties.ContainsProperty(typeof(XSharpModel.XFile)))
                    {
                        var file = XSharpModel.XSolution.FindFile(fileName);
                        if (file != null)
                        {
                            textView.TextBuffer.Properties.AddProperty(typeof(XSharpModel.XFile), file);
                        }
                    }
                    CommandFilter     filter = new CommandFilter(textView, CompletionBroker, NavigatorService.GetTextStructureNavigator(textView.TextBuffer), SignatureHelpBroker, aggregator, this);
                    IOleCommandTarget next;
                    textViewAdapter.AddCommandFilter(filter, out next);
                    filter.Next = next;
                }
            }
        }
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            ITextView textView = AdapterService.GetWpfTextView(textViewAdapter);

            if (textView == null)
            {
                return;
            }

            ThreadHelper.ThrowIfNotOnUIThread();

            Parser.Project parsedproject = null;
            var            buffer        = textView.TextBuffer;

            IVsTextBuffer bufferAdapter;

            buffer.Properties.TryGetProperty(typeof(IVsTextBuffer), out bufferAdapter);

            var persist = (IPersistFileFormat)bufferAdapter;

            if (persist != null)
            {
                string filename    = null;
                uint   formatindex = 0;
                if (persist.GetCurFile(out filename, out formatindex) == VSConstants.S_OK)
                {
                    var doctable  = new RunningDocumentTable(ServiceProvider);
                    var hierarchy = doctable.GetHierarchyItem(filename);
                    if (hierarchy != null)
                    {
                        parsedproject = Parser.ProjectMapper.GetInstance().Map(hierarchy);
                    }
                }
            }

            if (!buffer.Properties.ContainsProperty(typeof(Parser.Project)))
            {
                buffer.Properties.AddProperty(typeof(Parser.Project), parsedproject);
            }


            Func <EpochCompletionCommandHandler> createCommandHandler = delegate()
            {
                return(new EpochCompletionCommandHandler(textViewAdapter, textView, this, SignatureHelpBroker, NavigatorService.GetTextStructureNavigator(textView.TextBuffer)));
            };

            textView.Properties.GetOrCreateSingletonProperty(createCommandHandler);
        }