コード例 #1
0
        internal void RegisterDeleteHook(Autodesk.Revit.DB.ElementId id, DynElementUpdateDelegate d)
        {
            DynElementUpdateDelegate del = delegate(List <Autodesk.Revit.DB.ElementId> deleted)
            {
                var valid   = new List <Autodesk.Revit.DB.ElementId>();
                var invalid = new List <Autodesk.Revit.DB.ElementId>();
                foreach (var delId in deleted)
                {
                    try
                    {
                        Autodesk.Revit.DB.Element e = dynRevitSettings.Doc.Document.GetElement(delId);
                        if (e != null)
                        {
                            valid.Add(e.Id);
                        }
                        else
                        {
                            invalid.Add(delId);
                        }
                    }
                    catch
                    {
                        invalid.Add(delId);
                    }
                }
                valid.Clear();
                d(invalid);
                foreach (var invId in invalid)
                {
                    this.Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Modify);
                    this.Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Add);
                    this.Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Delete);
                }
            };

            DynElementUpdateDelegate mod = delegate(List <Autodesk.Revit.DB.ElementId> modded)
            {
                _transElements.RemoveAll(modded.Contains);

                foreach (var mid in modded)
                {
                    this.Updater.UnRegisterChangeHook(mid, ChangeTypeEnum.Modify);
                    this.Updater.UnRegisterChangeHook(mid, ChangeTypeEnum.Add);
                }
            };

            this.Updater.RegisterChangeHook(
                id, ChangeTypeEnum.Delete, del
                );
            this.Updater.RegisterChangeHook(
                id, ChangeTypeEnum.Modify, mod
                );
            this.Updater.RegisterChangeHook(
                id, ChangeTypeEnum.Add, mod
                );
            this._transElements.Add(id);
        }
コード例 #2
0
        internal void RegisterAllElementsDeleteHook()
        {
            var del = new DynElementUpdateDelegate(onDeleted);

            foreach (var id in elements.SelectMany(eList => eList))
            {
                dynRevitSettings.Controller.RegisterDMUHooks(id, del);
            }
        }
コード例 #3
0
        internal void RegisterSuccessfulDeleteHook(ElementId id, DynElementUpdateDelegate updateDelegate)
        {
            HashSet <ElementId> elements;

            if (!_transDelElements.TryGetValue(updateDelegate, out elements))
            {
                elements = new HashSet <ElementId>();
                _transDelElements[updateDelegate] = elements;
            }
            elements.Add(id);
        }
コード例 #4
0
        internal void RegisterAllElementsDeleteHook()
        {
            var del = new DynElementUpdateDelegate(onDeleted);

            foreach (var eList in elements)
            {
                foreach (var id in eList)
                {
                    dynRevitSettings.Controller.RegisterDeleteHook(id, del);
                }
            }
        }
コード例 #5
0
ファイル: dynModelUpdater.cs プロジェクト: Sean-Nguyen/Dynamo
        /// <summary>
        /// Watches for changes of the given type to the Element with the given ID. When changed, executes
        /// the given Delegate.
        /// </summary>
        /// <param name="e">ID of the Element being watched.</param>
        /// <param name="type">Type of change to watch for.</param>
        /// <param name="d">Delegate to be called when changed.</param>
        public void RegisterChangeHook(ElementId e, ChangeTypeEnum type, DynElementUpdateDelegate d)
        {
            Dictionary <ElementId, DynElementUpdateDelegate> dict;

            if (!_updateDict.ContainsKey(type))
            {
                dict = new Dictionary <ElementId, DynElementUpdateDelegate>();
                _updateDict[type] = dict;
            }
            else
            {
                dict = _updateDict[type];
            }

            dict[e] = d;
        }
コード例 #6
0
        protected override void OnEvaluate()
        {
            base.OnEvaluate();

            #region Register Elements w/ DMU

            var del = new DynElementUpdateDelegate(onDeleted);

            foreach (ElementId id in Elements)
            {
                dynRevitSettings.Controller.RegisterDMUHooks(id, del);
            }

            #endregion

            _runCount++;
        }
