Exemplo n.º 1
0
        private void OnDocumentClosed(object sender, DocumentEventArgs e)
        {
            lock (_gate)
            {
                Dictionary<object, WeakReference<AbstractTableEntriesSnapshot<DiagnosticData>>> secondMap;
                if (!_map.TryGetValue(e.Document.Id, out secondMap))
                {
                    return;
                }

                _map.Remove(e.Document.Id);
                foreach (var weakSnapshot in secondMap.Values)
                {
                    AbstractTableEntriesSnapshot<DiagnosticData> snapshot;
                    if (!weakSnapshot.TryGetTarget(out snapshot))
                    {
                        continue;
                    }

                    snapshot.StopTracking();
                }
            }
        }
Exemplo n.º 2
0
 protected Task RaiseDocumentActiveContextChangedEventAsync(Document document)
 {
     var handlers = this.eventMap.GetEventHandlers<EventHandler<DocumentEventArgs>>(DocumentActiveContextChangedName);
     if (handlers.Length > 0)
     {
         return this.ScheduleTask(() =>
         {
             var args = new DocumentEventArgs(document);
             foreach (var handler in handlers)
             {
                 handler(this, args);
             }
         }, "Workspace.WorkspaceChanged");
     }
     else
     {
         return SpecializedTasks.EmptyTask;
     }
 }
Exemplo n.º 3
0
 protected Task RaiseDocumentClosedEventAsync(Document document)
 {
     var handlers = this.eventMap.GetEventHandlers<EventHandler<DocumentEventArgs>>(DocumentClosedEventName);
     if (handlers != null)
     {
         return this.ScheduleTask(() =>
         {
             var args = new DocumentEventArgs(document);
             foreach (var handler in handlers)
             {
                 handler(this, args);
             }
         }, "Workspace.DocumentClosed");
     }
     else
     {
         return SpecializedTasks.EmptyTask;
     }
 }
 protected Task RaiseDocumentActiveContextChangedEventAsync(Document document)
 {
     var ev = _eventMap.GetEventHandlers<EventHandler<DocumentEventArgs>>(DocumentActiveContextChangedName);
     if (ev.HasHandlers)
     {
         return this.ScheduleTask(() =>
         {
             var args = new DocumentEventArgs(document);
             ev.RaiseEvent(handler => handler(this, args));
         }, "Workspace.WorkspaceChanged");
     }
     else
     {
         return SpecializedTasks.EmptyTask;
     }
 }