public UserControl1(UIApplication _uiapp) { InitializeComponent(); uiapp = _uiapp; uidoc = uiapp.ActiveUIDocument; doc = uidoc.Document; my_binding_share_parameter = new E_BindingShareParameter(); e_binding_share_parameter = ExternalEvent.Create(my_binding_share_parameter); Function_Dau_Vao(); }
public void ShowWindow(UIApplication uiapp) { if (mainWindow == null) { BCFHandler handler = new BCFHandler(uiapp); ExternalEvent exEvent = ExternalEvent.Create(handler); mainWindow = new MainWindow(exEvent, handler); mainWindow.Closed += WindowClosed; mainWindow.Show(); } }
//---------------------------------------------------------- void register_external() { my_create = new E_Create(); e_create = ExternalEvent.Create(my_create); my_update = new E_Update(); e_update = ExternalEvent.Create(my_update); my_delete = new E_Delete(); e_delete = ExternalEvent.Create(my_delete); my_create_by_excel = new E_CreateByExcel(); e_create_by_excel = ExternalEvent.Create(my_create_by_excel); my_change_factor = new E_ChangeFactor(); e_change_factor = ExternalEvent.Create(my_change_factor); }
//-------------------------------------------------------------------------------------------------------------------------------------------------------------- public UserControl1(UIApplication _uiapp) { InitializeComponent(); uiapp = _uiapp; uidoc = uiapp.ActiveUIDocument; doc = uidoc.Document; my_update = new E_Update(); e_update = ExternalEvent.Create(my_update); Function_Dau_Vao(); }
public Autodesk.Revit.UI.Result OnStartup(Autodesk.Revit.UI.UIControlledApplication application) { Log.WriteLog("Revit启动"); ExportEventHandler handle = new ExportEventHandler(); ExternalEvent extEvent = ExternalEvent.Create(handle); exportEventForm = new ExportEventForm(extEvent); exportEventForm.Show(); exportEventForm.Visible = false; return(Result.Succeeded); }
/// <summary> /// Constructor /// </summary> public RevitExternalHandler(RevitAsyncSettings settings, IRevitContext revitContext) { this.revitContext = revitContext; this.name = settings.Name; if (settings.IsJournalable) { this.externalEvent = ExternalEvent.CreateJournalable(this); } else { this.externalEvent = ExternalEvent.Create(this); } }
public ModelessForm() { InitializeComponent(); //Initialize EventHandlers OnExportButtonParameter = new OnExportButton(); ExportActionParameter = ExternalEvent.Create(OnExportButtonParameter); OnSelectionButtonParameter = new OnSelectionButton(); SelectionActionParameter = ExternalEvent.Create(OnSelectionButtonParameter); // }
public MainWindow() { InitializeComponent(); this.Title += " " + APP.Version; this.m_Handler = new MainWindowRequestHandler(); this.m_ExEvent = ExternalEvent.Create(m_Handler); //窗口初始化大小 //this.Width = 330; //this.Height = 800; //窗口初始化后即加载所有数据 this.listBox.ItemsSource = CMD.TestList; }
public Template_ModelessForm(Document Doc) { // This call is required by the designer. InitializeComponent(); // Add any initialization after the InitializeComponent() call. //' ---------------------- this.StartPosition = FormStartPosition.CenterScreen; this.Doc = Doc; //' ------ 将所有的初始化工作完成后,执行外部事件的绑定 ---------------- // 新建一个外部事件实例 this.ExEvent = ExternalEvent.Create(this); }
public void ShowForm(BindingList <Raum> revitRaeume) { if (demoForm == null || demoForm.IsDisposed) { RaumdatenUpdater updateHandler = new RaumdatenUpdater(); LampenPlatzierer lampenHandler = new LampenPlatzierer(); ExternalEvent updateEvent = ExternalEvent.Create(updateHandler); ExternalEvent lampenEvent = ExternalEvent.Create(lampenHandler); demoForm = new FormMain(updateEvent, lampenEvent, revitRaeume); demoForm.Show(); } }
public bool Register <T>(T handler) where T : IExternalEventHandler { var type = typeof(T); lock (Events) { if (Events.ContainsKey(type)) { return(false); } Events.Add(type, new ExternalEventPair(ExternalEvent.Create(handler), handler)); return(true); } }
private void Initialise(object sender, Autodesk.Revit.UI.Events.IdlingEventArgs e) { UICtrlApp.Idling -= Initialise; AppInstance = sender as UIApplication; // Adds an event on doc open to check for streams and launch/focus speckle if any are present. AppInstance.Application.DocumentOpened += CheckForStreamsAndOpenSpeckle; // Set up bindings now as they subscribe to some document events and it's better to do it now SpeckleRevitCommand.Bindings = new ConnectorBindingsRevit(AppInstance); var eventHandler = ExternalEvent.Create(new SpeckleExternalEventHandler(SpeckleRevitCommand.Bindings)); SpeckleRevitCommand.Bindings.SetExecutorAndInit(eventHandler); }
/// <summary> /// Implementation of IUpdater.Execute method. /// </summary> void IUpdater.Execute(UpdaterData data) { // If there is any deleted elements, this updater need to be unregistered. if (data.GetDeletedElementIds().Count != 0) { // set the unregistered flag, // because it's not allowed to remove the executing updater. m_removeTheUpdater = true; } // Raise the External Event ExternalEvent exEvent = ExternalEvent.Create(this); exEvent.Raise(); }
public static void RunExternal() { // A new handler to handle request posting by the dialog m_ExHandler = new ExternalEventPL(); // External Event for the dialog to use (to post requests) m_ExEvent = ExternalEvent.Create(m_ExHandler); Thread _thread = new Thread(CheckForChanges); _thread.Start(); return; }
public ExternalEventsContainer() { ChangeViewHandler = new ExtEvntSetViewpoint(); ChangeViewEvent = ExternalEvent.Create(ChangeViewHandler); ChangeDocumentHandler = new ExtEvntSetBimbotData(); ChangeDocumentEvent = ExternalEvent.Create(ChangeDocumentHandler); RunServicesHandler = new ExtEvntRunServices(); RunServicesEvent = ExternalEvent.Create(RunServicesHandler); IfcImportHandler = new ExtEvntImportIfcSnippet(); IfcImportEvent = ExternalEvent.Create(IfcImportHandler); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { externalCommandData = commandData; ViewModelRoom viewModel = new ViewModelRoom(); ExternalEvent externalEvent = ExternalEvent.Create(viewModel); // Показать окно. ViewRoom u1 = new ViewRoom(externalEvent, commandData, viewModel); u1.Show(); return(Result.Succeeded); }
public Form1(UIDocument _uidoc) { InitializeComponent(); uidoc = _uidoc; handler = new Handler(); ood = new OOD(); ood.timespend = new double(); ood.number = new int(); handler.datagridview_ids = new List <string>(); externalevent = ExternalEvent.Create(handler); externalevent_ood = ExternalEvent.Create(ood); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIDocument uidoc = commandData.Application.ActiveUIDocument; Document doc = commandData.Application.ActiveUIDocument.Document; View activeview = uidoc.ActiveView; Level level = activeview.GenLevel; if (activeview.UpDirection.X != 0 || activeview.UpDirection.Z != 0) { TaskDialog.Show("wrong", "请在平面视图内使用"); } ExternalEventHandler handler = new ExternalEventHandler(); ExternalEvent exevent = ExternalEvent.Create(handler); bool iscontinue = true; do { DoorInformation doorinfo = GetDoorInfo(uidoc); if (doorinfo == null) { iscontinue = false; } else { Wall hostwall = GetHostWall(uidoc, doorinfo); if (hostwall == null) { TaskDialog.Show("wrong", "在找墙的时候遇到错误."); return(Result.Failed); } //creat door FamilyInstance door = null; using (Transaction transaction = new Transaction(doc)) { transaction.Start("create the door"); door = doc.Create.NewFamilyInstance(doorinfo.door_location, doorinfo.door_symbol, hostwall, level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural); transaction.Commit(); } } } while (iscontinue); return(Result.Succeeded); }
/// <summary> /// Open a window to let the user enter python code. /// </summary> /// <returns></returns> public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { var messageCopy = message; var gui = new IronPythonConsole(); gui.consoleControl.WithConsoleHost((host) => { // now that the console is created and initialized, the script scope should // be accessible... new ScriptExecutor(RevitPythonShellApplication.GetConfig(), commandData, messageCopy, elements) .SetupEnvironment(host.Engine, host.Console.ScriptScope); host.Console.ScriptScope.SetVariable("__window__", gui); // run the initscript var initScript = RevitPythonShellApplication.GetInitScript(); if (initScript != null) { var scriptSource = host.Engine.CreateScriptSourceFromString(initScript, SourceCodeKind.Statements); scriptSource.Execute(host.Console.ScriptScope); } }); var commandCompletedEvent = new AutoResetEvent(false); var externalEventHandler = new IronPythonExternalEventDispatcher(gui, commandCompletedEvent); var externalEvent = ExternalEvent.Create(externalEventHandler); gui.consoleControl.WithConsoleHost((host) => { var oldDispatcher = host.Console.GetCommandDispatcher(); host.Console.SetCommandDispatcher((command) => { //externalEventHandler.Enqueue(() => oldDispatcher(command)); externalEventHandler.Enqueue(command); externalEvent.Raise(); commandCompletedEvent.WaitOne(); }); host.Editor.SetCompletionDispatcher((command) => { externalEventHandler.Enqueue(command); externalEvent.Raise(); commandCompletedEvent.WaitOne(); }); }); gui.Topmost = true; gui.Title = "RevitPythonShell (non-modal)"; gui.Show(); return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication a) { a.CreateRibbonTab("Familien Browser"); //Familien Browser Families Browser RibbonPanel G17 = a.CreateRibbonPanel("Familien Browser", "Familien Browser"); string path = Assembly.GetExecutingAssembly().Location; SingleInstallEvent handler = new SingleInstallEvent(); ExternalEvent exEvent = ExternalEvent.Create(handler); DockPanel dockPanel = new DockPanel(exEvent, handler); DockablePaneId dpID = new DockablePaneId(new Guid("FA0C04E6-F9E7-413A-9D33-CFE32622E7B8")); a.RegisterDockablePane(dpID, "Familien Browser", (IDockablePaneProvider)dockPanel); PushButtonData btnShow = new PushButtonData("ShowPanel", "Panel\nanzeigen", path, "zRevitFamilyBrowser.Revit_Classes.ShowPanel"); //Panel anzeigen ShowPanel btnShow.LargeImage = Tools.GetImage(Resources.IconShowPanel.GetHbitmap()); RibbonItem ri1 = G17.AddItem(btnShow); PushButtonData btnFolder = new PushButtonData("OpenFolder", "Verzeichnis\nöffnen", path, "zRevitFamilyBrowser.Revit_Classes.FolderSelect"); //Verzeichnis öffnen btnFolder.LargeImage = Tools.GetImage(Resources.OpenFolder.GetHbitmap()); RibbonItem ri2 = G17.AddItem(btnFolder); PushButtonData btnSpace = new PushButtonData("Space", "Grid Elements\nInstall", path, "zRevitFamilyBrowser.Revit_Classes.Space"); btnSpace.LargeImage = Tools.GetImage(Resources.Grid.GetHbitmap()); btnSpace.ToolTip = "1. Select item form browser.\n2. Pick room in project\n3. Adjust item position and quantity."; RibbonItem ri3 = G17.AddItem(btnSpace); G17.AddSeparator(); PushButtonData btnSettings = new PushButtonData("Settings", "Settings", path, "zRevitFamilyBrowser.Revit_Classes.Settings"); btnSettings.LargeImage = Tools.GetImage(Resources.settings.GetHbitmap()); RibbonItem ri4 = G17.AddItem(btnSettings); // a.ControlledApplication.DocumentChanged += OnDocChanged; a.ControlledApplication.DocumentOpened += OnDocOpened; a.ViewActivated += OnViewActivated; if (File.Exists(Properties.Settings.Default.SettingPath)) { Properties.Settings.Default.RootFolder = File.ReadAllText(Properties.Settings.Default.SettingPath); Properties.Settings.Default.Save(); } return(Result.Succeeded); }
public void ShowForm(BindingList <Raum> revitRaeume, BindingList <Feuerloescher> feuerlocherList) { // If we do not have a dialog yet, create and show it if (revitAppForm == null || revitAppForm.IsDisposed) { RaumdatenUpdater updateHandler = new RaumdatenUpdater(); //Update Raumdaten FeuerloescherPlatzierer feuerloescherHandler = new FeuerloescherPlatzierer(); //Plazierung Feuerloescher ExternalEvent updateEvent = ExternalEvent.Create(updateHandler); ExternalEvent feuerloescherEvent = ExternalEvent.Create(feuerloescherHandler); revitAppForm = new FormMain(updateEvent, feuerloescherEvent, feuerlocherList, revitRaeume); revitAppForm.Show(); } }
//public QuickFilterViewModel(UIDocument uidoc) //{ // Doc = uidoc.Document; // UiDoc = uidoc; // Initialize(); //} public QuickFilterViewModel(ExternalCommandData commandData) { QuickFilterHandler handler = new QuickFilterHandler(); ExEvent = ExternalEvent.Create(handler); handler.ViewModel = this; uiapp = commandData.Application; uidoc = uiapp.ActiveUIDocument; app = uiapp.Application; doc = uidoc.Document; Initialize(); ShowWindow(commandData); }
/// <summary> /// Create and Show new ElementEditorForm /// </summary> /// <param name="commandData"></param> public void CreateForm(ExternalCommandData commandData) { // create ExternalEventHandler for Edit parameters ParaEditEventHandler handler = new ParaEditEventHandler(); ExternalEvent paraEditEvent = ExternalEvent.Create(handler); handler.ParaEditEvent = paraEditEvent; // create element editor form elementEditorForm = new ElementEditorForm(commandData, handler); handler.ElementEditorForm = elementEditorForm; elementEditorForm.Show(); }
public Form1() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); myEE7Parameter = new ButtonEE7Parameter(); myEE7ActionParameter = ExternalEvent.Create(myEE7Parameter); mylinePatternsWeightsFalse = new linePatternsWeightsFalse(); myMakeLinePatterns = ExternalEvent.Create(mylinePatternsWeightsFalse); mylinePatternsWeightsTrue = new linePatternsWeightsTrue(); myMakeLineWeights = ExternalEvent.Create(mylinePatternsWeightsTrue); // }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { try { UIApplication uiApplication = commandData.Application; UIDocument uiDocument = uiApplication.ActiveUIDocument; Document document = uiDocument.Document; //过滤项目中是否存在房间,标高和楼板类型等必要信息 List <Element> rooms = FilterRoom(document); if (rooms.Count == 0) { TaskDialog.Show("Error", "没有发现房间!"); return(Result.Failed); } List <Element> levels = FilterLevel(document); if (levels.Count == 0) { TaskDialog.Show("Error", "没有发现标高!"); return(Result.Failed); } List <Element> floorType = FilterFloorType(document); if (floorType.Count == 0) { TaskDialog.Show("Error", "没有发现楼板类型!"); return(Result.Failed); } //存在则创建外部事件同时弹出交互对话框,输入相关数据信息 CreateFloorEventHandler createFloorEventHandler = new CreateFloorEventHandler(); externalEvent = ExternalEvent.Create(createFloorEventHandler); FloorOption floorOption = new FloorOption(rooms, floorType, levels); floorOption.ExEvent = externalEvent; floorOption.EventHandler = createFloorEventHandler; //floorOption.b_Apply.Click += Click_b_Apply; floorOption.Show(); return(Result.Succeeded); } catch (Exception e) { message = e.Message + "\nTargetSite:" + e.TargetSite.ToString() + "\nStackTrace:" + e.StackTrace; return(Result.Failed); } }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { //if (IsInDesignMode) //{ // WindowTitle = "design-mode title"; // Progress = 25; //} //else //{ // WindowTitle = " run model title"; // Task.Delay(2000).ContinueWith(t => // { // while (Progress < 100) // { // Progress += 5; // Task.Delay(500).Wait(); // } // }); //} WindowTitle = "Paste TextNote From Clipboard"; Task.Delay(500).ContinueWith(t => { while (Progress < 100) { Progress += 15; Task.Delay(100).Wait(); } }); DwgList = new ObservableCollection <Model.DWGcontainer>(); handler = new Model.RequestHandler(); exEvent = ExternalEvent.Create(handler); uidoc = Command._activeRevitUIDoc; TextWidth = 1.2; LeaderLength = 3; SelectCommand = new RelayCommand(() => HandleSelect()); OpenCommand = new RelayCommand(() => OpenView()); ZoomCommand = new RelayCommand(() => Zoom()); DeleteCommand = new RelayCommand(() => DeleteDWG()); //ListCollectionView collectionView = new ListCollectionView(employees); }
public Result Execute(UIApplication uiapp) { thisCmd = this; //For Each action that requires change in Revit DB (open transaction) //Initialize new instance of Event Handler //Assign Event Handler instance to ExEvent #region Assigning Handlers to ExEvents #region GENERIC EventHandler_Generic_GoToView handler_Generic_GoToView = new EventHandler_Generic_GoToView(); this.ExEvent_Generic_GoToView = ExternalEvent.Create(handler_Generic_GoToView); EventHandler_Generic_ZoomViewToElement handler_Generic_ZoomViewToElement = new EventHandler_Generic_ZoomViewToElement(); this.ExEvent_Generic_ZoomViewToElement = ExternalEvent.Create(handler_Generic_ZoomViewToElement); EventHandler_Generic_RemoveInstance handler_Generic_RemoveInstance = new EventHandler_Generic_RemoveInstance(); this.ExEvent_Generic_RemoveInstance = ExternalEvent.Create(handler_Generic_RemoveInstance); #endregion #region REVISIONS EventHandler_Revision_Issued handler_Revision_Issued = new EventHandler_Revision_Issued(); this.ExEvent_Revision_Issued = ExternalEvent.Create(handler_Revision_Issued); EventHandler_Revision_Visibility handler_Revision_Visibility = new EventHandler_Revision_Visibility(); this.ExEvent_Revision_Visibility = ExternalEvent.Create(handler_Revision_Visibility); EventHandler_Revision_ChangeComment handler_Revision_ChangeComment = new EventHandler_Revision_ChangeComment(); this.ExEvent_Revision_ChangeComment = ExternalEvent.Create(handler_Revision_ChangeComment); EventHandler_Revision_ChangeRevDescription handler_Revision_ChangeRevDescription = new EventHandler_Revision_ChangeRevDescription(); this.ExEvent_Revision_ChangeRevDescription = ExternalEvent.Create(handler_Revision_ChangeRevDescription); EventHandler_Revision_NewRevision handler_Revision_NewRevision = new EventHandler_Revision_NewRevision(); this.ExEvent_Revision_NewRevision = ExternalEvent.Create(handler_Revision_NewRevision); EventHandler_Revision_HideAllButThis handler_Revision_HideAllButThis = new EventHandler_Revision_HideAllButThis(); this.ExEvent_Revision_HideAllButThis = ExternalEvent.Create(handler_Revision_HideAllButThis); EventHandler_Revision_Reorder handler_Revision_Reorder = new EventHandler_Revision_Reorder(); this.ExEvent_Revision_Reorder = ExternalEvent.Create(handler_Revision_Reorder); #endregion #endregion Registered = true; return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication application) { string tabName = "IFC"; RibbonControl myRibbon = ComponentManager.Ribbon; RibbonTab ggTab = null; foreach (RibbonTab tab in myRibbon.Tabs) { if (string.Compare(tab.Id, tabName, true) == 0) { ggTab = tab; break; } } if (ggTab == null) { application.CreateRibbonTab(tabName); } Autodesk.Revit.UI.RibbonPanel rp = application.CreateRibbonPanel(tabName, "Browser"); PushButtonData pbd = new PushButtonData("propBrowser", "Ifc Property Browser", Assembly.GetExecutingAssembly().Location, "RevitIfcPropertyBrowser.ShowBrowser"); pbd.ToolTip = "Show Property Browser"; rp.AddItem(pbd); DockablePaneProviderData data = new DockablePaneProviderData(); Browser browser = new Browser(); data.FrameworkElement = browser as System.Windows.FrameworkElement; data.InitialState = new DockablePaneState(); data.InitialState.DockPosition = DockPosition.Tabbed; mPropertyPanel = new DockablePaneId(new Guid("{C7C70722-1B9B-4454-A054-DFD142F23580}")); application.RegisterDockablePane(mPropertyPanel, "IFC Properties", browser); foreach (RibbonTab tab in ComponentManager.Ribbon.Tabs) { if (tab.Id == "Modify") { tab.PropertyChanged += PanelEvent; break; } } RequestHandler handler = new RequestHandler(browser); mExEvent = ExternalEvent.Create(handler); application.ControlledApplication.DocumentChanged += handler.ControlledApplication_DocumentChanged; return(Result.Succeeded); }
internal void ShowBeamsUpdateUI() { if (beamsUpdateWindow == null || beamsUpdateWindow.isShowned == false) { if (uiApp != null) { uiApp.ViewActivated += BeamsUpdate_ViewActivated; } requestBeamsUpdateHandler = new RequestBeamsUpdateHandler(); externalBeamsUpdateEvent = ExternalEvent.Create(requestBeamsUpdateHandler); beamsUpdateWindow = new BeamsUpdateUI(externalBeamsUpdateEvent, requestBeamsUpdateHandler); beamsUpdateWindow.Show(); } }
void OnApplicationInitialized( object sender, ApplicationInitializedEventArgs e) { // Create our custom external event. _event = ExternalEvent.Create( new ModificationLogger()); // Start a thread to raise it regularly. _thread = new Thread( TriggerModificationLogger); _thread.Start(); }