本文整理汇总了C#中IPreferences.Get方法的典型用法代码示例。如果您正苦于以下问题:C# IPreferences.Get方法的具体用法?C# IPreferences.Get怎么用?C# IPreferences.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPreferences
的用法示例。
在下文中一共展示了IPreferences.Get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecentFilesProvider
public RecentFilesProvider (IPreferences prefs)
{
NumRecentDocs = prefs.Get<int> ("NumRecentDocs", 7);
RefreshRecentDocs ();
Gtk.RecentManager.Default.Changed += delegate { RefreshRecentDocs (); };
}
示例2: Initialize
public void Initialize (IPreferences preferences)
{
if (preferences == null)
throw new ArgumentNullException ("preferences");
this.preferences = preferences;
// *************************************
// AUTHENTICATION to Remember The Milk
// *************************************
string authToken = preferences.Get (PreferencesKeys.AuthTokenKey);
if (authToken != null) {
Logger.Debug ("Found AuthToken, checking credentials...");
try {
Rtm = new RtmNet.Rtm (ApiKey, SharedSecret, authToken);
rtmAuth = Rtm.AuthCheckToken (authToken);
Timeline = Rtm.TimelineCreate ();
Logger.Debug ("RTM Auth Token is valid!");
Logger.Debug ("Setting configured status to true");
IsConfigured = true;
} catch (RtmNet.RtmApiException e) {
preferences.Set (PreferencesKeys.AuthTokenKey, null);
preferences.Set (PreferencesKeys.UserIdKey, null);
preferences.Set (PreferencesKeys.UserNameKey, null);
Rtm = null;
rtmAuth = null;
Logger.Error ("Exception authenticating, reverting "
+ e.Message);
} catch (RtmNet.ResponseXmlException e) {
Rtm = null;
rtmAuth = null;
Logger.Error ("Cannot parse RTM response. " +
"Maybe the service is down. " + e.Message);
} catch (RtmNet.RtmWebException e) {
Rtm = null;
rtmAuth = null;
Logger.Error ("Not connected to RTM, maybe proxy: #{0}",
e.Message);
} catch (System.Net.WebException e) {
Rtm = null;
rtmAuth = null;
Logger.Error ("Problem connecting to internet: #{0}",
e.Message);
}
}
if (Rtm == null) {
Rtm = new RtmNet.Rtm (ApiKey, SharedSecret);
return;
}
FinishInitialization ();
}
示例3: ProxyDockItem
public ProxyDockItem (AbstractDockItemProvider provider, IPreferences prefs)
{
StripMnemonics = false;
Provider = provider;
Provider.ItemsChanged += HandleProviderItemsChanged;
this.prefs = prefs;
if (prefs == null) {
currentPos = 0;
} else {
currentPos = prefs.Get<int> ("CurrentIndex", 0);
if (CurrentPosition >= Provider.Items.Count ())
CurrentPosition = 0;
}
ItemChanged ();
}
示例4: RtmPreferencesWidget
public RtmPreferencesWidget(RtmBackend backend, IPreferences preferences)
: base()
{
if (backend == null)
throw new ArgumentNullException ("backend");
if (preferences == null)
throw new ArgumentNullException ("preferences");
this.backend = backend;
this.preferences = preferences;
LoadPreferences ();
BorderWidth = 0;
// We're using an event box so we can paint the background white
EventBox imageEb = new EventBox ();
imageEb.BorderWidth = 0;
imageEb.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
imageEb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255));
imageEb.Show ();
VBox mainVBox = new VBox(false, 0);
mainVBox.BorderWidth = 10;
mainVBox.Show();
Add(mainVBox);
// Add the rtm logo
image = new Gtk.Image (normalPixbuf);
image.Show();
//make the dialog box look pretty without hard coding total size and
//therefore clipping displays with large fonts.
Alignment spacer = new Alignment((float)0.5, 0, 0, 0);
spacer.SetPadding(0, 0, 125, 125);
spacer.Add(image);
spacer.Show();
imageEb.Add (spacer);
mainVBox.PackStart(imageEb, true, true, 0);
// Status message label
statusLabel = new Label();
statusLabel.Justify = Gtk.Justification.Center;
statusLabel.Wrap = true;
statusLabel.LineWrap = true;
statusLabel.Show();
statusLabel.UseMarkup = true;
statusLabel.UseUnderline = false;
authButton = new LinkButton (
#if GETTEXT
Catalog.GetString ("Click Here to Connect"));
#elif ANDROID
#endif
authButton.Clicked += OnAuthButtonClicked;
if ( isAuthorized ) {
statusLabel.Text = "\n\n" +
#if GETTEXT
Catalog.GetString ("You are currently connected");
#elif ANDROID
#endif
string userName = preferences.Get (PreferencesKeys.UserNameKey);
if (userName != null && userName.Trim () != string.Empty)
statusLabel.Text = "\n\n" +
#if GETTEXT
Catalog.GetString ("You are currently connected as") +
#elif ANDROID
#endif
"\n" + userName.Trim();
} else {
statusLabel.Text = "\n\n" +
#if GETTEXT
Catalog.GetString ("You are not connected");
#elif ANDROID
#endif
authButton.Show();
}
mainVBox.PackStart(statusLabel, false, false, 0);
mainVBox.PackStart(authButton, false, false, 0);
Label blankLabel = new Label("\n");
blankLabel.Show();
mainVBox.PackStart(blankLabel, false, false, 0);
}
示例5: Initialize
public void Initialize ()
{
prefs = DockServices.Preferences.Get<ThemeService> ();
DockTheme = prefs.Get ("Theme", DefaultTheme);
}