forked from DmytroSE/RevitApi-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WPF and EventHandler
33 lines (25 loc) · 920 Bytes
/
WPF and EventHandler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# pylint: skip-file
from pyrevit import forms
from pyrevit import revit, DB, UI
from pyrevit.framework import Input
from pyrevit import script
__persistentengine__ = True
class NonModalWindow(forms.WPFWindow):
def __init__(self):
pass
def setup(self):
self.update_ui()
@revit.events.handle('doc-changed', 'doc-closed', 'doc-opened', 'view-activated')
def uiupdator_eventhandler(sender, args):
ui.update_ui()
def update_ui(self):
if revit.doc:
#type the code here to update the user interface
print('ok')
def window_moving(self, sender, args):
if args.ChangedButton == Input.MouseButton.Left:
self.DragMove()
def window_closing(self, sender, args): #pylint: disable=unused-argument
revit.events.stop_events()
ui = script.load_ui(NonModalWindow(), ui_file='sensors.xaml')
ui.show(modal=__shiftclick__)