public static bool PaneExists(this UIControlledApplication application, Guid id, out DockablePane pane) { var dPid = new DockablePaneId(id); if (DockablePane.PaneExists(dPid)) { pane = application.GetDockablePane(dPid); return true; } pane = null; return false; }
private void mnuOnlineBlocks_Click(object sender, RoutedEventArgs e) { OnlineBlocksFolder onl = new OnlineBlocksFolder(Connection); IBlocksFolder fld = (IBlocksFolder)onl; DockableContentBlockList tmp = new DockableContentBlockList(fld); tmp.parentDockingManager = DockManager; tmp.Title = fld.ToString(); tmp.ToolTip = fld.ToString(); tmp.Show(DockManager); tmp.ToggleAutoHide(); //Set size of the parent DockablePane (it's automaticly been created!) DockablePane tmpPane = tmp.TryFindParent <DockablePane>(); ResizingPanel.SetEffectiveSize(tmpPane, new Size(350, 0)); DockManager.ActiveDocument = tmp; }
public static void Init(UIApplication uiApp) { DockablePane toolPalettePane = null; DockablePaneId toolPaletteId = new DockablePaneId(new Guid("{D7C963CE-B7CA-426A-8D51-6E8254D21258}")); try { toolPalettePane = uiApp.GetDockablePane(toolPaletteId); } catch (Exception ex) { toolPalettePane = null; } if (toolPalettePane == null) { KbBimstoreApp.CreateToolPalette(KbBimstoreApp.activeUiContApp); } try { toolPalettePane = uiApp.GetDockablePane(toolPaletteId); } catch (Exception ex) { toolPalettePane = null; } if (toolPalettePane != null) { try { KbBimstoreApp.ToolPaletUI.init(uiApp); toolPalettePane.Show(); } catch (Exception ex) { Autodesk.Revit.UI.TaskDialog.Show("Exception", ex.Message); } } }
/// <summary> /// This is the method which launches the WPF window, and injects any methods that are /// wrapped by ExternalEventHandlers. This can be done in a number of different ways, and /// implementation will differ based on how the WPF is set up. /// </summary> /// <param name="uiapp">The Revit UIApplication within the add-in will operate.</param> public void ShowForm(ExternalCommandData commandData) { DockablePane myForm = commandData.Application.GetDockablePane(paneId); // If we do not have a dialog yet, create and show it if (myForm != null && myForm == null) { return; } //EXTERNAL EVENTS WITH ARGUMENTS //EXTERNAL EVENTS WITH ARGUMENTS EventHandlerMethodPropertiesOnOff evP = new EventHandlerMethodPropertiesOnOff(); EventHandlerMethodProjectBrowserOnOff evPB = new EventHandlerMethodProjectBrowserOnOff(); // The dialog becomes the owner responsible for disposing the objects given to it. //myForm = new NewForm(evP, evPB); myForm.Show(); }
private void myConnectionsList_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (myConnectionsList.SelectedItem != null) { OnlineBlocksFolder onl = new OnlineBlocksFolder((string)myConnectionsList.SelectedItem); IBlocksFolder fld = (IBlocksFolder)onl; DockableContentBlockList tmp = new DockableContentBlockList(fld); tmp.parentDockingManager = parentDockingManager; tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1); tmp.ToolTip = fld.ToString(); tmp.Show(parentDockingManager); tmp.ToggleAutoHide(); //Set size of the parent DockablePane (it's automaticly been created!) DockablePane tmpPane = tmp.TryFindParent <DockablePane>(); ResizingPanel.SetEffectiveSize(tmpPane, new Size(350, 0)); parentDockingManager.ActiveDocument = tmp; } }
private void BtnReplace_Click(object sender, RoutedEventArgs e) { //Make sure there are rows in the Data Table to change if (SheetTable.Rows.Count > 0) { //Use a Try block to keep any errors from crashing Revit try { //Use a transaction to modify the Document Database using (Transaction Trans = new Transaction(doc)) { //Start and Name the transaction to show up in the Undo List Trans.Start("Sheet Find Replace"); //Iterate through each row to rename as needed foreach (DataRow row in SheetTable.Rows) { //Cast the ElmentId from the SheetId column of the data Table ViewSheet sheet = doc.GetElement((ElementId)row["SheetId"]) as ViewSheet; //Change the name sheet.Name = (string)row["Preview"]; } //Commit the Transaction to keep the changes Trans.Commit(); } //Refresh the Project Browser by getting the DockablePaneId, DockablePane, and "Showing" it DockablePaneId dpId = DockablePanes.BuiltInDockablePanes.ProjectBrowser; DockablePane dP = new DockablePane(dpId); dP.Show(); //Set the Dialog result so the calling command knows the form completed successfuly DialogResult = true; //Close the form Close(); } //Catch any errors and display a Dialog with the informaiton catch (Exception ex) { TaskDialog.Show("Rename Error", ex.ToString() + " : " + ex.InnerException); } } }
/// <summary> /// Method that makes Dockable Window Active /// </summary> private void ShowDocakbleWindow() { //Acquire UIApplication instance from ThisApplication class UIApplication uiapp = ThisApplication.thisApp.uiapp; //skip if uiapp is not assigned if (uiapp == null) { return; } if ((Cmd_RegisterEvents.thisCmd != null) && (Cmd_RegisterEvents.Registered == true)) { DockablePane dp = uiapp.GetDockablePane(Cmd_RegisterDockableWindow.dpid); dp.Show(); } else { TaskDialog.Show("Cmd_ShowDockableWindow", "DockablePane not Registered. Will not be displayed"); } }
private void Close(object sender, RoutedEventArgs e) { string guid = "ef5b0ecc-5859-4642-bb27-769393383d99"; Guid retval = Guid.Empty; try { retval = new Guid(guid); } catch (Exception) { } UIApplication app; DockablePaneId sm_UserDockablePaneId = new DockablePaneId(retval); RevitRedevelop.UserInfoDockablePane userInfo = new UserInfoDockablePane(); app = userInfo.getUIApp(); DockablePane pane = app.GetDockablePane(sm_UserDockablePaneId); //pane.Hide(); //Console.WriteLine("close"); }
private void OnViewActivated(object sender, ViewActivatedEventArgs e) { try { //éę°ęå¼č§å¾åéčPanel DockablePane panel = m_uiApp.GetDockablePane(new DockablePaneId(ElementInfoPanel.GetInstance().Id)); if (panel != null) { ElementInfoPanel.GetInstance().Update(new InfoEntityData()); panel.Hide(); } DockablePane imageControl = m_uiApp.GetDockablePane(new DockablePaneId(ImageControl.Instance().Id)); if (imageControl != null) { imageControl.Hide(); } } catch (System.Exception ex) { Debug.WriteLine(ex.Message); } }
public Result OnStartup(UIControlledApplication a) { //a.ViewActivated += OnViewActivated; MyDockablePaneControl = new Controls.Control1() { DataContext = new Controls.Control1ViewModel(a) }; //Controls.Control1ViewModel dockablePaneViewModel = // new Controls.Control1ViewModel(); // //MyDockablePaneControl.DataContext = dockablePaneViewModel; if (!DockablePane.PaneIsRegistered(Controls.Control1.PaneId)) { a.RegisterDockablePane(Controls.Control1.PaneId, Controls.Control1.PaneName, MyDockablePaneControl); } return(Result.Succeeded); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; LoginView loginView = new LoginView() { DataContext = new LoginViewModel(uiapp) }; loginView.ShowDialog(); if (AuthProvider.Instance.IsAuthenticated == true) { DockablePaneId dpid = new DockablePaneId(new Guid(Properties.Resources.PaletteGuid)); DockablePane dp = commandData.Application.GetDockablePane(dpid); dp.Show(); } return(Result.Succeeded); }
// public static ChromiumWebBrowser Browser; public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements) { // Settings Helper Class // NOTE: You can use the AppMain.Settings throughout project to access active Revit Document, UIDocument, Application, etc. AppMain.Settings = new SettingsHelper(commandData); // SHOW DOCKABLE WINDOW DockablePaneId m_dpID = GlobalHelper.MainDockablePaneId; DockablePane m_dp = commandData.Application.GetDockablePane(m_dpID); var path = Directory.GetParent(Assembly.GetExecutingAssembly().Location); Debug.WriteLine(path, "SPK"); var indexPath = string.Format(@"{0}\app\index.html", path); if (!File.Exists(indexPath)) { Debug.WriteLine("Speckle for Revit: Error. The html file doesn't exists : {0}", "SPK"); } indexPath = indexPath.Replace("\\", "/"); AppMain.MainDock.webBrowser.Source = new Uri(indexPath); m_dp.Show(); // initialise one browser instance //InitializeChromium(); //var form = new SpeckleRevitForm(); //form.Controls.Add(Browser); //form.Show(); return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication application) { var container = CommandContainer.Instance(); if (container.Valid) { container.BuildRibbon(application); } var dPid = new DockablePaneId(DockConstants.Id); if (!DockablePane.PaneIsRegistered(dPid)) { var state = new DockablePaneState { DockPosition = DockPosition.Right }; var element = new DockPage(); application.RegisterDockablePane(DockConstants.Id, DockConstants.Name, element, state); } return(Result.Succeeded); }
void addChart(Researcher researcher, Collectible collectible, ItemsControl charts) { var simulator = researcher.simulator; var bars = collectible.barsMaybe(); if (bars == null) { return; } var chartAdded = false; runOnGuiThread(() => { var chart = new BarSpudGraph(bars, collectible, this); Objects.each(researcher.plots.get(collectible), chart.add); chart.add(Objects.accept(researcher.positions, collectible.collects), Objects.accept(researcher.trades, collectible.collects), simulator); chart.addEquity(simulator); chart.moveBarsToBack(); chart.resetYAxis(); var symbolPane = new DockablePane(); charts.Items.Add(new DockableContent { Title = title(collectible.name), Content = symbolPane }); symbolPane.Items.Add(new DockableContent { Title = title(collectible.name + " Plots"), Content = new WindowsFormsHost { Child = chart } }); var dataGrid = new QDataTableGrid(); var dataTable = chart.makeDataTable(); dataGrid.populateFromDataTable(dataTable); symbolPane.Items.Add(new DockableContent { Title = title(collectible.name + " Data"), Content = dataGrid }); chartAdded = true; }); Objects.wait(400, 50, () => chartAdded); }
public ContentArea(DockArea dockArea) { DockArea = dockArea; //DockingManager = new DockingManager { Name = dockArea.ToString() }; DockableContentList = new List <DockableContent>(); DockablePane = new DockablePane { Name = dockArea.ToString(), HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch, // ItemsSource = DockableContentList }; //DockableContentPane = new DockableContent { Content = DockablePane, Name = dockArea.ToString() }; //DockableContent = new ContainerDockableContent //{ // //Name = DockingManager.Name, // //Title = DockingManager.Name, // //Content = DockingManager, // Focusable = true, // DockableStyle = DockableStyle.Dockable, // HideOnClose = false, // DockArea = dockArea, // HorizontalAlignment = HorizontalAlignment.Stretch, // HorizontalContentAlignment = HorizontalAlignment.Stretch, // VerticalAlignment = VerticalAlignment.Stretch, // VerticalContentAlignment = VerticalAlignment.Stretch //}; DockablePane.SetValue(DockablePane.AnchorPropertyKey, AnchorStyle.Bottom); //DockablePane.Items.Add(DockableContent); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiApp = commandData.Application; Application app = uiApp.Application; Document doc = uiApp.ActiveUIDocument.Document; // Create the Family Browser dock panel registered on startup DockablePaneId dpId = new DockablePaneId(new Guid("{22827024-7B1A-4D88-80A5-1A8E894F1057}")); DockablePane dockFamilyBrowser = commandData.Application.GetDockablePane(dpId); // Toggle the dock panel visibility if (dockFamilyBrowser.IsShown()) { dockFamilyBrowser.Hide(); } else { dockFamilyBrowser.Show(); } string path = RevitDirectories.RevitContentPath(app); return(Result.Succeeded); }
public void AlignButtonState(UIApplication application) { DockablePaneId dpid = new DockablePaneId(new Guid("{C38746CB-C632-4C88-9556-4DAEDB1A6E97}")); //Avoids an error when the user cancels document loading if (DockablePane.PaneExists(dpid)) { DockablePane dp = application.GetDockablePane(dpid); //we are just checking current dock panel state. If it is visible then button is active (green) and the text says "Hide" because it will hide the panel on click. //if the panel is not shown then image is inactive (grey) and text says "Show" if (dp.IsShown()) { _button_medium.ItemText = "Hide Medium"; PushButton pb = _button_medium as PushButton; pb.LargeImage = GetEmbeddedImage("Resources.Active.png"); } else { _button_medium.ItemText = "Show Medium"; PushButton pb = _button_medium as PushButton; pb.LargeImage = GetEmbeddedImage("Resources.Inactive.png"); } } }
/// <summary> /// Show dockable panes when view active. /// </summary> void application_ViewActivated(object sender, Autodesk.Revit.UI.Events.ViewActivatedEventArgs e) { if (!DockablePane.PaneExists(DefaultFamilyTypes.PaneId) || !DockablePane.PaneExists(DefaultElementTypes.PaneId)) { return; } UIApplication uiApp = sender as UIApplication; if (uiApp == null) { return; } if (DefaultFamilyTypesPane != null) { DefaultFamilyTypesPane.SetDocument(e.Document); } if (DefaultElementTypesPane != null) { DefaultElementTypesPane.SetDocument(e.Document); } }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { var dpid = new DockablePaneId(Guid.Parse("0f0f25f5-712d-4b37-ac50-45ed901e77fc")); if (!DockablePane.PaneIsRegistered(dpid)) { TaskDialog.Show("Test panel", "Not Registered!"); } else { var dp = commandData.Application.GetDockablePane(dpid); if (dp.IsShown()) { dp.Hide(); } else { dp.Show(); } } return(Result.Succeeded); }
InstallBasTextEditor AddEditor(string InstallBasAction) { ManagedContent mc = null; if (DockMan.ActiveContent == null) { mc = DockMan.DockableContents.First(); } else { mc = DockMan.ActiveContent; } DockablePane cPane = mc.ContainerPane as DockablePane; string dc_Name = "editor_" + (VM.Editors.Count + 1).ToString(); DockableContent dc_prev = null; foreach (var item in cPane.Items) { dc_prev = item as DockableContent; if (dc_prev.Name.Equals(dc_Name)) { break; } else { dc_prev = null; } } if (dc_prev != null) { dc_Name += "_" + cPane.Items.Count.ToString(); } DockableContent dc = new DockableContent(); dc.Name = dc_Name; dc.Title = dc_Name; cPane.Items.Add(dc); InstallBasTextEditor bas = new InstallBasTextEditor(); bas.VM.SyntaxHighlighting = "VBNET"; bas.VM.Font = "Consolas"; bas.VM.FontSize = 12; bas.VM.CurrentFileName = dc_Name; if (!String.IsNullOrEmpty(InstallBasAction)) { if (InstallBasAction.Equals(MainWindowViewModel.TOOLBAR_ADD_BAS_ADD_INSTALL)) { bas.VM.InstallBas(); } else if (InstallBasAction.Equals(MainWindowViewModel.TOOLBAR_ADD_BAS_ADD_REMOVE)) { bas.VM.RemoveBas(); } } dc.Content = bas; dc.Closing += delegate(object sender, CancelEventArgs e) { this.VM.ActiveEditor.IsActive = false; this.VM.Editors.Remove(bas.VM); }; dc.Activate(); this.VM.Editors.Add(bas.VM); bas.VM.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { if (e.PropertyName.Equals("CurrentFileName")) { dc.Title = Path.GetFileName(bas.VM.CurrentFileName); } }; return(bas); }
public MainWindowViewModel(DockingManager dockingManager, ResizingPanel horizontalResizingPanel, ResizingPanel verticalResizingPanel, DockablePane tabsPane) { this.dockingManager = dockingManager; dockingManager.ActiveDocumentChanged += delegate(object sender, EventArgs args) { this.UpdateViews(); }; this.toolboxControl = new ToolboxControl(); this.InitialiseToolbox(); this.horizontalResizingPanel = horizontalResizingPanel; this.verticalResizingPanel = verticalResizingPanel; this.tabsPane = tabsPane; this.dockableContents = new Dictionary <ContentTypes, DockableContent>(); this.ViewToolbox(); string disableDebugViewOutputValue = ConfigurationManager.AppSettings["DisableDebugViewOutput"]; if (!string.IsNullOrEmpty(disableDebugViewOutputValue)) { this.disableDebugViewOutput = bool.Parse(disableDebugViewOutputValue); } }
private void CreateOrUnhideDockableContent(ContentTypes contentType, string title, string viewPropertyName, object parent) { if (!this.dockableContents.Keys.Contains(contentType)) { DockableContent dockableContent = new DockableContent(); ContentControl contentControl = new ContentControl(); dockableContent.IsCloseable = true; dockableContent.HideOnClose = false; dockableContent.Title = title; dockableContent.Content = contentControl; if (parent is ResizingPanel) { DockablePane dockablePane = new DockablePane(); dockablePane.Items.Add(dockableContent); ResizingPanel resizingPanel = parent as ResizingPanel; switch (contentType) { case ContentTypes.PropertyInspector: resizingPanel.Children.Add(dockablePane); ResizingPanel.SetResizeWidth(dockablePane, new GridLength(300)); break; case ContentTypes.Outline: resizingPanel.Children.Insert(1, dockablePane); ResizingPanel.SetResizeWidth(dockablePane, new GridLength(250)); break; case ContentTypes.Toolbox: resizingPanel.Children.Insert(0, dockablePane); ResizingPanel.SetResizeWidth(dockablePane, new GridLength(250)); break; } } else if (parent is DockablePane) { DockablePane dockablePane = parent as DockablePane; dockablePane.Items.Add(dockableContent); if (dockablePane.Parent == null) { this.verticalResizingPanel.Children.Add(dockablePane); } } Binding dataContextBinding = new Binding(viewPropertyName); dockableContent.SetBinding(DockableContent.DataContextProperty, dataContextBinding); Binding contentBinding = new Binding("."); contentControl.SetBinding(ContentControl.ContentProperty, contentBinding); this.dockableContents[contentType] = dockableContent; dockableContent.Closed += delegate(object sender, EventArgs args) { contentControl.Content = null; this.dockableContents[contentType].DataContext = null; this.dockableContents.Remove(contentType); }; } else { if (this.dockableContents[contentType].State == DockableContentState.Hidden) { this.dockableContents[contentType].Show(); } } }
/// <summary> /// Return dockable pane inforamtion, given a DockablePaneId /// </summary> public static string GetPaneSummary(DockablePane pane) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.AppendLine("-RevitDockablePane- Title: " + pane.GetTitle() + ", Id-Guid: " + pane.Id.Guid.ToString()); return(sb.ToString()); }
public void SetWindowAvibilable(Autodesk.Revit.UI.UIApplication uiApp) { DockablePane pane = uiApp.GetDockablePane(new DockablePaneId(APIUntil.m_GUID)); pane.Show(); }
void addPositionsTab(Researcher researcher, ItemsControl charts) { var simulator = researcher.simulator; var positionsPane = new DockablePane(); var dataGrid = new QDataTableGrid(); var table = new QDataTable("symbol", "entryTime", "exitTime", "direction") { { "initialSize", typeof(int) }, { "pnl", typeof(double) }, { "barsHeld", typeof(int) }, { "numTrades", typeof(int) }, { "positionHIDDEN", typeof(Position) } }; var panel = new QDockPanel(); positionsPane.Items.Add(new DockableContent { Title = title("Position List"), Content = panel }); charts.Items.Add(new DockableContent { Title = title("Positions"), Content = positionsPane }); var controlGrid = new QGrid(); controlGrid.addColumns(3); controlGrid.add(withLabel("S_ymbol", new QComboBox("ALL", selected => table.filter("symbol", selected), markets())), 0); controlGrid.add(withLabel("_Direction", new QComboBox("ALL", selected => table.filter("direction", selected), Objects.list("long", "short"))), 1); controlGrid.add(withLabel("_P&L", new QComboBox("ALL", selected => table.filter <double>("pnl", value => pnlMatchesSelection(selected, value)), Objects.list("winning", "losing"))), 2); panel.add(controlGrid, Dock.Top); panel.add(dataGrid, Dock.Bottom); Action <DataRow, Position> updateRow = (row, position) => { row["symbol"] = position.symbol.name; row["entryTime"] = Objects.ymdHuman(position.entry().time); row["exitTime"] = position.isClosed() ? Objects.ymdHuman(position.exitTrade().time) : "Open"; row["direction"] = position.entry().direction.ToString(); row["initialSize"] = position.entry().size; row["pnl"] = position.isClosed() ? position.pnl(true, simulator.runInNativeCurrency()) : simulator.pnlForPosition(position); row["barsHeld"] = position.barsHeld(); row["numTrades"] = position.trades().Count; row["positionHIDDEN"] = position; }; Converter <Position, DataRow> newRow = position => { var row = table.NewRow(); updateRow(row, position); return(row); }; Objects.each(Objects.reverse(researcher.positions), position => table.add(newRow(position))); dataGrid.populateFromDataTable(table); dataGrid.AutoGeneratedColumns += rightJustifyColumns; simulator.addNewTradeListener((position, trade) => runOnGuiThread(() => { if (position.isEntry(trade)) { table.addAtStart(newRow(position)); } else { updateRow(table.firstRow("positionHIDDEN", position), position); } })); addFilteredHistogram(positionsPane, table, "Average P&L (Bar To End)", new TradePathHistogramControl(researcher, true, true)); addFilteredHistogram(positionsPane, table, "Cumulative P&L (Bar To End)", new TradePathHistogramControl(researcher, false, true)); addFilteredHistogram(positionsPane, table, "Average P&L (Start To Bar)", new TradePathHistogramControl(researcher, true, false)); addFilteredHistogram(positionsPane, table, "Cumulative P&L (Start To Bar)", new TradePathHistogramControl(researcher, false, false)); addFilteredHistogram(positionsPane, table, "Pnl Distribution", new PositionHistogramControl(researcher, position => position.pnl(true, researcher.simulator.runInNativeCurrency()))); addFilteredHistogram(positionsPane, table, "Entry Size Distribution", new PositionHistogramControl(researcher, position => Objects.first(position.trades()).size)); addFilteredHistogram(positionsPane, table, "Bars Held Distribution", new PositionHistogramControl(researcher, position => position.barsHeld())); }