Skip to content

Commit

Permalink
cleanup & rename
Browse files Browse the repository at this point in the history
  • Loading branch information
mitevpi committed Apr 30, 2020
1 parent 9ebceba commit 401c170
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 434 deletions.
31 changes: 15 additions & 16 deletions Revit Template/App.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using System.Windows.Media.Imaging;
using Autodesk.Revit.UI;
using System.Windows.Threading;
using System.Threading;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Events;

namespace RevitTemplate
{
Expand All @@ -15,7 +16,7 @@ namespace RevitTemplate
class App : IExternalApplication
{
// class instance
public static App ThisApp = null;
public static App ThisApp;

// ModelessForm instance
private Ui _mMyForm;
Expand All @@ -33,7 +34,7 @@ public Result OnStartup(UIControlledApplication a)
string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
PushButton button =
panel.AddItem(
new PushButtonData("Revit Template", "Revit Template", thisAssemblyPath,
new PushButtonData("WPF Template", "WPF Template", thisAssemblyPath,
"RevitTemplate.EntryCommand")) as
PushButton;

Expand All @@ -47,7 +48,7 @@ public Result OnStartup(UIControlledApplication a)

PushButton button2 =
panel.AddItem(
new PushButtonData("Revit Template 2", "Revit Template 2", thisAssemblyPath,
new PushButtonData("WPF Template Multi-Thread", "WPF Template Multi-Thread", thisAssemblyPath,
"RevitTemplate.EntryCommandSeparateThread")) as
PushButton;

Expand Down Expand Up @@ -81,7 +82,7 @@ public Result OnShutdown(UIControlledApplication a)
public void ShowForm(UIApplication uiapp)
{
// If we do not have a dialog yet, create and show it
if ( _mMyForm == null || _mMyForm != null ) // || m_MyForm.IsDisposed
if (_mMyForm == null || _mMyForm != null) // || m_MyForm.IsDisposed
{
//EXTERNAL EVENTS WITH ARGUMENTS
EventHandlerWithStringArg evString = new EventHandlerWithStringArg();
Expand All @@ -102,14 +103,13 @@ public void ShowForm(UIApplication uiapp)
public void ShowFormSeparateThread(UIApplication uiapp)
{
// If we do not have a thread started or has been terminated start a new one
if ( _UiThread is null || !_UiThread.IsAlive )
if (_UiThread is null || !_UiThread.IsAlive)
{

//EXTERNAL EVENTS WITH ARGUMENTS
EventHandlerWithStringArg evStr = new EventHandlerWithStringArg();
EventHandlerWithWpfArg eDatabaseStore = new EventHandlerWithWpfArg();

_UiThread = new Thread(new ThreadStart(() =>
_UiThread = new Thread(() =>
{
SynchronizationContext.SetSynchronizationContext(
new DispatcherSynchronizationContext(
Expand All @@ -119,7 +119,7 @@ public void ShowFormSeparateThread(UIApplication uiapp)
_mMyForm.Closed += (s, e) => Dispatcher.CurrentDispatcher.InvokeShutdown();
_mMyForm.Show();
Dispatcher.Run();
}));
});

_UiThread.SetApartmentState(ApartmentState.STA);
_UiThread.IsBackground = true;
Expand All @@ -129,18 +129,17 @@ public void ShowFormSeparateThread(UIApplication uiapp)

#region Idling & Closing


/// <summary>
/// What to do when the application is idling. (Ideally nothing)
/// </summary>
void a_Idling(object sender, Autodesk.Revit.UI.Events.IdlingEventArgs e)
void a_Idling(object sender, IdlingEventArgs e)
{
}

/// <summary>
/// What to do when the application is closing.)
/// </summary>
void a_ApplicationClosing(object sender, Autodesk.Revit.UI.Events.ApplicationClosingEventArgs e)
void a_ApplicationClosing(object sender, ApplicationClosingEventArgs e)
{
}

Expand Down Expand Up @@ -173,9 +172,9 @@ public RibbonPanel RibbonPanel(UIControlledApplication a)

// Search existing tab for your panel.
List<RibbonPanel> panels = a.GetRibbonPanels(tab);
foreach ( RibbonPanel p in panels )
foreach (RibbonPanel p in panels)
{
if ( p.Name == "Develop" )
if (p.Name == "Develop")
{
ribbonPanel = p;
}
Expand All @@ -187,4 +186,4 @@ public RibbonPanel RibbonPanel(UIControlledApplication a)

#endregion
}
}
}
101 changes: 0 additions & 101 deletions Revit Template/EntryCommand.resx

This file was deleted.

101 changes: 0 additions & 101 deletions Revit Template/EntryCommand.ru.resx

This file was deleted.

Loading

0 comments on commit 401c170

Please sign in to comment.