• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IExtension类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Host

        //private Scene m_scene;

        public Host (IObject m_obj, IScene m_scene, IExtension m_extend)
        {
            this.m_obj = m_obj;
            this.m_extend = m_extend;

            m_graphics = new Graphics(m_scene);

            m_scene.EventManager.OnFrame += EventManager_OnFrame;
        }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:11,代码来源:Host.cs


示例17: LoadConfigurationSection

 /// <summary>
 /// Initializes a new instance of the <see cref="LoadConfigurationSection"/> class.
 /// </summary>
 /// <param name="extension">The extension.</param>
 public LoadConfigurationSection(IExtension extension)
 {
     var loader = extension as ILoadConfigurationSection;
     this.sectionProvider =
         section =>
         loader != null
             ? loader.GetSection(section)
             : (ConfigurationSection)ConfigurationManager.GetSection(section);
 }
开发者ID:hmuralt,项目名称:appccelerate,代码行数:13,代码来源:LoadConfigurationSection.cs


示例18: Host

        //private Scene m_scene;

        public Host(IObject m_obj, Scene m_scene, IExtension m_extend, IMicrothreader m_threader)
        {
            this.m_obj = m_obj;
            this.m_threader = m_threader;
            this.m_extend = m_extend;
            //this.m_scene = m_scene;

            m_graphics = new Graphics(m_scene);
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:11,代码来源:Host.cs


示例19: HaveConfigurationSectionName

        /// <summary>
        /// Initializes a new instance of the <see cref="HaveConfigurationSectionName"/> class.
        /// </summary>
        /// <param name="extension">The extension.</param>
        public HaveConfigurationSectionName(IExtension extension)
        {
            Ensure.ArgumentNotNull(extension, "extension");

            var namer = extension as IHaveConfigurationSectionName;

            this.SectionName = namer != null
                ? namer.SectionName
                : extension.GetType().Name;
        }
开发者ID:WenningQiu,项目名称:appccelerate,代码行数:14,代码来源:HaveConfigurationSectionName.cs


示例20: GetExtension

 internal static IExtension GetExtension()
 {
     if (s_extension == null)
     {
         UID extID = new UIDClass();
         extID.Value = ThisAddIn.IDs.CurveByInferenceExtension;
         s_extension = ArcMap.Application.FindExtensionByCLSID(extID);
     }
     return s_extension;
 }
开发者ID:travisval,项目名称:ParcelFabricCurveByInference,代码行数:10,代码来源:CurveByInferenceExtension.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IExtensionHost类代码示例发布时间:2022-05-24
下一篇:
C# IExtenderProvider类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap