本文整理汇总了C#中Setting类的典型用法代码示例。如果您正苦于以下问题:C# Setting类的具体用法?C# Setting怎么用?C# Setting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Setting类属于命名空间,在下文中一共展示了Setting类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getUserSpecificSettings
public static void getUserSpecificSettings(String currentUser)
{
var iso = IsolatedStorageSettings.ApplicationSettings;
// check to see if this user exists
if (!iso.Contains(currentUser + "SaveOriginal"))
{
saveOriginal = new Setting<bool>(currentUser + "SaveOriginal", true);
locationService = new Setting<bool>(currentUser + "LocationService", true);
twitterAuth = new Setting<bool>(currentUser + "TwitterAuth", false);
twitterDefault = new Setting<bool>(currentUser + "TwitterDefault", false);
}
else
{
saveOriginal = new Setting<bool>(currentUser +
"SaveOriginal", Convert.ToBoolean(IsolatedStorageSettings.ApplicationSettings[currentUser + "SaveOriginal"]));
locationService = new Setting<bool>(currentUser +
"LocationService", Convert.ToBoolean(IsolatedStorageSettings.ApplicationSettings[currentUser + "LocationService"]));
twitterAuth = new Setting<bool>(currentUser +
"TwitterAuth", Convert.ToBoolean(IsolatedStorageSettings.ApplicationSettings[currentUser + "TwitterAuth"]));
twitterDefault = new Setting<bool>(currentUser +
"TwitterDefault", Convert.ToBoolean(IsolatedStorageSettings.ApplicationSettings[currentUser + "TwitterDefault"]));
}
}
示例2: StrataOnTunnel
// tunnelX, tunnelZ is the coordinate of tunnel crown
// h is the height of tunnel
//
public static List<Result> StrataOnTunnel(double tunnelX, double tunnelZ, double h,
IView profileView, string stLayerID, Setting setting)
{
IGraphicsLayer gLayerSt = profileView.getLayer(stLayerID);
if (gLayerSt == null)
return null;
List<Result> results = new List<Result>();
Project prj = Globals.project;
Domain geology = prj.getDomain(DomainType.Geology);
DGObjectsCollection stratum = geology.getObjects("Stratum");
var stratumList = stratum.merge();
foreach (DGObject obj in stratumList)
{
Stratum strata = obj as Stratum;
IGraphicCollection gc = gLayerSt.getGraphics(strata);
if (gc == null)
continue;
Result result = StratumOnTunnel(tunnelX, tunnelZ, h, gc, profileView.spatialReference);
if (result != null)
{
result.StratumObj = gLayerSt.getObject(gc[0]);
if (result.Depth > 0 || setting.AllStrata)
results.Add(result);
}
}
return results;
}
示例3: DeleteSetting
public bool DeleteSetting(Setting setting)
{
if (setting == null) return false;
_unitOfWork.SettingRepository.Delete(setting);
_unitOfWork.Save();
return true;
}
示例4: Unicode
/// <summary>
/// 유니코드의 한글 범위를 조합합니다.
/// </summary>
/// <param name="setting">설정값을 받습니다.</param>
public Unicode(Setting setting)
{
for (int i = 0; i != setting.CharLength; i++)
{
result.Append((char)random.Next(_UNICODE_RANGE_MIN, _UNICODE_RANGE_MAX + 1));
}
}
示例5: OnSettingsChanged
private void OnSettingsChanged(object sender, Setting setting)
{
if (setting.Name == GlobalSettingNames.CaretOpacityName)
{
UpdateCaretOpacity();
}
}
示例6: addSetting
public static bool addSetting(Setting setting, string connString)
{
#region code
bool rs = false;
using (SqlConnection conn = new SqlConnection(connString))
{
try
{
conn.Open();
using (SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sony_sp_add_setting";
cmd.Parameters.AddWithValue("@name", setting.Name);
cmd.Parameters.AddWithValue("@value", setting.Value);
SqlParameter returnVal = new SqlParameter("@returnVal", SqlDbType.Int);
returnVal.Direction = ParameterDirection.Output;
cmd.Parameters.Add(returnVal);
cmd.ExecuteNonQuery();
rs = ((int)cmd.Parameters["@returnVal"].Value != 0);
}
}
catch (Exception ex)
{
return false;
}
}
return rs;
#endregion
}
示例7: SettingParseInvalidTypeException
/// <summary>
/// Constructs a new InvalidSettingTypeException.
/// </summary>
public SettingParseInvalidTypeException (Setting setting, Type parsedType)
: base (
String.Format ("Expecting setting type: {0}, doesn't match setting: {1}", parsedType.FullName, setting))
{
_setting = setting;
_parsedType = parsedType;
}
示例8: GetInstance
public static Setting GetInstance()
{
if (null == Instance) {
Instance = new Setting();
}
return Instance;
}
示例9: GetSetting
public static object GetSetting(Setting setting)
{
if (IsolatedStorageSettings.ApplicationSettings.Contains(setting.Key()))
return IsolatedStorageSettings.ApplicationSettings[setting.Key()];
else
return DefaultValue(setting);
}
示例10: LoadUserAgnetSetting
public void LoadUserAgnetSetting(Setting.Setting.UserAgentStruct userAgent)
{
checkBox_IsRandom.Checked = userAgent.IsRandom;
foreach (var i in userAgent.UserAgentList)
{
//不显示Custom值
if (i.Key == "Custom") continue;
comboBox_UserAgentList.Items.Add(i);
}
//显示选中项
if (userAgent.Selected.Key == "Custom")
{
//作为自定义内容显示在comboBox_UserAgentList.Text
comboBox_UserAgentList.Text = userAgent.Selected.Value;
}
else
{
//从现有的items中选择
foreach (object i in comboBox_UserAgentList.Items)
{
if (((KeyValuePair<string,string>)i).Key == userAgent.Selected.Key)
{
comboBox_UserAgentList.SelectedItem = i;
}
break;
}
}
}
示例11: BurnStatus
public BurnStatus( Character person, Setting setting)
: base(person)
{
duration = setting.duration;
damage = setting.damage;
maxOverlay = setting.maxOverlay;
}
示例12: SaveSetting
public void SaveSetting(Setting setting)
{
if(GetSetting() == null && setting.Id == 0)
_dataContext.Settings.Add(setting);
_dataContext.SaveChanges();
}
示例13: Insert
public void Insert(Setting setting)
{
if (storage.Settings.Where(x => x.Key == setting.Key).Count() > 0)
storage.Settings.Where(x => x.Key == setting.Key).First().Value = setting.Value;
else storage.Settings.Add(setting);
storage.SaveChanges();
}
示例14: BooleanButton
public BooleanButton(Menu.MenuSettings ms, string text, Setting<bool> setting = null)
: base(ms)
{
this.text = text;
this.isEnabled = setting == null || setting.Value;
this.setting = setting;
}
示例15: Set
public static void Set(Setting setting, string value)
{
var settingName = setting.ToString();
var bytes = Encoding.UTF8.GetBytes(value);
var encryptedBytes = ProtectedData.Protect(bytes, null);
IsolatedStorageSettings.ApplicationSettings[settingName] = encryptedBytes;
}