コード例 #1
0
 private void GetWorksets()
 {
     try
     {
         var wsCollector = new FilteredWorksetCollector(ModelDoc);
         var wsFilter    = new WorksetKindFilter(WorksetKind.UserWorkset);
         worksetIds = wsCollector.WherePasses(wsFilter).ToWorksetIds().ToList();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Failed to get worksets.\n" + ex.Message, "Get Worksets", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
コード例 #2
0
        private void GetWorksets()
        {
            try
            {
                if (sModelInfo.ModelDoc.IsWorkshared)
                {
                    var collector = new FilteredWorksetCollector(sModelInfo.ModelDoc);
                    var wsFilter  = new WorksetKindFilter(WorksetKind.UserWorkset);
                    var worksets  = collector.WherePasses(wsFilter).ToWorksets().ToList();
                    foreach (var ws in worksets)
                    {
                        var iInfo = new ItemInfo(ws, MapType.Workset);
                        if (!sourceItems.ContainsKey(iInfo.ItemId))
                        {
                            sourceItems.Add(iInfo.ItemId, iInfo);
                        }
                    }
                }

                if (rModelInfo.ModelDoc.IsWorkshared)
                {
                    var collector = new FilteredWorksetCollector(rModelInfo.ModelDoc);
                    var wsFilter  = new WorksetKindFilter(WorksetKind.UserWorkset);
                    var worksets  = collector.WherePasses(wsFilter).ToWorksets().ToList();
                    foreach (var ws in worksets)
                    {
                        var iInfo = new ItemInfo(ws, MapType.Workset);
                        if (!recipientItems.ContainsKey(iInfo.ItemId))
                        {
                            recipientItems.Add(iInfo.ItemId, iInfo);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to get worksets.\n" + ex.Message, "Get Worksets", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }