Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mitevpi committed Apr 30, 2020
1 parent f3a7050 commit 244d78f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Revit WPF Template

![GitHub issues](https://img.shields.io/github/issues/mitevpi/revit-wpf-template)
![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/mitevpi/revit-wpf-template)
![GitHub contributors](https://img.shields.io/github/contributors/mitevpi/revit-wpf-template)

![GitHub last commit](https://img.shields.io/github/last-commit/mitevpi/revit-wpf-template)
![GitHub Release Date](https://img.shields.io/github/release-date/mitevpi/revit-wpf-template)
![GitHub All Releases](https://img.shields.io/github/downloads/mitevpi/revit-wpf-template/total)

![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/mitevpi/revit-wpf-template)
![GitHub repo size](https://img.shields.io/github/repo-size/mitevpi/revit-wpf-template)
![GitHub](https://img.shields.io/github/license/mitevpi/revit-wpf-template)

WPF Template for Revit Add-Ins including wrapped external methods for execution in a "Valid Revit API Context"

![Window A](assets/window1.png)
Expand Down
2 changes: 1 addition & 1 deletion Revit Template/Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static void SheetRename(Ui ui, Document doc)
// start a transaction within the valid Revit API context
t.Start("Rename Sheets");

// loop over the collection of sheets
// loop over the collection of sheets using LINQ syntax
foreach (string renameMessage in from sheet in sheets
let renamed = sheet.LookupParameter("Sheet Name")?.Set("TEST")
select $"Renamed: {sheet.Title}, Status: {renamed}")
Expand Down
37 changes: 18 additions & 19 deletions Revit Template/UI.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,30 @@ private void BExternalMethod1_Click(object sender, RoutedEventArgs e)
private void UserAlert()
{
//TaskDialog.Show("Non-External Method", "Non-External Method Executed Successfully");
//MessageBox.Show("Non-External Method Executed Successfully", "Non-External Method");

Dispatcher.Invoke(() =>
{
TaskDialog mainDialog = new TaskDialog("Hello, Revit!")
{
MainInstruction = "Hello, Revit!",
MainContent = "This sample shows how to use a Revit task dialog to communicate with the user."
+ "The command links below open additional task dialogs with more information.",
CommonButtons = TaskDialogCommonButtons.Ok,
FooterText = "<a href=\"http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975 \">"
+ "Click here for the Revit API Developer Center</a>"
};


TaskDialogResult tResult = mainDialog.Show();
Debug.WriteLine(tResult.ToString());
});
MessageBox.Show("Non-External Method Executed Successfully", "Non-External Method");

//Dispatcher.Invoke(() =>
//{
// TaskDialog mainDialog = new TaskDialog("Non-External Method")
// {
// MainInstruction = "Hello, Revit!",
// MainContent = "Non-External Method Executed Successfully",
// CommonButtons = TaskDialogCommonButtons.Ok,
// FooterText = "<a href=\"http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975 \">"
// + "Click here for the Revit API Developer Center</a>"
// };


// TaskDialogResult tResult = mainDialog.Show();
// Debug.WriteLine(tResult.ToString());
//});
}

private void BNonExternal3_Click(object sender, RoutedEventArgs e)
{
// the sheet takeoff + delete method won't work here because it's not in a valid Revit api context
// and we need to do a transaction
// Methods.SheetTakeoff(this, _doc); <- WON'T WORK HERE
// Methods.SheetRename(this, _doc); <- WON'T WORK HERE
UserAlert();
}

Expand Down

0 comments on commit 244d78f

Please sign in to comment.