Esempio n. 1
0
        public LeapsDocument(LeapsClient client, string documentId, IWpfTextView textView)
        {
            this.client     = client;
            this.documentId = documentId;
            this.textView   = textView;

            client.Connected.Subscribe(ClientConnected);
            client.DocumentReceived.ObserveOn(RxApp.MainThreadScheduler).Subscribe(ClientDocumentReceived);
            client.TransformsReceived.ObserveOn(RxApp.MainThreadScheduler).Subscribe(ClientTransformsReceived);
            client.UpdatesReceived.ObserveOn(RxApp.MainThreadScheduler).Subscribe(ClientUpdatesReceived);
            client.Connect();
        }
        public void TextViewCreated(IWpfTextView textView)
        {
            ITextDocument document;

            if (textView.TextBuffer.Properties.TryGetProperty(typeof(ITextDocument), out document))
            {
                var dir        = Path.GetFileName(Path.GetDirectoryName(document.FilePath));
                var file       = Path.GetFileName(document.FilePath);
                var documentId = Path.Combine(dir, file);
                var client     = new LeapsClient(LeapsUri);
                textView.Properties.GetOrCreateSingletonProperty(() => new LeapsDocument(client, documentId, textView));
            }
        }