コード例 #7
0
        internal void RegisterDMUHooks(ElementId id, DynElementUpdateDelegate updateDelegate)
        {
            DynElementUpdateDelegate del = delegate(HashSet <ElementId> deleted)
            {
                var invalid = new HashSet <ElementId>();
                foreach (var delId in deleted)
                {
                    try
                    {
                        Element e = dynRevitSettings.Doc.Document.GetElement(delId);
                        if (e == null)
                        {
                            invalid.Add(delId);
                        }
                    }
                    catch
                    {
                        invalid.Add(delId);
                    }
                }
                updateDelegate(invalid);
                foreach (var invId in invalid)
                {
                    Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Modify);
                    Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Add);
                    Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Delete);
                }
            };

            DynElementUpdateDelegate mod = delegate(HashSet <ElementId> modded)
            {
                _transElements.RemoveAll(modded.Contains);

                foreach (var mid in modded)
                {
                    Updater.UnRegisterChangeHook(mid, ChangeTypeEnum.Modify);
                    Updater.UnRegisterChangeHook(mid, ChangeTypeEnum.Add);
                }
            };

            Updater.RegisterChangeHook(id, ChangeTypeEnum.Delete, del);
            Updater.RegisterChangeHook(id, ChangeTypeEnum.Modify, mod);
            Updater.RegisterChangeHook(id, ChangeTypeEnum.Add, mod);
            _transElements.Add(id);
        }
コード例 #8
0
        internal void RegisterDMUHooks(ElementId id, DynElementUpdateDelegate updateDelegate)
        {
            // Redundancies? Leaving commented out for now. -SJE

            DynElementUpdateDelegate del = delegate(HashSet <ElementId> deleted)
            {
                //var invalid = new HashSet<ElementId>();
                //foreach (var delId in deleted)
                //{
                //    try
                //    {
                //        Element e = dynRevitSettings.Doc.Document.GetElement(delId);
                //        if (e == null)
                //            invalid.Add(delId);
                //    }
                //    catch
                //    {
                //        invalid.Add(delId);
                //    }
                //}
                foreach (var invId in deleted)//invalid)
                {
                    Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Modify);
                    Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Add);
                    Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Delete);
                }
                updateDelegate(deleted);//invalid);
            };

            //DynElementUpdateDelegate mod = delegate(HashSet<ElementId> modded)
            //{
            //    _transElements.RemoveAll(modded.Contains);

            //    foreach (var mid in modded)
            //    {
            //        Updater.UnRegisterChangeHook(mid, ChangeTypeEnum.Modify);
            //        Updater.UnRegisterChangeHook(mid, ChangeTypeEnum.Add);
            //    }
            //};

            Updater.RegisterChangeHook(id, ChangeTypeEnum.Delete, del);
            //Updater.RegisterChangeHook(id, ChangeTypeEnum.Modify, mod);
            //Updater.RegisterChangeHook(id, ChangeTypeEnum.Add, mod);
            _transElements.Add(id);
        }
コード例 #9
0
        protected override void LoadNode(XmlNode elNode)
        {
            var del = new DynElementUpdateDelegate(onDeleted);

            elements.Clear();

            var sb = new StringBuilder();

            foreach (XmlNode subNode in elNode.ChildNodes)
            {
                if (subNode.Name == "Run")
                {
                    var runElements = new List <ElementId>();
                    elements.Add(runElements);

                    foreach (XmlNode element in subNode.ChildNodes)
                    {
                        if (element.Name == "Element")
                        {
                            var eid = element.InnerText;
                            try
                            {
                                var id = UIDocument.Document.GetElement(eid).Id;
                                runElements.Add(id);
                                dynRevitSettings.Controller.RegisterDMUHooks(id, del);
                            }
                            catch (NullReferenceException)
                            {
                                //DynamoLogger.Instance.Log("Element with UID \"" + eid + "\" not found in Document.");
                                sb.AppendLine("Element with UID \"" + eid + "\" not found in Document.");
                            }
                        }
                    }
                }
            }

            DynamoLogger.Instance.Log(sb.ToString());
        }
コード例 #10
0
ファイル: dynModelUpdater.cs プロジェクト: Tadwork/Dynamo
        /// <summary>
        /// Watches for changes of the given type to the Element with the given ID. When changed, executes
        /// the given Delegate.
        /// </summary>
        /// <param name="e">ID of the Element being watched.</param>
        /// <param name="type">Type of change to watch for.</param>
        /// <param name="d">Delegate to be called when changed.</param>
        public void RegisterChangeHook(ElementId e, ChangeTypeEnum type, DynElementUpdateDelegate d)
        {
            Dictionary<ElementId, DynElementUpdateDelegate> dict;
            if (!this.updateDict.ContainsKey(type))
            {
                dict = new Dictionary<ElementId, DynElementUpdateDelegate>();
                this.updateDict[type] = dict;
            }
            else
                dict = this.updateDict[type];

            dict[e] = d;
        }
コード例 #11
0
 internal void RegisterSuccessfulDeleteHook(ElementId id, DynElementUpdateDelegate updateDelegate)
 {
     HashSet<ElementId> elements;
     if (!_transDelElements.TryGetValue(updateDelegate, out elements))
     {
         elements = new HashSet<ElementId>();
         _transDelElements[updateDelegate] = elements;
     }
     elements.Add(id);
 }
コード例 #12
0
        internal void RegisterDMUHooks(ElementId id, DynElementUpdateDelegate updateDelegate)
        {
            // Redundancies? Leaving commented out for now. -SJE

            DynElementUpdateDelegate del = delegate(HashSet<ElementId> deleted)
            {
                //var invalid = new HashSet<ElementId>();
                //foreach (var delId in deleted)
                //{
                //    try
                //    {
                //        Element e = dynRevitSettings.Doc.Document.GetElement(delId);
                //        if (e == null)
                //            invalid.Add(delId);
                //    }
                //    catch
                //    {
                //        invalid.Add(delId);
                //    }
                //}
                foreach (var invId in deleted)//invalid)
                {
                    Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Modify);
                    Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Add);
                    Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Delete);
                }
                updateDelegate(deleted);//invalid);
            };

            //DynElementUpdateDelegate mod = delegate(HashSet<ElementId> modded)
            //{
            //    _transElements.RemoveAll(modded.Contains);

            //    foreach (var mid in modded)
            //    {
            //        Updater.UnRegisterChangeHook(mid, ChangeTypeEnum.Modify);
            //        Updater.UnRegisterChangeHook(mid, ChangeTypeEnum.Add);
            //    }
            //};

            Updater.RegisterChangeHook(id, ChangeTypeEnum.Delete, del);
            //Updater.RegisterChangeHook(id, ChangeTypeEnum.Modify, mod);
            //Updater.RegisterChangeHook(id, ChangeTypeEnum.Add, mod);
            _transElements.Add(id);
        }
コード例 #13
0
        public override void LoadElement(XmlNode elNode)
        {
            var del = new DynElementUpdateDelegate(onDeleted);

            elements.Clear();

            foreach (XmlNode subNode in elNode.ChildNodes)
            {
                if (subNode.Name == "Run")
                {
                    var runElements = new List<ElementId>();
                    elements.Add(runElements);

                    foreach (XmlNode element in subNode.ChildNodes)
                    {
                        if (element.Name == "Element")
                        {
                            var eid = subNode.InnerText;
                            try
                            {
                                var id = UIDocument.Document.GetElement(eid).Id;
                                runElements.Add(id);
                                dynRevitSettings.Controller.RegisterDeleteHook(id, del);
                            }
                            catch (NullReferenceException)
                            {
                                dynSettings.Controller.DynamoViewModel.Log("Element with UID \"" + eid + "\" not found in Document.");
                            }
                        }
                    }
                }
            }
        }
コード例 #14
0
        internal void RegisterDeleteHook(Autodesk.Revit.DB.ElementId id, DynElementUpdateDelegate d)
        {
            DynElementUpdateDelegate del = delegate(List<Autodesk.Revit.DB.ElementId> deleted)
            {
                var valid = new List<Autodesk.Revit.DB.ElementId>();
                var invalid = new List<Autodesk.Revit.DB.ElementId>();
                foreach (var delId in deleted)
                {
                    try
                    {
                        Autodesk.Revit.DB.Element e = dynRevitSettings.Doc.Document.GetElement(delId);
                        if (e != null)
                        {
                            valid.Add(e.Id);
                        }
                        else
                            invalid.Add(delId);
                    }
                    catch
                    {
                        invalid.Add(delId);
                    }
                }
                valid.Clear();
                d(invalid);
                foreach (var invId in invalid)
                {
                    this.Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Modify);
                    this.Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Add);
                    this.Updater.UnRegisterChangeHook(invId, ChangeTypeEnum.Delete);
                }
            };

            DynElementUpdateDelegate mod = delegate(List<Autodesk.Revit.DB.ElementId> modded)
            {
                _transElements.RemoveAll(modded.Contains);

                foreach (var mid in modded)
                {
                    this.Updater.UnRegisterChangeHook(mid, ChangeTypeEnum.Modify);
                    this.Updater.UnRegisterChangeHook(mid, ChangeTypeEnum.Add);
                }
            };

            this.Updater.RegisterChangeHook(
               id, ChangeTypeEnum.Delete, del
            );
            this.Updater.RegisterChangeHook(
               id, ChangeTypeEnum.Modify, mod
            );
            this.Updater.RegisterChangeHook(
               id, ChangeTypeEnum.Add, mod
            );
            this._transElements.Add(id);
        }
