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


C# IExtension类代码示例

本文整理汇总了C#中IExtension的典型用法代码示例。如果您正苦于以下问题:C# IExtension类的具体用法?C# IExtension怎么用?C# IExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Remove

        /// <summary>
        /// Removes an extension from the current session.
        /// </summary>
        /// <param name="extension">Extension</param>
        public void Remove(IExtension extension)
        {
            var fullName = extension.Name + " (id: " + extension.UniqueId + ")";
            if (!extensions.Contains(extension))
            {
                Log("ExtensionManager does not contain " + fullName + " extension");
                return;
            }

            extensions.Remove(extension);
            try
            {
                extension.Dispose();
            }
            catch (Exception ex)
            {
                Log(fullName + " extension cannot be disposed properly: " + ex.Message);
            }

            Log(fullName + " extension is removed");
            if (ExtensionRemoved != null)
            {
                ExtensionRemoved(extension);
            }
        }
开发者ID:sh4nnongoh,项目名称:Dynamo,代码行数:29,代码来源:ExtensionManager.cs

示例2: SongRequestsWindow

        public SongRequestsWindow(IExtension sender)
        {
            extension = sender;

            InitializeComponent();

            ini = SongRequest.ini; new Settings(extension, "Settings.ini");

            UI.CenterSpacer(RequestingRulesLabel, RequestingRulesSpacer, false, true);

            ChargeRequest.Text = "Requesting costs                       " + Currency.Name;

            ini.SetValue("Settings", "ChargeRequest", (ChargeRequest.Checked = (ini.GetValue("Settings", "ChargeRequest", "1") == "1")) ? "1" : "0");
            int variable = Convert.ToInt32(ini.GetValue("Settings", "RequestPrice", "25"));
            if (variable > RequestPrice.Maximum || variable < RequestPrice.Minimum)
            {
                variable = 25;
            }
            ini.SetValue("Settings", "RequestPrice", (RequestPrice.Value = variable).ToString());
            ini.SetValue("Settings", "LimitRequests", (LimitRequests.Checked = (ini.GetValue("Settings", "LimitRequests", "1") == "1")) ? "1" : "0");
            variable = Convert.ToInt32(ini.GetValue("Settings", "RequestsLimit", "2"));
            if (variable > RequestsLimit.Maximum || variable < RequestsLimit.Minimum)
            {
                variable = 2;
            }
            ini.SetValue("Settings", "RequestsLimit", (RequestsLimit.Value = variable).ToString());
        }
开发者ID:carriercomm,项目名称:ModBot,代码行数:27,代码来源:SongRequestsWindow.cs

示例3: Assign

        /// <inheritdoc />
        public void Assign(IReflectExtensionProperties reflector, IExtension extension, IConsumeConfiguration consumer, IHaveConversionCallbacks conversionCallbacksProvider, IHaveDefaultConversionCallback defaultConversionCallbackProvider)
        {
            Ensure.ArgumentNotNull(reflector, "reflector");
            Ensure.ArgumentNotNull(consumer, "consumer");
            Ensure.ArgumentNotNull(conversionCallbacksProvider, "conversionCallbacksProvider");
            Ensure.ArgumentNotNull(defaultConversionCallbackProvider, "defaultConversionCallbackProvider");

            var properties = reflector.Reflect(extension).ToList();
            IDictionary<string, IConversionCallback> conversionCallbacks = conversionCallbacksProvider.ConversionCallbacks;
            IConversionCallback defaultCallback = defaultConversionCallbackProvider.DefaultConversionCallback;

            foreach (KeyValuePair<string, string> keyValuePair in consumer.Configuration)
            {
                KeyValuePair<string, string> pair = keyValuePair;

                var matchedProperty = properties.SingleOrDefault(property => property.Name.Equals(pair.Key, StringComparison.OrdinalIgnoreCase));

                if (matchedProperty == null)
                {
                    continue;
                }

                IConversionCallback conversionCallback;
                if (!conversionCallbacks.TryGetValue(pair.Key, out conversionCallback))
                {
                    conversionCallback = defaultCallback;
                }

                matchedProperty.SetValue(extension, conversionCallback.Convert(pair.Value, matchedProperty), null);
            }
        }
