{"action":"created","issue":{"url":"https://api.github.com/repos/DynamoDS/DynamoRevit/issues/540","labels_url":"https://api.github.com/repos/DynamoDS/DynamoRevit/issues/540/labels{/name}","comments_url":"https://api.github.com/repos/DynamoDS/DynamoRevit/issues/540/comments","events_url":"https://api.github.com/repos/DynamoDS/DynamoRevit/issues/540/events","html_url":"https://github.com/DynamoDS/DynamoRevit/pull/540","id":96273160,"number":540,"title":"Add event handlers through a proxy for view or document events","user":{"login":"Randy-Ma","id":5584246,"avatar_url":"https://avatars.githubusercontent.com/u/5584246?v=3","gravatar_id":"","url":"https://api.github.com/users/Randy-Ma","html_url":"https://github.com/Randy-Ma","followers_url":"https://api.github.com/users/Randy-Ma/followers","following_url":"https://api.github.com/users/Randy-Ma/following{/other_user}","gists_url":"https://api.github.com/users/Randy-Ma/gists{/gist_id}","starred_url":"https://api.github.com/users/Randy-Ma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Randy-Ma/subscriptions","organizations_url":"https://api.github.com/users/Randy-Ma/orgs","repos_url":"https://api.github.com/users/Randy-Ma/repos","events_url":"https://api.github.com/users/Randy-Ma/events{/privacy}","received_events_url":"https://api.github.com/users/Randy-Ma/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/DynamoDS/DynamoRevit/labels/LGTM","name":"LGTM","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"ke-yu","id":2600379,"avatar_url":"https://avatars.githubusercontent.com/u/2600379?v=3","gravatar_id":"","url":"https://api.github.com/users/ke-yu","html_url":"https://github.com/ke-yu","followers_url":"https://api.github.com/users/ke-yu/followers","following_url":"https://api.github.com/users/ke-yu/following{/other_user}","gists_url":"https://api.github.com/users/ke-yu/gists{/gist_id}","starred_url":"https://api.github.com/users/ke-yu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ke-yu/subscriptions","organizations_url":"https://api.github.com/users/ke-yu/orgs","repos_url":"https://api.github.com/users/ke-yu/repos","events_url":"https://api.github.com/users/ke-yu/events{/privacy}","received_events_url":"https://api.github.com/users/ke-yu/received_events","type":"User","site_admin":false},"milestone":null,"comments":12,"created_at":"2015-07-21T09:39:35Z","updated_at":"2015-07-27T03:25:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/DynamoDS/DynamoRevit/pulls/540","html_url":"https://github.com/DynamoDS/DynamoRevit/pull/540","diff_url":"https://github.com/DynamoDS/DynamoRevit/pull/540.diff","patch_url":"https://github.com/DynamoDS/DynamoRevit/pull/540.patch"},"body":"### Purpose\r\n\r\nThe main purpose of this pull request is to avoid direct reference to the subscriber of several events: DocumentOpened, DocumentClosing, DocumentClosed, ViewActivating and ViewActivated.\r\n\r\nTo achieve this, a proxy class has been implemented which will contain six events and six member functions. The methods of the proxy object will be subscribed to the application events. The original subscriber will subscribe to the events of the proxy. The implementation of the six methods in the proxy will invoke the corresponding events.\r\n\r\nAdditionally OnApplicationIdle has been implemented which will be registered to the Idling event of the application. An public function: AddIdleAction is created so that it is possible to add some tasks which need to be run when the application is in an idle state.\r\n\r\n### Declarations\r\n\r\nCheck these if you believe they are true\r\n\r\n- [X] The code base is in a better state after this PR\r\n\r\n### Reviewers\r\n@ke-yu PTAL\r\n\r\n### FYIs\r\n@ikeough \r\n"},"comment":{"url":"https://api.github.com/repos/DynamoDS/DynamoRevit/issues/comments/125073441","html_url":"https://github.com/DynamoDS/DynamoRevit/pull/540#issuecomment-125073441","issue_url":"https://api.github.com/repos/DynamoDS/DynamoRevit/issues/540","id":125073441,"user":{"login":"Randy-Ma","id":5584246,"avatar_url":"https://avatars.githubusercontent.com/u/5584246?v=3","gravatar_id":"","url":"https://api.github.com/users/Randy-Ma","html_url":"https://github.com/Randy-Ma","followers_url":"https://api.github.com/users/Randy-Ma/followers","following_url":"https://api.github.com/users/Randy-Ma/following{/other_user}","gists_url":"https://api.github.com/users/Randy-Ma/gists{/gist_id}","starred_url":"https://api.github.com/users/Randy-Ma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Randy-Ma/subscriptions","organizations_url":"https://api.github.com/users/Randy-Ma/orgs","repos_url":"https://api.github.com/users/Randy-Ma/repos","events_url":"https://api.github.com/users/Randy-Ma/events{/privacy}","received_events_url":"https://api.github.com/users/Randy-Ma/received_events","type":"User","site_admin":false},"created_at":"2015-07-27T03:25:49Z","updated_at":"2015-07-27T03:25:49Z","body":"@ikeough \r\nIf following the same logic, we might need to move the class or some functions of DocumentManager, RevitSchedulerThread, or some others out as well. IMHO, we have to make a balance to achieve modulization. The RevitProxyHandler class only depends on Revit APIs and that is why I think it is better to make it stay at a lower level. Assuming when you are reviewing some code changes in DynamoRevitApp, you will never bother to see more code in RevitProxyHandler, and when you are merging the code and you will not bother to solve possible conflictions related to it, will that be nice? I will merge this first and I think we can continue discuss on this and make another submission to address this one."}}