-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ricaun-io/develop
Version 0.2.2
- Loading branch information
Showing
19 changed files
with
206 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Version>0.2.2</Version> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,62 @@ | ||
#if NETFRAMEWORK | ||
using Autodesk.Revit.DB; | ||
using Autodesk.Revit.UI; | ||
using Revit.Busy; | ||
using ricaun.Revit.UI; | ||
using ricaun.Revit.UI.Tasks; | ||
using System; | ||
namespace Revit.Busy.Example.Revit | ||
{ | ||
[AppLoader] | ||
public class App : IExternalApplication | ||
{ | ||
private static RevitTaskService revitTaskService; | ||
public static IRevitTask RevitTask => revitTaskService; | ||
|
||
private static RibbonPanel ribbonPanel; | ||
private static RibbonItem ribbonItem; | ||
public static RevitBusyService RevitBusyService; | ||
public Result OnStartup(UIControlledApplication application) | ||
{ | ||
revitTaskService = new RevitTaskService(application); | ||
revitTaskService.Initialize(); | ||
|
||
ribbonPanel = application.CreatePanel("Example"); | ||
ribbonItem = ribbonPanel.CreatePushButton<Commands.Command>("RevitBusy") | ||
var ribbonItem = ribbonPanel.CreatePushButton<Commands.Command>("RevitBusy") | ||
.SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico"); | ||
|
||
RevitBusyControl.Initialize(application); | ||
RevitBusyControl.Control.PropertyChanged += RevitBusyControlPropertyChanged; | ||
|
||
UpdateLargeImageBusy(ribbonItem, RevitBusyControl.Control); | ||
var viewButton = ribbonPanel.CreatePushButton<Commands.CommandView>("View") | ||
.SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico"); | ||
|
||
return Result.Succeeded; | ||
} | ||
RevitBusyService = new RevitBusyService(application); | ||
RevitBusyService.SetInterval(100); | ||
RevitBusyService.PropertyChanged += (s, e) => | ||
{ | ||
UpdateLargeImageBusy(ribbonItem, RevitBusyService.IsRevitBusy); | ||
UpdateLargeImageBusy(viewButton, RevitBusyService.IsRevitBusy); | ||
}; | ||
|
||
private void RevitBusyControlPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) | ||
{ | ||
Console.WriteLine($"RevitBusyControl PropertyChanged {e.PropertyName} {RevitBusyControl.Control.IsRevitBusy}"); | ||
RevitBusyControl.Initialize(application); | ||
|
||
var control = sender as RevitBusyService; | ||
UpdateLargeImageBusy(ribbonItem, control); | ||
return Result.Succeeded; | ||
} | ||
|
||
public Result OnShutdown(UIControlledApplication application) | ||
{ | ||
ribbonPanel?.Remove(); | ||
if (RevitBusyControl.Control is not null) | ||
RevitBusyControl.Control.PropertyChanged -= RevitBusyControlPropertyChanged; | ||
|
||
RevitBusyService?.Dispose(); | ||
revitTaskService?.Dispose(); | ||
|
||
return Result.Succeeded; | ||
} | ||
|
||
private static void UpdateLargeImageBusy(RibbonItem ribbonItem, RevitBusyService control) | ||
private static void UpdateLargeImageBusy(RibbonItem ribbonItem, bool revitBusy) | ||
{ | ||
const string LargeImageIsBusy = "/UIFrameworkRes;component/ribbon/images/close.ico"; | ||
const string LargeImageNoBusy = "/UIFrameworkRes;component/ribbon/images/add.ico"; | ||
if (control.IsRevitBusy) | ||
if (revitBusy) | ||
ribbonItem.SetLargeImage(LargeImageIsBusy); | ||
else | ||
ribbonItem.SetLargeImage(LargeImageNoBusy); | ||
} | ||
} | ||
} | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.