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


C# IConnection.GetType方法代码示例

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


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

示例1: Build

        public IConnectionWriter Build(IConnection connection)
        {
            Type connectionType = connection.GetType();

            lock (connectionToWriterTypeMap)
            {
                if (!connectionToWriterTypeMap.ContainsKey(connectionType))
                {
                    logger.Log(LogLevels.Warning, "Connection type {0} does not have an associated ConnectionWriter. Using Default Writer", connectionType.Name);
                    return new DefaultConnectionWriter(connection);
                }

                Type writerType = connectionToWriterTypeMap[connectionType];

                return Activator.CreateInstance(writerType, connection) as IConnectionWriter;
            }
        }
开发者ID:welterde,项目名称:MarcidiaMud,代码行数:17,代码来源:ConnectionWriterBuilder.cs

示例2: SetDefaults

        /// <summary>
        /// Sets the defaults to use when creating a new connection for a particular protocol.
        /// </summary>
        /// <param name="defaults">Default connection data to use when creating a new connection for the protocol.</param>
        public static void SetDefaults(IConnection defaults)
        {
            if (_defaults == null)
                InitializeDefaults();

            // Get the protocol for this connection type
            IProtocol protocol = _protocols.First(pair => pair.Value.ConnectionType == defaults.GetType()).Value;

            _defaults[protocol.GetType()] = defaults;
            SaveDefaults();
        }
开发者ID:WildGenie,项目名称:EasyConnect,代码行数:15,代码来源:ConnectionFactory.cs

示例3: CreateOptionsForm

 /// <summary>
 /// Opens the UI to enter data for establishing <paramref name="connection"/> (i.e. host, username, password, etc.).
 /// </summary>
 /// <param name="connection">Connection that we want the options UI for.</param>
 /// <returns>The UI to enter data for establishing <paramref name="connection"/> (i.e. host, username, password, etc.).</returns>
 public static Form CreateOptionsForm(IConnection connection)
 {
     return _protocols.First(pair => pair.Value.ConnectionType.Name == connection.GetType().Name).Value.GetOptionsForm(connection);
 }
开发者ID:WildGenie,项目名称:EasyConnect,代码行数:9,代码来源:ConnectionFactory.cs

示例4: GetProtocol

 /// <summary>
 /// Gets the protocol for a particular <paramref name="connection"/>.
 /// </summary>
 /// <param name="connection">Connection that we want the protocol for.</param>
 /// <returns>Protocol associated with <paramref name="connection"/>.</returns>
 public static IProtocol GetProtocol(IConnection connection)
 {
     return _protocols.FirstOrDefault(p => p.Value.ConnectionType == connection.GetType()).Value;
 }
开发者ID:WildGenie,项目名称:EasyConnect,代码行数:9,代码来源:ConnectionFactory.cs

示例5: CreateConnectionForm

 /// <summary>
 /// Opens the UI to use to establish the <paramref name="connection"/>.
 /// </summary>
 /// <param name="connection">Connection that we want the UI for.</param>
 /// <param name="containerPanel">Container panel that will house the <paramref name="connection"/>'s UI.</param>
 /// <returns>The UI form to use to establish the <paramref name="connection"/>.</returns>
 public static BaseConnectionForm CreateConnectionForm(IConnection connection, Panel containerPanel)
 {
     return _protocols.First(pair => pair.Value.ConnectionType.Name == connection.GetType().Name).Value.CreateConnectionForm(connection, containerPanel);
 }
开发者ID:WildGenie,项目名称:EasyConnect,代码行数:10,代码来源:ConnectionFactory.cs


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