当前位置: 首页>>代码示例>>C#>>正文


C# Utilities.GetAllPluginsOfType方法代码示例

本文整理汇总了C#中Utilities.GetAllPluginsOfType方法的典型用法代码示例。如果您正苦于以下问题:C# Utilities.GetAllPluginsOfType方法的具体用法?C# Utilities.GetAllPluginsOfType怎么用?C# Utilities.GetAllPluginsOfType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utilities的用法示例。


在下文中一共展示了Utilities.GetAllPluginsOfType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessExternalCommand

        public void ProcessExternalCommand(string command, string commandData, string eventToken, TelecomScriptInterface tsInterface, CallButler.Telecom.TelecomProviderBase telecomProvider, WOSI.CallButler.Data.DataProviders.CallButlerDataProviderBase dataProvider, Utilities.PluginManagement.PluginManager pluginManager, PBXRegistrarService pbxRegistrar)
        {
            // Parse out our external event action
            if (Enum.IsDefined(typeof(BaseExternalCommands), command))
            {
                BaseExternalCommands externalCommand = WOSI.Utilities.EnumUtils<BaseExternalCommands>.Parse(command);

                string languageID = "en";

                switch (externalCommand)
                {
                    case BaseExternalCommands.CALLBUTLERINTERNAL_StartAddonModule:

                        CallButler.Service.Plugin.CallButlerAddonModulePlugin[] addonModules = pluginManager.GetAllPluginsOfType<CallButler.Service.Plugin.CallButlerAddonModulePlugin>();

                        foreach (CallButler.Service.Plugin.CallButlerAddonModulePlugin addonModule in addonModules)
                        {
                            if (addonModule.PluginID.ToString() == commandData)
                            {
                                try
                                {
                                    // Make sure the module is licensed
                                    if (!addonModule.IsLicensed)
                                        break;

                                    // We found our module and we should load the script it uses
                                    tsInterface.ScriptProcessor = new AddonModuleScriptProcessor(addonModule);
                                    tsInterface.ScriptProcessor.StartProcessing(tsInterface, telecomProvider, dataProvider);
                                    return;

                                }
                                catch (Exception e)
                                {
                                    LoggingService.AddLogEntry(WOSI.CallButler.ManagementInterface.LogLevel.ErrorsOnly, "Failed to load Addon-Module '" + addonModule.PluginName + "'\r\n\r\n" + e.Message + "\r\n\r\n" + e.StackTrace, true);
                                }
                            }
                        }

                        break;

                    case BaseExternalCommands.CALLBUTLERINTERNAL_ReturnToCallFlowMainMenu:

                        // Return to the Call flow main menu.
                        tsInterface.ScriptProcessor = new StandardScriptProcessor(pluginManager, pbxRegistrar);
                        ((StandardScriptProcessor)tsInterface.ScriptProcessor).StartFromMainMenu(tsInterface);

                        break;

                    case BaseExternalCommands.CALLBUTLERINTERNAL_PlayLicenseIntroGreeting:

                        // If the line isn't in use, don't do anything
                        if (!telecomProvider.IsLineInUse(tsInterface.LineNumber))
                        {
                            tsInterface.IMLInterpreter.SignalEventCallback(eventToken);
                            break;
                        }

                        // Read our intro sound bytes
                        byte[] introSoundBytes = null;

                        if (telecomProvider.AudioInputRate == 8000)
                        {
                            introSoundBytes = new byte[Properties.Resources.powered_by_8khz.Length];
                            Properties.Resources.powered_by_8khz.Read(introSoundBytes, 0, introSoundBytes.Length);
                        }
                        else if (telecomProvider.AudioInputRate == 16000)
                        {
                            introSoundBytes = new byte[Properties.Resources.powered_by_16khz.Length];
                            Properties.Resources.powered_by_16khz.Read(introSoundBytes, 0, introSoundBytes.Length);
                        }

                        // Play our license intro sound
                        if (introSoundBytes != null)
                        {
                            telecomProvider.PlaySound(tsInterface.LineNumber, introSoundBytes);
                        }

                        break;

                    case BaseExternalCommands.CALLBUTLERINTERNAL_PlaySystemSound:

                        // If the line isn't in use, don't do anything
                        if (!telecomProvider.IsLineInUse(tsInterface.LineNumber))
                        {
                            tsInterface.IMLInterpreter.SignalEventCallback(eventToken);
                            break;
                        }

                        // Get the sound with the current language
                        languageID = tsInterface.IMLInterpreter.GetLocalVariable("LanguageID");

                        string soundFilename = GetSoundFileForLanguage(languageID, commandData);

                        if (soundFilename == null)
                        {
                            // If we don't get a sound with the current language, try the default language
                            soundFilename = GetSoundFileForLanguage(Properties.Settings.Default.DefaultLanguage, commandData);

                            if (soundFilename == null)
                            {
//.........这里部分代码省略.........
开发者ID:hostitherepc,项目名称:Fork-1,代码行数:101,代码来源:ScriptProcessorBase.cs


注:本文中的Utilities.GetAllPluginsOfType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。