コード例 #15
0
        protected override void __eval_internal(FSharpList <Value> args, Dictionary <PortData, Value> outPuts)
        {
            var controller = dynRevitSettings.Controller;

            bool debug = controller.DynamoViewModel.RunInDebug;

            if (!debug)
            {
                #region no debug

                if ((controller.DynamoViewModel as DynamoRevitViewModel).TransMode ==
                    DynamoRevitViewModel.TransactionMode.Manual &&
                    !controller.IsTransactionActive())
                {
                    throw new Exception("A Revit transaction is required in order evaluate this element.");
                }

                controller.InitTransaction();

                Evaluate(args, outPuts);

                foreach (ElementId eid in deletedIds)
                {
                    controller.RegisterSuccessfulDeleteHook(
                        eid,
                        onSuccessfulDelete
                        );
                }
                deletedIds.Clear();

                #endregion
            }
            else
            {
                #region debug

                dynSettings.Controller.DynamoViewModel.Log("Starting a debug transaction for element: " + NickName);

                IdlePromise.ExecuteOnIdle(
                    delegate
                {
                    controller.InitTransaction();

                    try
                    {
                        Evaluate(args, outPuts);

                        foreach (ElementId eid in deletedIds)
                        {
                            controller.RegisterSuccessfulDeleteHook(
                                eid,
                                onSuccessfulDelete
                                );
                        }
                        deletedIds.Clear();

                        controller.EndTransaction();

                        ValidateConnections();
                    }
                    catch (Exception ex)
                    {
                        controller.CancelTransaction();
                        throw ex;
                    }
                },
                    false
                    );

                #endregion
            }

            #region Register Elements w/ DMU

            var del = new DynElementUpdateDelegate(onDeleted);

            foreach (ElementId id in Elements)
            {
                controller.RegisterDeleteHook(id, del);
            }

            #endregion
        }
コード例 #16
0
        internal void RegisterAllElementsDeleteHook()
        {
            var del = new DynElementUpdateDelegate(onDeleted);

            foreach (var id in elements.SelectMany(eList => eList))
            {
                dynRevitSettings.Controller.RegisterDMUHooks(id, del);
            }
        }
コード例 #17
0
        protected override void LoadNode(XmlNode nodeElement)
        {
            var del = new DynElementUpdateDelegate(onDeleted);

            elements.Clear();

            var sb = new StringBuilder();

            foreach (XmlNode subNode in nodeElement.ChildNodes)
            {
                if (subNode.Name == "Run")
                {
                    var runElements = new List<ElementId>();
                    elements.Add(runElements);

                    foreach (XmlNode element in subNode.ChildNodes)
                    {
                        if (element.Name == "Element")
                        {
                            var eid = element.InnerText;
                            try
                            {
                                var id = UIDocument.Document.GetElement(eid).Id;
                                runElements.Add(id);
                                dynRevitSettings.Controller.RegisterDMUHooks(id, del);
                            }
                            catch (NullReferenceException)
                            {
                                //DynamoLogger.Instance.Log("Element with UID \"" + eid + "\" not found in Document.");
                                sb.AppendLine("Element with UID \"" + eid + "\" not found in Document.");
                            }
                        }
                    }
                }
            }

            DynamoLogger.Instance.Log(sb.ToString());
        }
