本文整理汇总了C#中Page.FindOrAdd方法的典型用法代码示例。如果您正苦于以下问题:C# Page.FindOrAdd方法的具体用法?C# Page.FindOrAdd怎么用?C# Page.FindOrAdd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page.FindOrAdd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstallPreferences
private void InstallPreferences()
{
bansheePrefs = ServiceManager.Get<PreferenceService>();
if (bansheePrefs == null){
return;
}
Page remoteControlPage = new Page("RemoteControl","Remote Control",3);
bansheePrefs.FindOrAdd(remoteControlPage);
Section BansheeRemotePrefs = remoteControlPage.FindOrAdd(new Section("BansheeRemote","Banshee Remote",0));
port_pref = BansheeRemotePrefs.Add (new SchemaPreference<int>(
RemotePortSchema,
Catalog.GetString("Banshee Remote port"),
Catalog.GetString("Banshee will listen for the Android Banshee Remote app on this port")));
logging_pref = BansheeRemotePrefs.Add (new SchemaPreference<bool>(
LoggingSchema,
Catalog.GetString("Banshee Remote Logging"),
Catalog.GetString("Enables or disables logging")));
}
示例2: Page
void IExtensionService.Initialize()
{
_prefs = ServiceManager.Get<PreferenceService>();
if (_prefs == null) {
return;
}
Page remoteControlPage = new Page("RemoteControl", "Remote Control", 3);
_prefs.FindOrAdd(remoteControlPage);
Section BansheeRemotePrefs = remoteControlPage.FindOrAdd(
new Section("BansheeRemote", "Banshee Remote", 0));
_portPref = BansheeRemotePrefs.Add(new SchemaPreference<int>(
RemotePortSchema,
Catalog.GetString("Port"),
Catalog.GetString("Banshee will listen for remote control requests on this port")
));
_passIdPref = BansheeRemotePrefs.Add(new SchemaPreference<int>(
RemotePassIdSchema,
Catalog.GetString("Password ID"),
Catalog.GetString("\"Secret\" ID which is required to be specified in incoming requests")
));
_prefs["RemoteControl"]["BansheeRemote"]["remote_control_passid"].ValueChanged += delegate {
_passId = (int) _prefs["RemoteControl"]["BansheeRemote"]["remote_control_passid"].BoxedValue;
};
_prefs["RemoteControl"]["BansheeRemote"]["remote_control_port"].ValueChanged += delegate {
StartRemoteListener();
};
_disposed = false;
ServiceManager.SourceManager.SourceRemoved += OnSourceRemoved;
_passId = (int) _prefs["RemoteControl"]["BansheeRemote"]["remote_control_passid"].BoxedValue;
Helper.SetDbCompressTimeFromFile();
Helper.CompressDatabase();
StartRemoteListener();
}