开发者ID:WenningQiu,项目名称:appccelerate,代码行数:32,代码来源:AssignExtensionProperties.cs

示例4: Assign

        /// <inheritdoc />
        public void Assign(IReflectExtensionProperties reflector, IExtension extension, IConsumeConfiguration consumer, IHaveConversionCallbacks callbackProvider)
        {
            Ensure.ArgumentNotNull(reflector, "reflector");
            Ensure.ArgumentNotNull(consumer, "consumer");
            Ensure.ArgumentNotNull(callbackProvider, "callbackProvider");

            IEnumerable<PropertyInfo> properties = reflector.Reflect(extension);
            IDictionary<string, Func<string, PropertyInfo, object>> conversionCallbacks = callbackProvider.ConversionCallbacks;
            Func<string, PropertyInfo, object> defaultCallback = callbackProvider.DefaultConversionCallback;

            foreach (KeyValuePair<string, string> keyValuePair in consumer.Configuration)
            {
                KeyValuePair<string, string> pair = keyValuePair;

                var matchedProperty = properties.Where(property => property.Name.Equals(pair.Key, StringComparison.OrdinalIgnoreCase))
                    .SingleOrDefault();

                if (matchedProperty == null)
                {
                    continue;
                }

                Func<string, PropertyInfo, object> conversionCallback;
                if (!conversionCallbacks.TryGetValue(pair.Key, out conversionCallback))
                {
                    conversionCallback = defaultCallback;
                }

                matchedProperty.SetValue(extension, conversionCallback(pair.Value, matchedProperty), null);
            }
        }
开发者ID:Sourceress,项目名称:bbv.Common,代码行数:32,代码来源:AssignExtensionProperties.cs

