-
-
Save ricaun/86334ff6560e3e8c4671148c5c995b39 to your computer and use it in GitHub Desktop.
Revit Multiple CommandTheme
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
using Autodesk.Revit.Attributes; | |
using Autodesk.Revit.DB; | |
using Autodesk.Revit.UI; | |
using System.ComponentModel; | |
namespace RevitAddin | |
{ | |
[DisplayName("Theme\rChange")] | |
[Transaction(TransactionMode.Manual)] | |
public class CommandTheme : IExternalCommand, IExternalCommandAvailability | |
{ | |
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet) | |
{ | |
UIApplication uiapp = commandData.Application; | |
UIThemeManager.CurrentTheme = UIThemeManager.CurrentTheme == UITheme.Dark ? UITheme.Light : UITheme.Dark; | |
return Result.Succeeded; | |
} | |
public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories) | |
{ | |
return true; | |
} | |
} | |
[DisplayName("Theme\rChange")] | |
[Transaction(TransactionMode.Manual)] | |
public class CommandTheme1 : IExternalCommand, IExternalCommandAvailability | |
{ | |
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet) | |
{ | |
UIApplication uiapp = commandData.Application; | |
UIThemeManager.CurrentTheme = UIThemeManager.CurrentTheme == UITheme.Dark ? UITheme.Light : UITheme.Dark; | |
return Result.Succeeded; | |
} | |
public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories) | |
{ | |
return true; | |
} | |
} | |
[DisplayName("Theme\rChange")] | |
[Transaction(TransactionMode.Manual)] | |
public class CommandTheme2 : IExternalCommand, IExternalCommandAvailability | |
{ | |
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet) | |
{ | |
UIApplication uiapp = commandData.Application; | |
UIThemeManager.CurrentTheme = UIThemeManager.CurrentTheme == UITheme.Dark ? UITheme.Light : UITheme.Dark; | |
return Result.Succeeded; | |
} | |
public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories) | |
{ | |
return true; | |
} | |
} | |
[DisplayName("Theme\rChange")] | |
[Transaction(TransactionMode.Manual)] | |
public class CommandTheme3 : IExternalCommand, IExternalCommandAvailability | |
{ | |
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet) | |
{ | |
UIApplication uiapp = commandData.Application; | |
UIThemeManager.CurrentTheme = UIThemeManager.CurrentTheme == UITheme.Dark ? UITheme.Light : UITheme.Dark; | |
return Result.Succeeded; | |
} | |
public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories) | |
{ | |
return true; | |
} | |
} | |
[DisplayName("Theme\rChange")] | |
[Transaction(TransactionMode.Manual)] | |
public class CommandTheme4 : IExternalCommand, IExternalCommandAvailability | |
{ | |
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet) | |
{ | |
UIApplication uiapp = commandData.Application; | |
UIThemeManager.CurrentTheme = UIThemeManager.CurrentTheme == UITheme.Dark ? UITheme.Light : UITheme.Dark; | |
return Result.Succeeded; | |
} | |
public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories) | |
{ | |
return true; | |
} | |
} | |
[DisplayName("Theme\rChange")] | |
[Transaction(TransactionMode.Manual)] | |
public class CommandTheme5 : IExternalCommand, IExternalCommandAvailability | |
{ | |
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet) | |
{ | |
UIApplication uiapp = commandData.Application; | |
UIThemeManager.CurrentTheme = UIThemeManager.CurrentTheme == UITheme.Dark ? UITheme.Light : UITheme.Dark; | |
return Result.Succeeded; | |
} | |
public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories) | |
{ | |
return true; | |
} | |
} | |
[DisplayName("Theme\rChange")] | |
[Transaction(TransactionMode.Manual)] | |
public class CommandTheme6 : IExternalCommand, IExternalCommandAvailability | |
{ | |
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet) | |
{ | |
UIApplication uiapp = commandData.Application; | |
UIThemeManager.CurrentTheme = UIThemeManager.CurrentTheme == UITheme.Dark ? UITheme.Light : UITheme.Dark; | |
return Result.Succeeded; | |
} | |
public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories) | |
{ | |
return true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment