本文整理汇总了C#中Preferences类的典型用法代码示例。如果您正苦于以下问题:C# Preferences类的具体用法?C# Preferences怎么用?C# Preferences使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Preferences类属于命名空间,在下文中一共展示了Preferences类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TMain
internal TMain()
: base()
{
versionNumber += ", " + PrismApi.NiceVersionString;
SavePath += "\\Prism";
PlayerPath = SavePath + "\\Players";
WorldPath = SavePath + "\\Worlds" ;
PrismApi.ModDirectory = SavePath + "\\Mods";
CloudPlayerPath = "players_Prism";
CloudWorldPath = "worlds_Prism" ;
LocalFavoriteData = new FavoritesFile(SavePath + "\\favorites.json", false);
CloudFavoritesData = new FavoritesFile("/favorites_Prism.json", false);
Configuration = new Preferences(SavePath + "\\config.json", false, false);
ElapsedTime = 0;
if (Environment.OSVersion.Platform == PlatformID.Win32NT && graphics.GraphicsProfile == GraphicsProfile.Reach && GraphicsAdapter.DefaultAdapter.IsProfileSupported(GraphicsProfile.HiDef))
graphics.GraphicsProfile = GraphicsProfile.HiDef;
}
示例2: GetPhotosAsync
public async Task<PhotosResponse> GetPhotosAsync(Photoset photoset, User user, Preferences preferences, int page,
IProgress<ProgressUpdate> progress) {
var progressUpdate = new ProgressUpdate {
OperationText = "Getting list of photos...",
ShowPercent = false
};
progress.Report(progressUpdate);
var methodName = GetPhotosetMethodName(photoset.Type);
var extraParams = new Dictionary<string, string> {
{
ParameterNames.UserId, user.UserNsId
}, {
ParameterNames.SafeSearch, preferences.SafetyLevel
}, {
ParameterNames.PerPage,
preferences.PhotosPerPage.ToString(CultureInfo.InvariantCulture)
}, {
ParameterNames.Page, page.ToString(CultureInfo.InvariantCulture)
}
};
var isAlbum = photoset.Type == PhotosetType.Album;
if (isAlbum) {
extraParams.Add(ParameterNames.PhotosetId, photoset.Id);
}
var photosResponse = (Dictionary<string, object>)
await this._oAuthManager.MakeAuthenticatedRequestAsync(methodName, extraParams);
return photosResponse.GetPhotosResponseFromDictionary(isAlbum);
}
示例3: GetCoverPhotoAsync
public async Task<Photoset> GetCoverPhotoAsync(User user, Preferences preferences, bool onlyPrivate) {
var extraParams = new Dictionary<string, string> {
{
ParameterNames.UserId, user.UserNsId
}, {
ParameterNames.SafeSearch, preferences.SafetyLevel
}, {
ParameterNames.PerPage, "1"
}, {
ParameterNames.Page, "1"
}, {
ParameterNames.PrivacyFilter, onlyPrivate ? "5" : "1"
// magic numbers: https://www.flickr.com/services/api/flickr.people.getPhotos.html
}
};
var photosetsResponseDictionary = (Dictionary<string, object>)
await this._oAuthManager.MakeAuthenticatedRequestAsync(Methods.PeopleGetPhotos, extraParams);
var photo = photosetsResponseDictionary.GetPhotosResponseFromDictionary(false).Photos.FirstOrDefault();
return photo != null
? new Photoset(null, null, null, null, 0, 0, 0,
onlyPrivate ? "All Photos" : "All Public Photos", "",
onlyPrivate ? PhotosetType.All : PhotosetType.Public,
photo.SmallSquare75X75Url)
: null;
}
示例4: GetPhotosetsAsync
public async Task<PhotosetsResponse> GetPhotosetsAsync(string methodName, User user, Preferences preferences, int page,
IProgress<ProgressUpdate> progress) {
var progressUpdate = new ProgressUpdate {
OperationText = "Getting list of albums...",
ShowPercent = false
};
progress.Report(progressUpdate);
var extraParams = new Dictionary<string, string> {
{
ParameterNames.UserId, user.UserNsId
}, {
ParameterNames.SafeSearch, preferences.SafetyLevel
}, {
ParameterNames.PerPage, "21"
}, {
ParameterNames.Page, page.ToString(CultureInfo.InvariantCulture)
}
};
var photosetsResponseDictionary = (Dictionary<string, object>)
await this._oAuthManager.MakeAuthenticatedRequestAsync(methodName, extraParams);
return photosetsResponseDictionary.GetPhotosetsResponseFromDictionary();
}
示例5: TreeViewJumps
public TreeViewJumps(Gtk.TreeView treeview, Preferences preferences, ExpandStates expandState)
{
this.treeview = treeview;
this.preferences = preferences;
this.expandState = expandState;
this.pDN = preferences.digitsNumber; //pDN short and very used name
treeviewHasTwoLevels = false;
dataLineNamePosition = 0; //position of name in the data to be printed
dataLineTypePosition = 4; //position of type in the data to be printed
allEventsName = Constants.AllJumpsName;
if(preferences.weightStatsPercent)
weightName += "\n(%)";
else
weightName += "\n(Kg)";
string [] columnsStringPre = { jumperName,
Catalog.GetString("TC") + "\n(s)",
Catalog.GetString("TF") + "\n(s)",
weightName, fallName,
heightName
};
columnsString = obtainColumnsString(columnsStringPre);
eventIDColumn = columnsString.Length ; //column where the uniqueID of event will be (and will be hidden).
store = getStore(columnsString.Length +1); //+1 because, eventID is not show in last col
treeview.Model = store;
prepareHeaders(columnsString);
//on creation, treeview is minimized
expandState = ExpandStates.MINIMIZED;
}
示例6: PreferenceChangeEvent
/**
* Construct a new {@code PreferenceChangeEvent} instance.
*
* @param p
* the {@code Preferences} instance that fired this event; this object is
* considered as the event's source.
* @param k
* the changed preference key.
* @param v
* the new value of the changed preference, this value can be
* {@code null}, which means the preference has been removed.
*/
public PreferenceChangeEvent(Preferences p, String k, String v)
: base(p)
{
node = p;
key = k;
value = v;
}
示例7: LoadProjectSettingsFromRegistry
/// <summary>
/// Loads project settings from registry.
/// </summary>
public void LoadProjectSettingsFromRegistry(ref TfsTeamProjectCollection tfsTeamProjectCollection, ref ITestManagementTeamProject testManagementTeamProject, ref Preferences preferences, ITestManagementService testService, string selectedTestPlan)
{
log.Info("Load project info loaded from registry!");
string teamProjectUri = RegistryManager.Instance.GetTeamProjectUri();
string teamProjectName = RegistryManager.Instance.GetTeamProjectName();
string projectDllPath = RegistryManager.Instance.GetProjectDllPath();
if (!string.IsNullOrEmpty(teamProjectUri) && !string.IsNullOrEmpty(teamProjectName))
{
preferences.TfsUri = new Uri(teamProjectUri);
log.InfoFormat("Registry> TFS URI: {0}", preferences.TfsUri);
preferences.TestProjectName = teamProjectName;
log.InfoFormat("Registry> Test Project Name: {0}", preferences.TestProjectName);
tfsTeamProjectCollection = new TfsTeamProjectCollection(preferences.TfsUri);
log.InfoFormat("Registry> TfsTeamProjectCollection: {0}", tfsTeamProjectCollection);
testService = (ITestManagementService)tfsTeamProjectCollection.GetService(typeof(ITestManagementService));
testManagementTeamProject = testService.GetTeamProject(preferences.TestProjectName);
selectedTestPlan = RegistryManager.Instance.GetTestPlan();
log.InfoFormat("Registry> SelectedTestPlan: {0}", selectedTestPlan);
if (!string.IsNullOrEmpty(selectedTestPlan))
{
preferences.TestPlan = TestPlanManager.GetTestPlanByName(testManagementTeamProject, selectedTestPlan);
this.IsInitializedFromRegistry = true;
}
}
}
示例8: PreferencesProxy
public PreferencesProxy(Preferences prefs)
{
prefSubscribers = new Hashtable();
currentlyHandling = new Hashtable();
this.prefs = prefs;
this.enable = true;
}
示例9: OnInspectorGUI
public override void OnInspectorGUI()
{
if(invoker != null)
{
EditorGUILayout.BeginVertical("GroupBox");
EditorGUILayout.BeginHorizontal();
GUILayout.Label("Reference", EditorStyles.boldLabel);
GUILayout.Label("Component", EditorStyles.boldLabel);
GUILayout.Label("Method", EditorStyles.boldLabel);
if(GUILayout.Button("Add", GUILayout.Width(32)))
{
Preferences temp = new Preferences();
invoker.preferences.Add(temp);
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
if(invoker.Count > 0)
{
for(int i = 0; i < invoker.Count; i++)
{
EditorGUILayout.BeginHorizontal();
invoker.preferences[i].objectReference = (Transform)EditorGUILayout.ObjectField(invoker.preferences[i].objectReference, typeof(Transform), true);
if(invoker.preferences[i].objectReference != null)
{
invoker.preferences[i].monoIndex = EditorGUILayout.Popup(invoker.preferences[i].monoIndex, invoker.preferences[i].monoNames.ToArray());
invoker.preferences[i].methodIndex = EditorGUILayout.Popup(invoker.preferences[i].methodIndex, invoker.preferences[i].methodNames.ToArray());
}
if(GUILayout.Button("X", GUILayout.Width(16), GUILayout.Height(14)))
{
invoker.preferences.RemoveAt(i);
return;
}
EditorGUILayout.EndHorizontal();
if(GUI.changed)
{
invoker.preferences[i].GetMonos();
invoker.preferences[i].GetMethods();
}
EditorGUILayout.Space();
}
}
EditorGUILayout.EndVertical();
}
}
示例10: SetUp
public void SetUp()
{
//We can't run NT or File based tests on the simulator. Just auto pass them.
if (RobotBase.IsSimulation)
{
return;
}
try
{
string file = "/home/lvuser/wpilib-preferences.ini";
if (File.Exists(file))
{
File.Delete(file);
}
using (StreamWriter writer = new StreamWriter(file))
{
writer.Write("checkedValueInt = 2\ncheckedValueDouble = .2\ncheckedValueFloat = 3.14\ncheckedValueLong = 172\ncheckedValueString =\"hello \nHow are you ?\"\ncheckedValueBoolean = false");
}
}
catch (IOException exception)
{
Console.WriteLine(exception);
}
pref = Preferences.Instance;
prefTable = NetworkTable.GetTable("Preferences");
check = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
}
示例11: StatType
//comes from gui/stats.cs
public StatType(string statisticType, string statisticSubType, string statisticApplyTo, Gtk.TreeView treeview_stats,
ArrayList sendSelectedSessions, bool sex_active, int statsJumpsType, int limit,
ArrayList markedRows, int evolution_mark_consecutives, GraphROptions gRO,
bool graph, bool toReport, Preferences preferences)
{
//some of this will disappear when we use myStatTypeStruct in all classes:
this.statisticType = statisticType;
this.statisticSubType = statisticSubType;
this.statisticApplyTo = statisticApplyTo;
this.treeview_stats = treeview_stats ;
this.markedRows = markedRows;
this.evolution_mark_consecutives = evolution_mark_consecutives;
this.graph = graph;
this.toReport = toReport;
myStatTypeStruct = new StatTypeStruct (
statisticApplyTo,
sendSelectedSessions, sex_active,
statsJumpsType, limit,
markedRows, gRO,
toReport, preferences);
myStat = new Stat(); //create an instance of myStat
fakeButtonRowCheckedUnchecked = new Gtk.Button();
fakeButtonRowsSelected = new Gtk.Button();
fakeButtonNoRowsSelected = new Gtk.Button();
}
示例12: SetUp
public void SetUp()
{
NetworkTable.Shutdown();
/*
//We can't run NT or File based tests on the simulator. Just auto pass them.
if (RobotBase.IsSimulation)
{
return;
}
*/
try
{
string file = "networktables.ini";
if (File.Exists(file))
{
File.Delete(file);
}
using (StreamWriter writer = new StreamWriter(file))
{
writer.Write("[NetworkTables Storage 3.0]\ndouble \"/Preferences/checkedValueInt\"=2\ndouble \"/Preferences/checkedValueDouble\"=.2\ndouble \"/Preferences/checkedValueFloat\"=3.14\ndouble \"/Preferences/checkedValueLong\"=172\nstring \"/Preferences/checkedValueString\"=\"hello \\nHow are you ?\"\nboolean \"/Preferences/checkedValueBoolean\"=false\n");
}
}
catch (IOException exception)
{
Console.WriteLine(exception);
}
NetworkTable.Initialize();
pref = Preferences.Instance;
prefTable = NetworkTable.GetTable("Preferences");
check = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
}
示例13: Data
public Data(Preferences cPreferences, string sValue)
{
_cPreferences = cPreferences;
string[] aValues = sValue.ToLower().Split(':');
_sRequest = aValues[0];
_nTemplate = (1 < aValues.Length ? aValues[1].ToByte() : (byte)0);
_sValue = (2 < aValues.Length ? aValues[2] : null );
}
示例14: Validate
private Preferences Validate(Preferences preferences) {
var defaults = Preferences.GetDefault();
if (preferences.LogLocation == null) {
preferences.LogLevel = defaults.LogLevel;
preferences.LogLocation = defaults.LogLocation;
}
return preferences;
}
示例15: Create
public void Create(string sWorkFolder, string sData)
{
_iEffect = null;
_eStatus = BTL.EffectStatus.Idle;
_dtStatusChanged = DateTime.Now;
_sWorkFolder = sWorkFolder;
_cPreferences = new Preferences(sWorkFolder, sData);
}