Skip to content

Commit

Permalink
cleaning up the code a little bit
Browse files Browse the repository at this point in the history
  • Loading branch information
salaros committed Jul 1, 2022
1 parent 13b32df commit 79c19a6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 34 deletions.
48 changes: 20 additions & 28 deletions src/App.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#region Namespaces

using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand All @@ -15,8 +13,6 @@
using System.Threading;
#endif

#endregion

namespace RevitAddin
{
/// <summary>
Expand Down Expand Up @@ -59,10 +55,6 @@ public Result OnStartup(UIControlledApplication application)
.FirstOrDefault(c => language.Contains(c.EnglishName)) ?? Thread.CurrentThread.CurrentUICulture;
#endif

#if REVIT2023
ParameterType.Angle.ToString();
#endif

InitializeRibbon();

try
Expand All @@ -73,22 +65,22 @@ public Result OnStartup(UIControlledApplication application)

// Open / change
application.ControlledApplication.DocumentOpened += OnDocumentOpened;
application.ControlledApplication.DocumentChanged += OnDocumentChanged;
//application.ControlledApplication.DocumentChanged += OnDocumentChanged;

// Save / SaveAs
application.ControlledApplication.DocumentSaved += OnDocumentSaved;
application.ControlledApplication.DocumentSavedAs += OnDocumentSavedAs;
//application.ControlledApplication.DocumentSaved += OnDocumentSaved;
//application.ControlledApplication.DocumentSavedAs += OnDocumentSavedAs;

// Progress & Failure
application.ControlledApplication.ProgressChanged += OnProgressChanged;
application.ControlledApplication.FailuresProcessing += OnFailuresProcessing;
//application.ControlledApplication.ProgressChanged += OnProgressChanged;
//application.ControlledApplication.FailuresProcessing += OnFailuresProcessing;

// Closing
application.ControlledApplication.DocumentClosing += OnDocumentClosing;
application.ControlledApplication.DocumentClosed += OnDocumentClosed;
// Document closing
//application.ControlledApplication.DocumentClosing += OnDocumentClosing;
//application.ControlledApplication.DocumentClosed += OnDocumentClosed;

// Views
application.ViewActivated += OnViewActivated;
// View activation
//application.ViewActivated += OnViewActivated;

// TODO: add you code here
}
Expand Down Expand Up @@ -116,22 +108,22 @@ public Result OnShutdown(UIControlledApplication application)

// Open / change
uiControlledApplication.ControlledApplication.DocumentOpened -= OnDocumentOpened;
uiControlledApplication.ControlledApplication.DocumentChanged -= OnDocumentChanged;
//uiControlledApplication.ControlledApplication.DocumentChanged -= OnDocumentChanged;

// Save / SaveAs
uiControlledApplication.ControlledApplication.DocumentSaved -= OnDocumentSaved;
uiControlledApplication.ControlledApplication.DocumentSavedAs -= OnDocumentSavedAs;
//uiControlledApplication.ControlledApplication.DocumentSaved -= OnDocumentSaved;
//uiControlledApplication.ControlledApplication.DocumentSavedAs -= OnDocumentSavedAs;

// Progress & Failure
uiControlledApplication.ControlledApplication.ProgressChanged -= OnProgressChanged;
uiControlledApplication.ControlledApplication.FailuresProcessing -= OnFailuresProcessing;
//uiControlledApplication.ControlledApplication.ProgressChanged -= OnProgressChanged;
//uiControlledApplication.ControlledApplication.FailuresProcessing -= OnFailuresProcessing;

// Closing
uiControlledApplication.ControlledApplication.DocumentClosing -= OnDocumentClosing;
uiControlledApplication.ControlledApplication.DocumentClosed -= OnDocumentClosed;
// Document closing
//uiControlledApplication.ControlledApplication.DocumentClosing -= OnDocumentClosing;
//uiControlledApplication.ControlledApplication.DocumentClosed -= OnDocumentClosed;

// Views
uiControlledApplication.ViewActivated -= OnViewActivated;
// View activation
//uiControlledApplication.ViewActivated -= OnViewActivated;

// TODO: add you code here
}
Expand Down
7 changes: 2 additions & 5 deletions src/ExternalCommand.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
#region Namespaces

using System.Diagnostics;
using System.Windows;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;

#endregion

namespace RevitAddin
{
/// <summary>
/// A simple example of an external command, usually it's used for batch processing
/// files loaded when Revit is idling
/// files loaded when Revit is idling.
/// </summary>
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
Expand Down Expand Up @@ -81,6 +77,7 @@ var walls
// TODO: add you code here
subTransaction.Commit();
}

transaction.Commit();
}

Expand Down
1 change: 0 additions & 1 deletion src/StringLocalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public StringLocalizer(Assembly assembly = null, string resourceLocation = "Prop

public static StringLocalizer ExecutingAssembly { get; }


/// <summary>
/// Gets the <see cref="string"/> with the specified string.
/// </summary>
Expand Down

0 comments on commit 79c19a6

Please sign in to comment.