📄 channelitem.cs
字号:
namespace Imps.Client.Pc
{
using Imps.Client;
using System;
using System.Drawing;
using System.Runtime.CompilerServices;
public class ChannelItem
{
private string _args;
private IChannel _channel;
private string _description;
private string _id;
private string _initArgs;
private volatile Image _logo;
private volatile Image _logoHover;
private string _logoHoverUrl;
private string _logoUrl;
private IChannelManager _manager;
private readonly string _name;
private string _ordinal;
private string _strUri;
private string _text;
private string _tip;
private int _tryCounter;
private Type _type;
private static Type _typeChannel = typeof(IChannel);
public ChannelItem(IChannelManager manager, string name) : this(manager, name, typeof(IChannel))
{
}
public ChannelItem(IChannelManager manager, string name, Type type) : this(manager, name, type, string.Empty)
{
}
public ChannelItem(IChannelManager manager, string name, Type type, string text)
{
this._tryCounter = 3;
if (!_typeChannel.IsAssignableFrom(type))
{
throw new ArgumentException("The channel item type must implement interface IChannel!", "type");
}
this._manager = manager;
this._name = name;
this.Text = text;
this._type = type;
}
public virtual void CreateChannel()
{
this._channel = this._manager.CreateChannel(this);
}
public string Args
{
get
{
if (!string.IsNullOrEmpty(this._args))
{
return this._args;
}
return this.InitArgs;
}
set
{
this._args = value;
}
}
public IChannel Channel
{
get
{
return this._channel;
}
}
public bool ChannelAvailable
{
get
{
return (null != this._channel);
}
}
public Type ChannelType
{
get
{
return this._type;
}
set
{
this._type = value;
}
}
public string Description
{
get
{
return this._description;
}
set
{
this._description = value;
}
}
public string ID
{
get
{
return this._id;
}
set
{
this._id = value;
}
}
public string InitArgs
{
get
{
return this._initArgs;
}
set
{
this._initArgs = value;
}
}
public Image Logo
{
get
{
if (this._logo == null)
{
this._logo = ImpsResources.GetImage("Images.tab_unknown.png");
}
return this._logo;
}
set
{
if (this._logo != null)
{
this._logo.Dispose();
}
this._logo = value;
}
}
public Image LogoHover
{
get
{
if (this._logoHover == null)
{
this._logoHover = ImpsResources.GetImage("Images.tab_unknown.png");
}
return this._logoHover;
}
set
{
if (this._logoHover != null)
{
this._logoHover.Dispose();
}
this._logoHover = value;
}
}
public string LogoHoverUrl
{
get
{
return this._logoHoverUrl;
}
set
{
this._logoHoverUrl = value;
}
}
public string LogoUrl
{
get
{
return this._logoUrl;
}
set
{
this._logoUrl = value;
}
}
public string Name
{
get
{
return this._name;
}
}
public string Ordinal
{
get
{
return this._ordinal;
}
set
{
this._ordinal = value;
}
}
public string StrUri
{
get
{
return this._strUri;
}
set
{
this._strUri = value;
}
}
public string Text
{
get
{
return this._text;
}
set
{
this._text = value;
}
}
public string Tip
{
get
{
return this._tip;
}
set
{
this._tip = value;
}
}
public int TryCounter
{
get
{
return this._tryCounter;
}
set
{
this._tryCounter = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -