void WorkspaceEvents_WorkspaceAdded(WorkspacesModificationEventArgs args)
        {
            // The workspace's PreloadedTraceData should be available here
            // before the workspace has been run. We use this trace data to
            // get a dictionary, keyed by node guid, of element ids which
            // have been saved to the file. This dictionary will be used only
            // once, after the first run of the graph to reconcile elements that
            // are newly created with what had been created previously, removing
            // any elements from the model that were pre-existing and associated
            // with Dynamo, but no longer created by Dynamo.

            var hws = Workspaces.FirstOrDefault(ws => ws is HomeWorkspaceModel) as HomeWorkspaceModel;

            if (hws == null)
            {
                return;
            }

            var serializedTraceData = hws.PreloadedTraceData;

            if (serializedTraceData == null)
            {
                return;
            }

            historicalElementData.Add(args.Id, new Dictionary <Guid, List <int> >());

            foreach (var kvp in serializedTraceData)
            {
                var idList = new List <int>();

                historicalElementData[args.Id].Add(kvp.Key, idList);

                foreach (var callSiteData in kvp.Value)
                {
                    var serializables = DeserializeCallsiteData(callSiteData);
                    idList.AddRange(serializables.Select(ser => ((SerializableId)ser).IntID));
                }
            }
        }
Exemple #2
0
 private void WorkspacesModified(WorkspacesModificationEventArgs args)
 {
     Assert.AreEqual(args.Name, "Add");
 }
 void WorkspaceEventsWorkspaceAdded(WorkspacesModificationEventArgs args)
 {
     // What does a hog do when a workspace is opened?
 }