本文整理汇总了C#中Smuxi.Engine.UserConfig类的典型用法代码示例。如果您正苦于以下问题:C# UserConfig类的具体用法?C# UserConfig怎么用?C# UserConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserConfig类属于Smuxi.Engine命名空间,在下文中一共展示了UserConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public override void Load(UserConfig config, string protocol, string id)
{
if (config == null) {
throw new ArgumentNullException("config");
}
if (String.IsNullOrEmpty(protocol)) {
throw new ArgumentNullException("protocol");
}
if (String.IsNullOrEmpty(id)) {
throw new ArgumentNullException("id");
}
base.Load(config, protocol, id);
var obj = config[ConfigKeyPrefix + "PriorityOnline"];
if (obj != null) {
Priorities[PresenceStatus.Online] = (int) obj;
}
obj = config[ConfigKeyPrefix + "PriorityAway"];
if (obj != null) {
Priorities[PresenceStatus.Away] = (int) obj;
}
obj = config[ConfigKeyPrefix + "Resource"];
if (obj != null) {
Resource = (string) obj;
}
}
示例2: ApplyConfig
public void ApplyConfig(UserConfig userConfig)
{
Trace.Call(userConfig);
if (userConfig == null) {
throw new ArgumentNullException("userConfig");
}
string modeStr = (string) userConfig["Interface/Notification/NotificationAreaIconMode"];
f_NotificationAreaIconMode = (NotificationAreaIconMode) Enum.Parse(
typeof(NotificationAreaIconMode),
modeStr
);
// initialize status icon for the first time
if (f_NotificationAreaIconMode != NotificationAreaIconMode.Never &&
f_StatusIcon == null) {
f_StatusIcon = new Gtk.StatusIcon();
f_StatusIcon.Pixbuf = new Gdk.Pixbuf(null, "icon.svg");
f_StatusIcon.Activate += OnStatusIconActivated;
f_StatusIcon.PopupMenu += OnStatusIconPopupMenu;
f_StatusIcon.Tooltip = "Smuxi";
}
if (f_NotificationAreaIconMode == NotificationAreaIconMode.Never &&
!f_MainWindow.Visible) {
// force window unhide as the user would not be able to bring
// it back without a notification icon!
f_MainWindow.Visible = true;
}
CheckMainWindowState();
}
示例3: ApplyConfig
public void ApplyConfig(UserConfig userConfig)
{
switch ((string) userConfig["Interface/Notebook/TabPosition"]) {
case "top":
TabPos = Gtk.PositionType.Top;
ShowTabs = true;
break;
case "bottom":
TabPos = Gtk.PositionType.Bottom;
ShowTabs = true;
break;
case "left":
TabPos = Gtk.PositionType.Left;
ShowTabs = true;
break;
case "right":
TabPos = Gtk.PositionType.Right;
ShowTabs = true;
break;
case "none":
ShowTabs = false;
break;
}
// TODO: Homogeneous = true;
}
示例4: ServerListController
public ServerListController(UserConfig userConfig)
{
if (userConfig == null) {
throw new ArgumentNullException("userConfig");
}
_UserConfig = userConfig;
}
示例5: ApplyConfig
public override void ApplyConfig(UserConfig config)
{
base.ApplyConfig(config);
if (BackgroundColor.HasValue) _PersonListBox.BackColor = _TopicTextView.BackColor = BackgroundColor.Value;
if (BackgroundColor.HasValue) _PersonListBox.ForeColor = _TopicTextView.ForeColor = ForegroundColor.Value;
_PersonListBox.Font = _TopicTextView.Font = Font;
_PersonListBox.Width = TextRenderer.MeasureText("999999999", Font).Width;
}
示例6: MessagePatternListController
public MessagePatternListController(UserConfig userConfig)
{
if (userConfig == null) {
throw new ArgumentNullException("userConfig");
}
UserConfig = userConfig;
}
示例7: ApplyConfig
public void ApplyConfig(UserConfig config)
{
if (config == null) {
throw new ArgumentNullException("config");
}
var servers = new ServerListController(config);
InitNetworks(servers.GetNetworks());
}
示例8: ApplyConfig
public void ApplyConfig(UserConfig config)
{
if (config == null) {
throw new ArgumentNullException("config");
}
CommandCharacter = (string)
config["Interface/Entry/CommandCharacter"];
CompletionCharacter = (string)
config["Interface/Entry/CompletionCharacter"];
BashStyleCompletion = (bool)
config["Interface/Entry/BashStyleCompletion"];
CommandHistorySize = (int)
config["Interface/Entry/CommandHistorySize"];
}
示例9: FilterListWidget
public FilterListWidget(Gtk.Window parent, UserConfig userConfig)
{
if (parent == null) {
throw new ArgumentNullException("parent");
}
if (userConfig == null) {
throw new ArgumentNullException("userConfig");
}
Build();
Init();
f_Parent = parent;
f_Controller = new FilterListController(userConfig);
}
示例10: ApplyConfig
public void ApplyConfig(UserConfig userConfig)
{
switch ((string) userConfig["Interface/Notebook/TabPosition"]) {
case "top":
Alignment = TabAlignment.Top;
break;
case "bottom":
Alignment = TabAlignment.Bottom;
break;
case "left":
Alignment = TabAlignment.Left;
break;
case "right":
Alignment = TabAlignment.Right;
break;
case "none":
//ShowTabs = false;
break;
}
}
示例11: Save
public virtual void Save(UserConfig config)
{
if (config == null) {
throw new ArgumentNullException("config");
}
config[ConfigKeyPrefix + "Hostname"] = Hostname;
config[ConfigKeyPrefix + "Port"] = Port;
config[ConfigKeyPrefix + "Network"] = Network;
config[ConfigKeyPrefix + "Username"] = Username;
config[ConfigKeyPrefix + "Password"] = Password;
config[ConfigKeyPrefix + "UseEncryption"] = UseEncryption;
config[ConfigKeyPrefix + "ValidateServerCertificate"] =
ValidateServerCertificate;
config[ConfigKeyPrefix + "OnStartupConnect"] = OnStartupConnect;
config[ConfigKeyPrefix + "OnConnectCommands"] = OnConnectCommands;
}
示例12: Load
public virtual void Load(UserConfig config, string protocol, string id)
{
if (config == null) {
throw new ArgumentNullException("config");
}
if (String.IsNullOrEmpty(protocol)) {
throw new ArgumentNullException("protocol");
}
if (String.IsNullOrEmpty(id)) {
throw new ArgumentNullException("id");
}
// don't use ConfigKeyPrefix, so exception guarantees can be kept
string prefix = "Servers/" + protocol + "/" + id + "/";
if (config[prefix + "Hostname"] == null) {
// server does not exist
throw new ArgumentException("ServerID not found in config", id);
}
ServerID = id;
Protocol = protocol;
// now we have a valid ServerID and Protocol, ConfigKeyPrefix works
Hostname = (string) config[ConfigKeyPrefix + "Hostname"];
Port = (int) config[ConfigKeyPrefix + "Port"];
Network = (string) config[ConfigKeyPrefix + "Network"];
Username = (string) config[ConfigKeyPrefix + "Username"];
Password = (string) config[ConfigKeyPrefix + "Password"];
UseEncryption = (bool) config[ConfigKeyPrefix + "UseEncryption"];
ValidateServerCertificate =
(bool) config[ConfigKeyPrefix + "ValidateServerCertificate"];
if (config[ConfigKeyPrefix + "OnStartupConnect"] != null) {
OnStartupConnect = (bool) config[ConfigKeyPrefix + "OnStartupConnect"];
}
OnConnectCommands = config[ConfigKeyPrefix + "OnConnectCommands"] as IList<string>;
}
示例13: ApplyConfig
public virtual void ApplyConfig(UserConfig config)
{
Trace.Call(config);
if (config == null) {
throw new ArgumentNullException("config");
}
var theme = new ThemeSettings(config);
if (theme.BackgroundColor == null) {
ModifyBase(Gtk.StateType.Normal);
} else {
ModifyBase(Gtk.StateType.Normal, theme.BackgroundColor.Value);
}
if (theme.ForegroundColor == null) {
ModifyText(Gtk.StateType.Normal);
} else {
ModifyText(Gtk.StateType.Normal, theme.ForegroundColor.Value);
}
ModifyFont(theme.FontDescription);
Settings.ApplyConfig(config);
// replace nick completer if needed
if (Settings.BashStyleCompletion && !(NickCompleter is LongestPrefixNickCompleter)) {
NickCompleter = new LongestPrefixNickCompleter();
} else if (!Settings.BashStyleCompletion && !(NickCompleter is TabCycleNickCompleter)) {
NickCompleter = new TabCycleNickCompleter();
}
// set the completion character
NickCompleter.CompletionChar = Settings.CompletionCharacter;
}
示例14: ApplyConfig
public void ApplyConfig(UserConfig config)
{
_ThemeSettings = new ThemeSettings(config);
if (_ThemeSettings.BackgroundColor == null) {
ModifyBase(Gtk.StateType.Normal);
} else {
ModifyBase(Gtk.StateType.Normal, _ThemeSettings.BackgroundColor.Value);
}
if (_ThemeSettings.ForegroundColor == null) {
ModifyText(Gtk.StateType.Normal);
} else {
ModifyText(Gtk.StateType.Normal, _ThemeSettings.ForegroundColor.Value);
}
ModifyFont(_ThemeSettings.FontDescription);
string wrapModeStr = (string) config["Interface/Chat/WrapMode"];
if (!String.IsNullOrEmpty(wrapModeStr)) {
Gtk.WrapMode wrapMode = (Gtk.WrapMode) Enum.Parse(
typeof(Gtk.WrapMode),
wrapModeStr
);
if (wrapMode == Gtk.WrapMode.Word) {
wrapMode = Gtk.WrapMode.WordChar;
}
WrapMode = wrapMode;
}
_BufferLines = (int) config["Interface/Notebook/BufferLines"];
}
示例15: ThemeSettings
public ThemeSettings(UserConfig config)
{
if (config == null) {
throw new ArgumentNullException("config");
}
string bgStr = (string) config["Interface/Chat/BackgroundColor"];
if (!String.IsNullOrEmpty(bgStr)) {
Gdk.Color bgColor = Gdk.Color.Zero;
if (Gdk.Color.Parse(bgStr, ref bgColor)) {
f_BackgroundColor = bgColor;
}
} else {
f_BackgroundColor = null;
}
string fgStr = (string) config["Interface/Chat/ForegroundColor"];
if (!String.IsNullOrEmpty(fgStr)) {
Gdk.Color fgColor = Gdk.Color.Zero;
if (Gdk.Color.Parse(fgStr, ref fgColor)) {
f_ForegroundColor = fgColor;
}
} else {
f_ForegroundColor = null;
}
string colorStr;
Gdk.Color color;
colorStr = (string) config["Interface/Notebook/Tab/HighlightColor"];
color = Gdk.Color.Zero;
if (Gdk.Color.Parse(colorStr, ref color)) {
f_HighlightColor = color;
}
colorStr = (string) config["Interface/Notebook/Tab/ActivityColor"];
color = Gdk.Color.Zero;
if (Gdk.Color.Parse(colorStr, ref color)) {
f_ActivityColor = color;
}
colorStr = (string) config["Interface/Notebook/Tab/NoActivityColor"];
color = Gdk.Color.Zero;
if (Gdk.Color.Parse(colorStr, ref color)) {
f_NoActivityColor = color;
}
colorStr = (string) config["Interface/Notebook/Tab/EventColor"];
color = Gdk.Color.Zero;
if (Gdk.Color.Parse(colorStr, ref color)) {
f_EventColor = color;
}
string fontFamily = (string) config["Interface/Chat/FontFamily"];
string fontStyle = (string) config["Interface/Chat/FontStyle"];
int fontSize = 0;
if (config["Interface/Chat/FontSize"] != null) {
fontSize = (int) config["Interface/Chat/FontSize"];
}
Pango.FontDescription fontDescription = new Pango.FontDescription();
if (String.IsNullOrEmpty(fontFamily)) {
// HACK: use fixed-sys by default if present
if (File.Exists("Fixedsys500c.ttf")) {
fontDescription.Family = "FixedsysTTF, monospace";
// fixed-sys only looks good in size 11
fontDescription.Size = 11 * 1024;
fontDescription.Weight = Pango.Weight.Bold;
fontDescription.Style = Pango.Style.Normal;
} else {
// use Monospace and Bold by default
fontDescription.Family = "monospace";
// black bold font on white background looks odd
//fontDescription.Weight = Pango.Weight.Bold;
}
} else {
fontDescription.Family = fontFamily;
string frontWeigth = null;
if (fontStyle.Contains(" ")) {
int pos = fontStyle.IndexOf(" ");
frontWeigth = fontStyle.Substring(0, pos);
fontStyle = fontStyle.Substring(pos + 1);
}
fontDescription.Style = (Pango.Style) Enum.Parse(typeof(Pango.Style), fontStyle);
if (frontWeigth != null) {
fontDescription.Weight = (Pango.Weight) Enum.Parse(typeof(Pango.Weight), frontWeigth);
}
fontDescription.Size = fontSize * 1024;
}
f_FontDescription = fontDescription;
}