コード例 #18
0
        protected override void __eval_internal(FSharpList<Value> args, Dictionary<PortData, Value> outPuts)
        {
            var controller = dynRevitSettings.Controller;

            bool debug = controller.DynamoViewModel.RunInDebug;

            if (!debug)
            {
                #region no debug

                if ((controller.DynamoViewModel as DynamoRevitViewModel).TransMode ==
                    DynamoRevitViewModel.TransactionMode.Manual &&
                    !controller.IsTransactionActive())
                {
                    throw new Exception("A Revit transaction is required in order evaluate this element.");
                }

                controller.InitTransaction();

                Evaluate(args, outPuts);

                foreach (ElementId eid in deletedIds)
                {
                    controller.RegisterSuccessfulDeleteHook(
                       eid,
                       onSuccessfulDelete
                    );
                }
                deletedIds.Clear();

                #endregion
            }
            else
            {
                #region debug

                dynSettings.Controller.DynamoViewModel.Log("Starting a debug transaction for element: " + NickName);

                IdlePromise.ExecuteOnIdle(
                   delegate
                   {
                       controller.InitTransaction();

                       try
                       {
                           Evaluate(args, outPuts);

                           foreach (ElementId eid in deletedIds)
                           {
                               controller.RegisterSuccessfulDeleteHook(
                                  eid,
                                  onSuccessfulDelete
                               );
                           }
                           deletedIds.Clear();

                           controller.EndTransaction();

                           ValidateConnections();
                       }
                       catch (Exception ex)
                       {
                           controller.CancelTransaction();
                           throw ex;
                       }
                   }
                );

                #endregion
            }

            #region Register Elements w/ DMU

            var del = new DynElementUpdateDelegate(onDeleted);

            foreach (ElementId id in Elements)
                controller.RegisterDeleteHook(id, del);

            #endregion
        }
コード例 #19
0
        internal void RegisterAllElementsDeleteHook()
        {
            var del = new DynElementUpdateDelegate(onDeleted);

            foreach (var eList in elements)
            {
                foreach (var id in eList)
                    dynRevitSettings.Controller.RegisterDeleteHook(id, del);
            }
        }
