public void ForceRefresh() { Action refreshAction = () => { lock (GraphCollection.Singleton) { GraphCollection singleton = GraphCollection.Singleton; this.listBox1.DataSource = singleton.Graphs.ToArray(); } }; this.BeginInvoke(refreshAction); }
public static bool StartProcess(int fileID, string argPath) { var dgml = new DGMLGraphProcessing(fileID); dgml._name = argPath; GraphCollection collection = GraphCollection.Singleton; dgml.Complete += (fileID) => { lock (collection) { collection.AddGraph(dgml.g); } Debug.Assert(fileID == dgml.FileID); }; return(dgml.FindXML(argPath)); }
private void EventProcessingThread() { GraphCollection collection = GraphCollection.Singleton; while (!stopped) { Thread.Sleep(1); lock (collection) { GraphEvent eventRead; while (events.TryDequeue(out eventRead)) { try { switch (eventRead.EventType) { case GraphEventType.NewEdge: collection.AddEdgeToGraph(eventRead.Pid, eventRead.Id, eventRead.Num1, eventRead.Num2, eventRead.Str); break; case GraphEventType.NewNode: collection.AddNodeToGraph(eventRead.Pid, eventRead.Id, eventRead.Num1, eventRead.Str); break; case GraphEventType.NewGraph: collection.AddGraph(eventRead.Pid, eventRead.Id, eventRead.Str); break; case GraphEventType.NewConditionalEdge: collection.AddConditionalEdgeToGraph(eventRead.Pid, eventRead.Id, eventRead.Num1, eventRead.Num2, eventRead.Num3, eventRead.Str); break; } } catch { // Ignore bad input } } } } }