public TestService(ISomneoApiClient somneoApiClient) { _commandRegistry = new CommandRegistry(); var commandHandlers = new CommandHandlerBase[] { new DeviceCommandHandler(somneoApiClient), new SensorCommandHandler(somneoApiClient), new LightCommandHandler(somneoApiClient), new DisplayCommandHandler(somneoApiClient), new PlayerCommandHandler(somneoApiClient), new FMRadioCommandHandler(somneoApiClient), new WakeUpSoundCommandHandler(somneoApiClient), new AUXCommandHandler(somneoApiClient), new AlarmCommandHandler(somneoApiClient) }; _commandRegistry.RegisterCommand("help", "Show available commands.", ShowHelp); foreach (var commandHandler in commandHandlers) { commandHandler.RegisterCommands(_commandRegistry); } _commandRegistry.RegisterCommand("exit", "Exit the application.", args => _canRun = false); }
public override void RegisterCommands(CommandRegistry commandRegistry) { commandRegistry.RegisterCommand("alarms", "Show the alarms.", ShowAlarms); commandRegistry.RegisterCommand("alarm-settings", "[1-16]", "Show the settings of an alarm.", ShowAlarmSettings); commandRegistry.RegisterCommand("toggle-alarm", "[1-16] [on/off]", "Toggle an alarm.", ToggleAlarm); commandRegistry.RegisterCommand("remove-alarm", "[1-16]", "Remove an alarm.", RemoveAlarm); commandRegistry.RegisterCommand("set-snooze-time", "[1-20]", "Sets the snooze time in minutes.", SetSnoozeTime); }
public override void RegisterCommands(CommandRegistry commandRegistry) { commandRegistry.RegisterCommand("device", "Show the device information.", ShowDeviceDetails); commandRegistry.RegisterCommand("firmware", "Show the firmware information.", ShowFirmwareDetails); commandRegistry.RegisterCommand("wifi", "Show the wifi connection details.", ShowWifiDetails); commandRegistry.RegisterCommand("locale", "Show the locale set for the device.", ShowLocale); commandRegistry.RegisterCommand("time", "Show the time of the device.", ShowTime); }
public override void RegisterCommands(CommandRegistry commandRegistry) { commandRegistry.RegisterCommand("light", "Show the light state.", ShowLightState); commandRegistry.RegisterCommand("toggle-light", "[on/off]", "Toggle the light.", ToggleLight); commandRegistry.RegisterCommand("set-light-level", "[1-25]", "Set the light level.", SetLightLevel); commandRegistry.RegisterCommand("toggle-night-light", "[on/off]", "Toggle the night light.", ToggleNightLight); commandRegistry.RegisterCommand("toggle-sunrise-preview", "[on/off]", "Toggle the Sunrise Preview mode.", ToggleSunrisePreview); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); // Load up the options from file. string optionsFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NiftySolution.xml"); Options options = Options.Load(optionsFileName); // Create our main plugin facade. DTE2 application = GetGlobalService(typeof(DTE)) as DTE2; IVsProfferCommands3 profferCommands3 = base.GetService(typeof(SVsProfferCommands)) as IVsProfferCommands3; OleMenuCommandService oleMenuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; ImageList icons = new ImageList(); icons.Images.AddStrip(Properties.Resources.Icons); m_plugin = new Plugin(application, profferCommands3, icons, oleMenuCommandService, "NiftySolution", "Aurora.NiftySolution.Connect", options); // Every plugin needs a command bar. CommandBar commandBar = m_plugin.AddCommandBar("NiftySolution", MsoBarPosition.msoBarTop); m_commandRegistry = new CommandRegistry(m_plugin, commandBar, new Guid(PackageGuidString), new Guid(PackageGuidGroup)); // Initialize the logging system. if (Log.HandlerCount == 0) { #if DEBUG Log.AddHandler(new DebugLogHandler()); #endif Log.AddHandler(new VisualStudioLogHandler(m_plugin)); Log.Prefix = "NiftySolution"; } // Now we can take care of registering ourselves and all our commands and hooks. Log.Debug("Booting up..."); Log.IncIndent(); bool doBindings = options.EnableBindings; m_commandRegistry.RegisterCommand(doBindings, new QuickOpen(m_plugin, "NiftyOpen")); m_commandRegistry.RegisterCommand(doBindings, new ToggleFile(m_plugin, "NiftyToggle")); m_commandRegistry.RegisterCommand(doBindings, new CloseToolWindow(m_plugin, "NiftyClose")); m_commandRegistry.RegisterCommand(doBindings, new Configure(m_plugin, "NiftyConfigure")); if (options.SilentDebuggerExceptions || options.IgnoreDebuggerExceptions) { m_debuggerEvents = application.Events.DebuggerEvents; m_debuggerEvents.OnExceptionNotHandled += new _dispDebuggerEvents_OnExceptionNotHandledEventHandler(OnExceptionNotHandled); } m_timings = new SolutionBuildTimings(m_plugin); Log.DecIndent(); Log.Debug("Initialized..."); }
public void OnConnection(object application_, ext_ConnectMode connectMode, object addInInst, ref Array custom) { if (null != m_plugin) { return; } // Load up the options from file. string optionsFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NiftySolution.xml"); Options options = Options.Load(optionsFileName); // Create our main plugin facade. DTE2 application = (DTE2)application_; m_plugin = new Plugin(application, (AddIn)addInInst, "NiftySolution", "Aurora.NiftySolution.Connect", options); // Every plugin needs a command bar. CommandBar commandBar = m_plugin.AddCommandBar("NiftySolution", MsoBarPosition.msoBarTop); m_commandRegistry = new CommandRegistry(m_plugin, commandBar); // Initialize the logging system. if (Log.HandlerCount == 0) { #if DEBUG Log.AddHandler(new DebugLogHandler()); #endif Log.AddHandler(new VisualStudioLogHandler(m_plugin.OutputPane)); Log.Prefix = "NiftySolution"; } // Now we can take care of registering ourselves and all our commands and hooks. Log.Debug("Booting up..."); Log.IncIndent(); bool doBindings = options.EnableBindings; m_commandRegistry.RegisterCommand("NiftyOpen", doBindings, new QuickOpen(m_plugin)); m_commandRegistry.RegisterCommand("NiftyToggle", doBindings, new ToggleFile(m_plugin)); m_commandRegistry.RegisterCommand("NiftyClose", doBindings, new CloseToolWindow(m_plugin)); m_commandRegistry.RegisterCommand("NiftyConfigure", doBindings, new Configure(m_plugin)); if (options.SilentDebuggerExceptions || options.IgnoreDebuggerExceptions) { m_debuggerEvents = application.Events.DebuggerEvents; m_debuggerEvents.OnExceptionNotHandled += new _dispDebuggerEvents_OnExceptionNotHandledEventHandler(OnExceptionNotHandled); } m_timings = new SolutionBuildTimings(m_plugin); Log.DecIndent(); Log.Debug("Initialized..."); }
public static void RegisterCommand(bool server, bool client, string command, Action onCommand, string help = null) { if (server) { serverCommands.RegisterCommand(command, onCommand, help); } if (client) { clientCommands.RegisterCommand(command, onCommand, help); } }
public static void Initialize(TestContext ctx) { var registry = new CommandRegistry(); registry.RegisterCommand <Command>(); registry.RegisterCommand <CommandWithNameAttribute>(); registry.RegisterCommand <CommandWithArgument>(); registry.RegisterCommand <CommandWithAlias>(); registry.RegisterCommand <MultipleArgumentsAndAliases>(); _resolver = new CommandResolver(registry); }
public void OnConnection(object application_, ext_ConnectMode connectMode, object addInInst, ref Array custom) { if(null != m_plugin) return; // Load up the options from file. string optionsFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NiftySolution.xml"); Options options = Options.Load(optionsFileName); // Create our main plugin facade. DTE2 application = (DTE2)application_; m_plugin = new Plugin(application, (AddIn)addInInst, "NiftySolution", "Aurora.NiftySolution.Connect", options); // Every plugin needs a command bar. CommandBar commandBar = m_plugin.AddCommandBar("NiftySolution", MsoBarPosition.msoBarTop); m_commandRegistry = new CommandRegistry(m_plugin, commandBar); // Initialize the logging system. if(Log.HandlerCount == 0) { #if DEBUG Log.AddHandler(new DebugLogHandler()); #endif Log.AddHandler(new VisualStudioLogHandler(m_plugin.OutputPane)); Log.Prefix = "NiftySolution"; } // Now we can take care of registering ourselves and all our commands and hooks. Log.Debug("Booting up..."); Log.IncIndent(); bool doBindings = options.EnableBindings; m_commandRegistry.RegisterCommand("NiftyOpen", doBindings, new QuickOpen(m_plugin)); m_commandRegistry.RegisterCommand("NiftyToggle", doBindings, new ToggleFile(m_plugin)); m_commandRegistry.RegisterCommand("NiftyClose", doBindings, new CloseToolWindow(m_plugin)); m_commandRegistry.RegisterCommand("NiftyConfigure", doBindings, new Configure(m_plugin)); if (options.SilentDebuggerExceptions || options.IgnoreDebuggerExceptions) { m_debuggerEvents = application.Events.DebuggerEvents; m_debuggerEvents.OnExceptionNotHandled += new _dispDebuggerEvents_OnExceptionNotHandledEventHandler(OnExceptionNotHandled); } m_timings = new SolutionBuildTimings(m_plugin); Log.DecIndent(); Log.Debug("Initialized..."); }
public override void RegisterCommands(CommandRegistry commandRegistry) { commandRegistry.RegisterCommand("fm-radio-presets", "Show the FM-radio presets.", ShowFMRadioPresets); commandRegistry.RegisterCommand("set-fm-radio-preset", $"[1-5] [{87.50F:0.00}-{107.99F:0.00}]", "Set an FM-radio preset to a frequency.", SetFMRadioPreset); commandRegistry.RegisterCommand("fm-radio", "Show the FM-radio state.", ShowFMRadioState); commandRegistry.RegisterCommand("enable-fm-radio", "Enable the FM-radion.", EnableFMRadio); commandRegistry.RegisterCommand("enable-fm-radio-preset", "[1-5]", "Enable an FM-radio preset.", EnableFMRadioPreset); commandRegistry.RegisterCommand("seek-fm-radio-station", "[up/down]", "Seek a next FM-radio station.", SeekFMRadioStation); }
public static void Initialize(TestContext ctx) { var registry = new CommandRegistry(); registry.RegisterCommand <Command>(); registry.RegisterCommand <WithArgument>(); registry.RegisterCommand <WithIntArg>(); registry.RegisterCommand <MultipleArgs>(); registry.RegisterCommand <WithAlias>(); registry.RegisterCommand <WithOption>(); _resolver = new CommandResolver(registry); _activator = new CommandActivator(); }
public override void RegisterCommands(CommandRegistry commandRegistry) { commandRegistry.RegisterCommand("display", "Show the display state.", ShowDisplayState); commandRegistry.RegisterCommand("toggle-permanent-display", "[on/off]", "Toggle the permanent display.", TogglePermanentDisplay); commandRegistry.RegisterCommand("set-display-level", "[1-6]", "Set the display level.", SetDisplayLevel); }
public override void RegisterCommands(CommandRegistry commandRegistry) { commandRegistry.RegisterCommand("enable-aux", "Enables the auxiliary input device.", EnableAUX); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { await base.InitializeAsync(cancellationToken, progress); var dteService = GetServiceAsync(typeof(DTE)); Microsoft.Assumes.Present(dteService); var application = await dteService.ConfigureAwait(false) as DTE2; var oleMenuCommandService = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService; // Switches to the UI thread in order to consume some services used in command initialization await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); // Initialize the logging system. if (Log.HandlerCount == 0) { #if DEBUG Log.AddHandler(new DebugLogHandler()); #endif Log.AddHandler(new VisualStudioLogHandler("NiftyPerforce", this)); Log.Prefix = "NiftyPerforce"; } // Show where we are and when we were compiled... var niftyAssembly = Assembly.GetExecutingAssembly(); Version version = niftyAssembly.GetName().Version; string versionString = string.Join(".", version.Major, version.Minor, version.Build); string informationalVersion = niftyAssembly.GetCustomAttribute <AssemblyInformationalVersionAttribute>()?.InformationalVersion; if (informationalVersion != null) { versionString += " " + informationalVersion; } Log.Info( "NiftyPerforce{0} v{1} compiled on {2}" #if DEBUG , " (Debug!)" #else , string.Empty #endif , versionString , System.IO.File.GetLastWriteTime(niftyAssembly.Location) ); Log.Debug(" Location '{0}'", niftyAssembly.Location); // Now we can take care of registering ourselves and all our commands and hooks. Log.Debug("Booting up..."); Log.IncIndent(); var config = (Config)GetDialogPage(typeof(Config)); Singleton <Config> .Instance = config; #if NIFTY_LEGACY config.OnApplyEvent += (object sender, EventArgs e) => { if (config.CleanLegacyNiftyCommands) { Cleanup(); config.CleanLegacyNiftyCommands = false; } }; #endif m_plugin = new Plugin(application, oleMenuCommandService, config); m_commandRegistry = new CommandRegistry(m_plugin, new Guid(PackageGuids.guidNiftyPerforcePackageCmdSetString)); // Add our command handlers for menu (commands must exist in the .vsct file) m_commandRegistry.RegisterCommand(new P4EditModified(m_plugin, "NiftyEditModified")); m_commandRegistry.RegisterCommand(new P4EditItem(m_plugin, "NiftyEdit")); m_commandRegistry.RegisterCommand(new P4DiffItem(m_plugin, "NiftyDiff")); m_commandRegistry.RegisterCommand(new P4RevisionHistoryItem(m_plugin, "NiftyHistory", false)); m_commandRegistry.RegisterCommand(new P4RevisionHistoryItem(m_plugin, "NiftyHistoryMain", true)); m_commandRegistry.RegisterCommand(new P4TimeLapseItem(m_plugin, "NiftyTimeLapse", false)); m_commandRegistry.RegisterCommand(new P4TimeLapseItem(m_plugin, "NiftyTimeLapseMain", true)); m_commandRegistry.RegisterCommand(new P4RevisionGraphItem(m_plugin, "NiftyRevisionGraph", false)); m_commandRegistry.RegisterCommand(new P4RevisionGraphItem(m_plugin, "NiftyRevisionGraphMain", true)); m_commandRegistry.RegisterCommand(new P4RevertItem(m_plugin, "NiftyRevert", false)); m_commandRegistry.RegisterCommand(new P4RevertItem(m_plugin, "NiftyRevertUnchanged", true)); m_commandRegistry.RegisterCommand(new P4ShowItem(m_plugin, "NiftyShow")); m_plugin.AddFeature(new AutoAddDelete(m_plugin)); m_plugin.AddFeature(new AutoCheckoutProject(m_plugin)); m_plugin.AddFeature(new AutoCheckoutTextEdit(m_plugin)); m_plugin.AddFeature(new AutoCheckoutOnSave(m_plugin, this)); P4Operations.CheckInstalledFiles(); AsyncProcess.Init(); Log.DecIndent(); Log.Debug("Initialized..."); }
public override void RegisterCommands(CommandRegistry commandRegistry) { commandRegistry.RegisterCommand("sensor", "Show sensor data.", ShowSensorData); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); // Load up the options from file. string optionsFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NiftyPerforce.xml"); Config options = Config.Load(optionsFileName); // Every plugin needs a command bar. DTE2 application = GetGlobalService(typeof(DTE)) as DTE2; IVsProfferCommands3 profferCommands3 = base.GetService(typeof(SVsProfferCommands)) as IVsProfferCommands3; OleMenuCommandService oleMenuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; ImageList icons = new ImageList(); icons.Images.AddStrip(Properties.Resources.Icons); m_plugin = new Plugin(application, profferCommands3, icons, oleMenuCommandService, "NiftyPerforce", "Aurora.NiftyPerforce.Connect", options); Cleanup(); CommandBar commandBar = m_plugin.AddCommandBar("NiftyPerforce", MsoBarPosition.msoBarTop); m_commandRegistry = new CommandRegistry(m_plugin, commandBar, new Guid(PackageGuidString), new Guid(PackageGuidGroup)); // Initialize the logging system. if (Log.HandlerCount == 0) { #if DEBUG Log.AddHandler(new DebugLogHandler()); #endif Log.AddHandler(new VisualStudioLogHandler(m_plugin)); Log.Prefix = "NiftyPerforce"; } // Now we can take care of registering ourselves and all our commands and hooks. Log.Debug("Booting up..."); Log.IncIndent(); bool doContextCommands = options.EnableContextMenus; bool doBindings = options.EnableBindings; bool doAdvancedCommands = options.EnableAdvancedCommands; m_commandRegistry.RegisterCommand(doBindings, new NiftyConfigure(m_plugin, "NiftyConfig"), true); if (doAdvancedCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4EditModified(m_plugin, "NiftyEditModified"), true); } m_commandRegistry.RegisterCommand(doBindings, new P4EditItem(m_plugin, "NiftyEdit"), true); if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4EditItem(m_plugin, "NiftyEditItem"), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4EditSolution(m_plugin, "NiftyEditSolution"), false); } m_commandRegistry.RegisterCommand(doBindings, new P4DiffItem(m_plugin, "NiftyDiff")); if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4DiffItem(m_plugin, "NiftyDiffItem"), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4DiffSolution(m_plugin, "NiftyDiffSolution"), false); } m_commandRegistry.RegisterCommand(doBindings, new P4RevisionHistoryItem(m_plugin, "NiftyHistory", false), true); if (doAdvancedCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4RevisionHistoryItem(m_plugin, "NiftyHistoryMain", true), true); } if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4RevisionHistoryItem(m_plugin, "NiftyHistoryItem", false), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4RevisionHistoryItem(m_plugin, "NiftyHistoryItemMain", true), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4RevisionHistorySolution(m_plugin, "NiftyHistorySolution"), false); } m_commandRegistry.RegisterCommand(doBindings, new P4TimeLapseItem(m_plugin, "NiftyTimeLapse", false), true); if (doAdvancedCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4TimeLapseItem(m_plugin, "NiftyTimeLapseMain", true), true); } if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4TimeLapseItem(m_plugin, "NiftyTimeLapseItem", false), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4TimeLapseItem(m_plugin, "NiftyTimeLapseItemMain", true), false); } m_commandRegistry.RegisterCommand(doBindings, new P4RevisionGraphItem(m_plugin, "NiftyRevisionGraph", false), true); if (doAdvancedCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4RevisionGraphItem(m_plugin, "NiftyRevisionGraphMain", true), true); } if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4RevisionGraphItem(m_plugin, "NiftyRevisionGraphItem", false), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4RevisionGraphItem(m_plugin, "NiftyRevisionGraphItemMain", true), false); } m_commandRegistry.RegisterCommand(doBindings, new P4RevertItem(m_plugin, "NiftyRevert", false), true); m_commandRegistry.RegisterCommand(doBindings, new P4RevertItem(m_plugin, "NiftyRevertUnchanged", true), true); if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4RevertItem(m_plugin, "NiftyRevertItem", false), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4RevertItem(m_plugin, "NiftyRevertUnchangedItem", true), false); } m_commandRegistry.RegisterCommand(doBindings, new P4ShowItem(m_plugin, "NiftyShow"), true); if (doContextCommands) { m_commandRegistry.RegisterCommand(doBindings, new P4ShowItem(m_plugin, "NiftyShowItem"), false); } m_plugin.AddFeature(new AutoAddDelete(m_plugin)); m_plugin.AddFeature(new AutoCheckoutProject(m_plugin)); m_plugin.AddFeature(new AutoCheckoutOnBuild(m_plugin)); m_plugin.AddFeature(new AutoCheckoutTextEdit(m_plugin)); m_plugin.AddFeature(new AutoCheckoutOnSave(m_plugin)); #if DEBUG // Use this to track down event GUIDs. //m_plugin.AddFeature(new FindEvents(m_plugin)); #endif P4Operations.CheckInstalledFiles(); AsyncProcess.Init(); Log.DecIndent(); Log.Debug("Initialized..."); #if DEBUG Log.Info("NiftyPerforce (Debug)"); #else //Log.Info("NiftyPerforce (Release)"); #endif // Show where we are and when we were compiled... Log.Info("I'm running {0} compiled on {1}", Assembly.GetExecutingAssembly().Location, System.IO.File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location)); }
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst_, ref Array custom) { if(null != m_plugin) return; // Load up the options from file. string optionsFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NiftyPerforce.xml"); Config options = Config.Load(optionsFileName); // Every plugin needs a command bar. m_plugin = new Plugin((DTE2)application, (AddIn)addInInst_, "NiftyPerforce", "Aurora.NiftyPerforce.Connect", options); CommandBar commandBar = m_plugin.AddCommandBar("NiftyPerforce", MsoBarPosition.msoBarTop); m_commandRegistry = new CommandRegistry(m_plugin, commandBar); // Initialize the logging system. if(Log.HandlerCount == 0) { #if DEBUG Log.AddHandler(new DebugLogHandler()); #endif Log.AddHandler(new VisualStudioLogHandler(m_plugin.OutputPane)); Log.Prefix = "NiftyPerforce"; } // Now we can take care of registering ourselves and all our commands and hooks. Log.Debug("Booting up..."); Log.IncIndent(); bool doContextCommands = true; bool doBindings = options.EnableBindings; m_commandRegistry.RegisterCommand("NiftyConfig", doBindings, new NiftyConfigure(m_plugin), true); m_commandRegistry.RegisterCommand("NiftyEditModified", doBindings, new P4EditModified(m_plugin), true); m_commandRegistry.RegisterCommand("NiftyEdit", doBindings, new P4EditItem(m_plugin), true); if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyEditItem", doBindings, new P4EditItem(m_plugin), false); if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyEditSolution", doBindings, new P4EditSolution(m_plugin), false); m_commandRegistry.RegisterCommand("NiftyDiff", doBindings, new P4DiffItem(m_plugin)); if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyDiffItem", doBindings, new P4DiffItem(m_plugin), false); if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyDiffSolution", doBindings, new P4DiffSolution(m_plugin), false); m_commandRegistry.RegisterCommand("NiftyHistory", doBindings, new P4RevisionHistoryItem(m_plugin, false), true); m_commandRegistry.RegisterCommand("NiftyHistoryMain", doBindings, new P4RevisionHistoryItem(m_plugin, true), true); if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyHistoryItem", doBindings, new P4RevisionHistoryItem(m_plugin, false), false); if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyHistoryItemMain", doBindings, new P4RevisionHistoryItem(m_plugin, true), false); if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyHistorySolution", doBindings, new P4RevisionHistorySolution(m_plugin), false); m_commandRegistry.RegisterCommand("NiftyTimeLapse", doBindings, new P4TimeLapseItem(m_plugin, false), true); m_commandRegistry.RegisterCommand("NiftyTimeLapseMain", doBindings, new P4TimeLapseItem(m_plugin, true), true); if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyTimeLapseItem", doBindings, new P4TimeLapseItem(m_plugin, false), false); if (doContextCommands) m_commandRegistry.RegisterCommand("NiftyTimeLapseItemMain", doBindings, new P4TimeLapseItem(m_plugin, true), false); m_commandRegistry.RegisterCommand("NiftyRevisionGraph", doBindings, new P4RevisionGraphItem(m_plugin, false), true); m_commandRegistry.RegisterCommand("NiftyRevisionGraphMain", doBindings, new P4RevisionGraphItem(m_plugin, true), true); if (doContextCommands) m_commandRegistry.RegisterCommand("NiftyRevisionGraphItem", doBindings, new P4RevisionGraphItem(m_plugin, false), false); if (doContextCommands) m_commandRegistry.RegisterCommand("NiftyRevisionGraphItemMain", doBindings, new P4RevisionGraphItem(m_plugin, true), false); m_commandRegistry.RegisterCommand("NiftyRevert", doBindings, new P4RevertItem(m_plugin), true); if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyRevertItem", doBindings, new P4RevertItem(m_plugin), false); m_commandRegistry.RegisterCommand("NiftyShow", doBindings, new P4ShowItem(m_plugin), true); if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyShowItem", doBindings, new P4ShowItem(m_plugin), false); m_plugin.AddFeature(new AutoAddDelete(m_plugin)); m_plugin.AddFeature(new AutoCheckoutProject(m_plugin)); m_plugin.AddFeature(new AutoCheckoutOnBuild(m_plugin)); m_plugin.AddFeature(new AutoCheckoutTextEdit(m_plugin)); m_plugin.AddFeature(new AutoCheckoutOnSave(m_plugin)); #if DEBUG // Use this to track down event GUIDs. //m_plugin.AddFeature(new FindEvents(m_plugin)); #endif P4Operations.CheckInstalledFiles(); AsyncProcess.Init(); Log.DecIndent(); Log.Debug("Initialized..."); #if DEBUG Log.Info("NiftyPerforce (Debug)"); #else //Log.Info("NiftyPerforce (Release)"); #endif // Show where we are and when we were compiled... Log.Info("I'm running {0} compiled on {1}", Assembly.GetExecutingAssembly().Location, System.IO.File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location)); }
public override void RegisterCommands(CommandRegistry commandRegistry) { commandRegistry.RegisterCommand("player", "Show the player state.", ShowPlayerState); commandRegistry.RegisterCommand("set-player-volume", "[1-25]", "Set the player volume.", SetPlayerVolume); commandRegistry.RegisterCommand("disable-player", "Disable the player.", DisablePlayer); }
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst_, ref Array custom) { if (null != m_plugin) { return; } // Load up the options from file. string optionsFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NiftyPerforce.xml"); Config options = Config.Load(optionsFileName); // Every plugin needs a command bar. m_plugin = new Plugin((DTE2)application, (AddIn)addInInst_, "NiftyPerforce", "Aurora.NiftyPerforce.Connect", options); CommandBar commandBar = m_plugin.AddCommandBar("NiftyPerforce", MsoBarPosition.msoBarTop); m_commandRegistry = new CommandRegistry(m_plugin, commandBar); // Initialize the logging system. if (Log.HandlerCount == 0) { #if DEBUG Log.AddHandler(new DebugLogHandler()); #endif Log.AddHandler(new VisualStudioLogHandler(m_plugin.OutputPane)); Log.Prefix = "NiftyPerforce"; } // Now we can take care of registering ourselves and all our commands and hooks. Log.Debug("Booting up..."); Log.IncIndent(); bool doContextCommands = true; bool doBindings = options.EnableBindings; m_commandRegistry.RegisterCommand("NiftyConfig", doBindings, new NiftyConfigure(m_plugin), true); m_commandRegistry.RegisterCommand("NiftyEditModified", doBindings, new P4EditModified(m_plugin), true); m_commandRegistry.RegisterCommand("NiftyEdit", doBindings, new P4EditItem(m_plugin), true); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyEditItem", doBindings, new P4EditItem(m_plugin), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyEditSolution", doBindings, new P4EditSolution(m_plugin), false); } m_commandRegistry.RegisterCommand("NiftyDiff", doBindings, new P4DiffItem(m_plugin)); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyDiffItem", doBindings, new P4DiffItem(m_plugin), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyDiffSolution", doBindings, new P4DiffSolution(m_plugin), false); } m_commandRegistry.RegisterCommand("NiftyHistory", doBindings, new P4RevisionHistoryItem(m_plugin, false), true); m_commandRegistry.RegisterCommand("NiftyHistoryMain", doBindings, new P4RevisionHistoryItem(m_plugin, true), true); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyHistoryItem", doBindings, new P4RevisionHistoryItem(m_plugin, false), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyHistoryItemMain", doBindings, new P4RevisionHistoryItem(m_plugin, true), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyHistorySolution", doBindings, new P4RevisionHistorySolution(m_plugin), false); } m_commandRegistry.RegisterCommand("NiftyTimeLapse", doBindings, new P4TimeLapseItem(m_plugin, false), true); m_commandRegistry.RegisterCommand("NiftyTimeLapseMain", doBindings, new P4TimeLapseItem(m_plugin, true), true); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyTimeLapseItem", doBindings, new P4TimeLapseItem(m_plugin, false), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyTimeLapseItemMain", doBindings, new P4TimeLapseItem(m_plugin, true), false); } m_commandRegistry.RegisterCommand("NiftyRevisionGraph", doBindings, new P4RevisionGraphItem(m_plugin, false), true); m_commandRegistry.RegisterCommand("NiftyRevisionGraphMain", doBindings, new P4RevisionGraphItem(m_plugin, true), true); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyRevisionGraphItem", doBindings, new P4RevisionGraphItem(m_plugin, false), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyRevisionGraphItemMain", doBindings, new P4RevisionGraphItem(m_plugin, true), false); } m_commandRegistry.RegisterCommand("NiftyRevert", doBindings, new P4RevertItem(m_plugin), true); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyRevertItem", doBindings, new P4RevertItem(m_plugin), false); } m_commandRegistry.RegisterCommand("NiftyShow", doBindings, new P4ShowItem(m_plugin), true); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyShowItem", doBindings, new P4ShowItem(m_plugin), false); } m_plugin.AddFeature(new AutoAddDelete(m_plugin)); m_plugin.AddFeature(new AutoCheckoutProject(m_plugin)); m_plugin.AddFeature(new AutoCheckoutOnBuild(m_plugin)); m_plugin.AddFeature(new AutoCheckoutTextEdit(m_plugin)); m_plugin.AddFeature(new AutoCheckoutOnSave(m_plugin)); #if DEBUG // Use this to track down event GUIDs. //m_plugin.AddFeature(new FindEvents(m_plugin)); #endif P4Operations.CheckInstalledFiles(); AsyncProcess.Init(); Log.DecIndent(); Log.Debug("Initialized..."); #if DEBUG Log.Info("NiftyPerforce (Debug)"); #else //Log.Info("NiftyPerforce (Release)"); #endif // Show where we are and when we were compiled... Log.Info("I'm running {0} compiled on {1}", Assembly.GetExecutingAssembly().Location, System.IO.File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location)); }
public override void RegisterCommands(CommandRegistry commandRegistry) { commandRegistry.RegisterCommand("play-wake-up-sound", "[1-8]", "Plays a wake-up sound.", PlayWakeUpSound); }
public static void RegisterCommand(string command, Action onCommand, string help = null) { commands.RegisterCommand(command, onCommand, help); }