コード例 #20
0
ファイル: dynNode.xaml.cs プロジェクト: Tadwork/Dynamo
        protected internal Value evaluateNode(FSharpList<Value> args)
        {
            //For convenience, store the bench.
            var bench = dynElementSettings.SharedInstance.Bench;

            if (SaveResult)
            {
                //Store the port mappings for this evaluate. We will compare later to see if it is dirty;
                foreach (dynPort p in InPorts)
                {
                    previousEvalPortMappings[p] = p.Connectors.Any()
                       ? p.Connectors[0].Start.Owner
                       : null;
                }
            }

            object[] rtAttribs = GetType().GetCustomAttributes(typeof(RequiresTransactionAttribute), false);
            bool useTransaction = rtAttribs.Length > 0 && ((RequiresTransactionAttribute)rtAttribs[0]).RequiresTransaction;

            object[] iaAttribs = GetType().GetCustomAttributes(typeof(IsInteractiveAttribute), false);
            bool isInteractive = iaAttribs.Length > 0 && ((IsInteractiveAttribute)iaAttribs[0]).IsInteractive;

            Value result = null;

            Action evaluation = delegate
            {
                if (bench.RunCancelled)
                    throw new CancelEvaluationException(false);

                bool debug = bench.RunInDebug;

                OnEvaluate();

                if (useTransaction)
                {
                    #region using transaction

                    if (!debug)
                    {
                        #region no debug

                        try
                        {
                            if (bench.TransMode == TransactionMode.Manual && !bench.IsTransactionActive())
                            {
                                var msg = "A Revit transaction is required in order evaluate this element.";
                                Error(msg);
                                throw new Exception(msg);
                            }

                            bench.InitTransaction();

                            result = Evaluate(args);

                            foreach (ElementId eid in deletedIds)
                            {
                                Bench.RegisterSuccessfulDeleteHook(
                                   eid,
                                   onSuccessfulDelete
                                );
                            }
                            deletedIds.Clear();

                            UpdateLayoutDelegate uld = new UpdateLayoutDelegate(CallUpdateLayout);
                            Dispatcher.Invoke(uld, System.Windows.Threading.DispatcherPriority.Background, new object[] { this });

                            elementsHaveBeenDeleted = false;
                            ValidateConnections();
                        }
                        catch (CancelEvaluationException ex)
                        {
                            OnRunCancelled();
                            throw ex;
                        }
                        catch (Exception ex)
                        {
                            Dispatcher.Invoke(new Action(
                               delegate
                               {
                                   Debug.WriteLine(ex.Message + " : " + ex.StackTrace);
                                   bench.Log(ex);
                                   bench.ShowElement(this);

                                   dynElementSettings.SharedInstance.Writer.WriteLine(ex.Message);
                                   dynElementSettings.SharedInstance.Writer.WriteLine(ex.StackTrace);
                               }
                            ));

                            Error(ex.Message);
                        }

                        #endregion
                    }
                    else
                    {
                        #region debug

                        Dispatcher.Invoke(new Action(
                           () =>
                              bench.Log("Starting a debug transaction for element: " + NickName)
                        ));

                        result = IdlePromise<Value>.ExecuteOnIdle(
                           delegate
                           {
                               bench.InitTransaction();

                               try
                               {
                                   var exp = Evaluate(args);

                                   foreach (ElementId eid in deletedIds)
                                   {
                                       Bench.RegisterSuccessfulDeleteHook(
                                          eid,
                                          onSuccessfulDelete
                                       );
                                   }
                                   deletedIds.Clear();

                                   UpdateLayoutDelegate uld = new UpdateLayoutDelegate(CallUpdateLayout);
                                   Dispatcher.Invoke(uld, System.Windows.Threading.DispatcherPriority.Background, new object[] { this });

                                   elementsHaveBeenDeleted = false;

                                   bench.EndTransaction();

                                   Dispatcher.BeginInvoke(new Action(
                                       () => ValidateConnections()
                                   ));

                                   return exp;
                               }
                               catch (CancelEvaluationException ex)
                               {
                                   OnRunCancelled();
                                   throw ex;
                               }
                               catch (Exception ex)
                               {
                                   Dispatcher.Invoke(new Action(
                                      delegate
                                      {
                                          Debug.WriteLine(ex.Message + " : " + ex.StackTrace);
                                          bench.Log(ex);
                                          bench.ShowElement(this);
                                      }
                                   ));

                                   Error(ex.Message);

                                   bench.CancelTransaction();

                                   Dispatcher.Invoke(new Action(
                                      delegate
                                      {
                                          dynElementSettings.SharedInstance.Writer.WriteLine(ex.Message);
                                          dynElementSettings.SharedInstance.Writer.WriteLine(ex.StackTrace);
                                      }
                                   ));

                                   return null;
                               }
                           }
                        );

                        #endregion
                    }

                    #endregion
                }
                else
                {
                    #region no transaction

                    try
                    {
                        result = Evaluate(args);

                        UpdateLayoutDelegate uld = new UpdateLayoutDelegate(CallUpdateLayout);
                        Dispatcher.Invoke(uld, System.Windows.Threading.DispatcherPriority.Background, new object[] { this });

                        elementsHaveBeenDeleted = false;

                        Dispatcher.BeginInvoke(new Action(
                            () => ValidateConnections()
                        ));
                    }
                    catch (CancelEvaluationException ex)
                    {
                        OnRunCancelled();
                        throw ex;
                    }
                    catch (Exception ex)
                    {
                        Dispatcher.Invoke(new Action(
                           delegate
                           {
                               Debug.WriteLine(ex.Message + " : " + ex.StackTrace);

                               bench.Log(ex);
                               bench.ShowElement(this);

                               dynElementSettings.SharedInstance.Writer.WriteLine(ex.Message);
                               dynElementSettings.SharedInstance.Writer.WriteLine(ex.StackTrace);
                           }
                        ));

                        Error(ex.Message);
                    }

                    #endregion
                }

                #region Register Elements w/ DMU

                var del = new DynElementUpdateDelegate(onDeleted);

                foreach (ElementId id in Elements)
                    Bench.RegisterDeleteHook(id, del);

                #endregion

                //Increment the run counter
                runCount++;

                IsDirty = false;
            };

            if (isInteractive)
                Dispatcher.Invoke(evaluation);
            else
                evaluation();

            if (result != null)
                return result;
            else
                throw new Exception("");
        }
コード例 #21
0
 internal void RegisterSuccessfulDeleteHook(Autodesk.Revit.DB.ElementId id, DynElementUpdateDelegate d)
 {
     this._transDelElements[id] = d;
 }
コード例 #22
0
 internal void RegisterSuccessfulDeleteHook(Autodesk.Revit.DB.ElementId id, DynElementUpdateDelegate d)
 {
     this._transDelElements[id] = d;
 }
コード例 #23
0
        protected override void OnEvaluate()
        {
            base.OnEvaluate();

            #region Register Elements w/ DMU

            var del = new DynElementUpdateDelegate(onDeleted);

            foreach (ElementId id in Elements)
                dynRevitSettings.Controller.RegisterDMUHooks(id, del);

            #endregion

            _runCount++;
        }