示例5: GetPackageFromExtension

 public IPackage GetPackageFromExtension(IExtension extension)
 {
     string id = extension.AssemblyQualifiedName.Substring(0, extension.AssemblyQualifiedName.IndexOf(',')); // Grab the part prior to the first comma
     id = id.Substring(0, id.LastIndexOf('.')); // Grab the part prior to the last period
     var pack = packages.GetLocalPackage(id);
     return pack;
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:7,代码来源:GetPackage.cs

示例6: RegisterViews

 public void RegisterViews(IExtension owner, params View[] views)
 {
     foreach (var v in views)
     {
         RegisterView(owner, v);
     }
 }
开发者ID:chienhao10,项目名称:FinalesFunkeln,代码行数:7,代码来源:UiManager.cs

示例7: ExtensionProviderExtensionsTest

        public ExtensionProviderExtensionsTest()
        {
            this.provider = A.Fake<IExtensionProvider<IExtension>>();
            this.extension = A.Fake<IExtension>();

            this.exception = new Exception();
        }
开发者ID:hmuralt,项目名称:appccelerate,代码行数:7,代码来源:ExtensionProviderExtensionsTest.cs

示例8: GiveawaysWindow

        public GiveawaysWindow(IExtension sender)
        {
            InitializeComponent();

            ini = new Settings(sender, "Settings.ini", "[Default]");

            UI.CenterSpacer(GiveawayTypeLabel, GiveawayTypeSpacer);
            UI.CenterSpacer(GiveawaySettingsLabel, GiveawaySettingsSpacer, false, true);
            UI.CenterSpacer(GiveawayBansLabel, GiveawayBansSpacer);
            UI.CenterSpacer(GiveawayUsersLabel, GiveawayUsersSpacer);

            Panel panel = new Panel();
            panel.Size = new Size(1, 1);
            panel.Location = new Point(GiveawayTypeSpacer.Location.X + GiveawayTypeSpacer.Size.Width - 1, GiveawayTypeSpacer.Location.Y + 9);
            Controls.Add(panel);
            panel.BringToFront();
            panel = new Panel();
            panel.Size = new Size(1, 1);
            panel.Location = new Point(GiveawayBansSpacer.Location.X + GiveawayBansSpacer.Size.Width - 1, GiveawayBansSpacer.Location.Y + 9);
            Controls.Add(panel);
            panel.BringToFront();
            /*panel.BackColor = Color.Black;
            panel.Size = new Size(Giveaway_AddPresent.Size.Width + Giveaway_RemovePresent.Size.Width, 1);
            panel.Location = new Point(Giveaway_AddPresent.Location.X, Giveaway_AddPresent.Location.Y + 1);
            Controls.Add(panel);
            panel.BringToFront();*/
        }
开发者ID:carriercomm,项目名称:ModBot,代码行数:27,代码来源:GiveawaysWindow.cs

示例9: HaveDefaultConversionCallback

        /// <summary>
        /// Initializes a new instance of the <see cref="HaveDefaultConversionCallback"/> class.
        /// </summary>
        /// <param name="extension">The extension.</param>
        public HaveDefaultConversionCallback(IExtension extension)
        {
            var callbacksProvider = extension as IHaveDefaultConversionCallback;

            this.DefaultConversionCallback = callbacksProvider != null
                ? callbacksProvider.DefaultConversionCallback
                : new DefaultConversionCallback();
        }
开发者ID:WenningQiu,项目名称:appccelerate,代码行数:12,代码来源:HaveDefaultConversionCallback.cs

示例10: HaveConversionCallbacks

        /// <summary>
        /// Initializes a new instance of the <see cref="HaveConversionCallbacks"/> class.
        /// </summary>
        /// <param name="extension">The extension.</param>
        public HaveConversionCallbacks(IExtension extension)
        {
            var callbacksProvider = extension as IHaveConversionCallbacks;

            this.ConversionCallbacks = callbacksProvider != null
                ? callbacksProvider.ConversionCallbacks
                : new Dictionary<string, IConversionCallback>();
        }
开发者ID:WenningQiu,项目名称:appccelerate,代码行数:12,代码来源:HaveConversionCallbacks.cs

示例11: Load

        public static void Load(IExtension sender)
        {
            extension = sender;

            Events.Connected += Events_Connected;
            Events.Currency.OnQueue += Events_OnCurrencyQueue;
            Events.OnDisconnect += Events_OnDisconnect;
        }
开发者ID:carriercomm,项目名称:ModBot,代码行数:8,代码来源:Gambling.cs

示例12: ConsumeConfiguration

        /// <summary>
        /// Initializes a new instance of the <see cref="ConsumeConfiguration"/> class.
        /// </summary>
        /// <param name="extension">The extension.</param>
        public ConsumeConfiguration(IExtension extension)
        {
            var consumeConfiguration = extension as IConsumeConfiguration;

            this.Configuration = consumeConfiguration != null
                ? consumeConfiguration.Configuration
                : new Dictionary<string, string>();
        }
开发者ID:tiger2soft,项目名称:bbv.Common,代码行数:12,代码来源:ConsumeConfiguration.cs

示例13: GetPackageFromExtension

 public IPackage GetPackageFromExtension(IExtension extension)
 {
     string id = extension.AssemblyQualifiedName.Substring(0, extension.AssemblyQualifiedName.IndexOf(',')); // Grab the part prior to the first comma
     if (id.Contains("."))
         id = id.Substring(0, id.LastIndexOf('.')); // Grab the part prior to the last period, only if id contains period (Changed by JLeiss)
     var pack = packages.GetLocalPackage(id);
     return pack;
 }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:8,代码来源:GetPackage.cs

示例14: SendMessage

 public void SendMessage(IExtension sender, string receiver, string command, params object[] arguments)
 {
     if(sender==null)
         throw new ArgumentNullException(nameof(sender));
     if (_extensions.ContainsKey(receiver))
     {
         _extensions[receiver].ExtensionMessageReceived(sender,command,arguments);
     }
 }
开发者ID:frostycpu,项目名称:FinalesFunkeln,代码行数:9,代码来源:ExtensionManager.cs

示例15: Host

        //private Scene m_scene;
        public Host(IObject obj, Scene scene, IExtension extend, IMicrothreader threader)
        {
            this.m_obj = obj;
            this.m_threader = new MicrothreaderWrapper(threader);
            this.m_extend = new ExtensionWrapper(extend);
            //this.m_scene = m_scene;

            m_graphics = new GraphicsWrapper(new Graphics(scene, this));
        }
开发者ID:JohnMcCaffery,项目名称:XMRM,代码行数:10,代码来源:Host.cs


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