本文整理汇总了C#中ISetting类的典型用法代码示例。如果您正苦于以下问题:C# ISetting类的具体用法?C# ISetting怎么用?C# ISetting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISetting类属于命名空间,在下文中一共展示了ISetting类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillSettingParameterAttributes
private static void FillSettingParameterAttributes(SettingSerializerData settingSerializerData, ISetting setting, Type settingType)
{
var propertyInfos = settingType.GetProperties().ToList();
foreach (var propertyInfo in propertyInfos)
{
var settingParameterAttribute = AttributeRetrieval.GetAttribute<SettingParameterAttribute>(propertyInfo);
if (settingParameterAttribute == null)
{
continue;
}
var settingPropertyValue = propertyInfo.GetValue(setting);
RunSettingSerializationValidation(settingType, propertyInfo, settingPropertyValue);
var settingPropertyFormattedValue = RunSettingSerializationFormat(settingParameterAttribute, settingType, propertyInfo, settingPropertyValue);
settingSerializerData.Parameters.Add(new SettingSerializerDataParameter
{
Value = settingPropertyFormattedValue,
Parameter = settingParameterAttribute,
});
}
}
示例2: SetInput
private static void SetInput( IBlock block, ISetting setting ) {
String lbl = "setting.inputControl";
String inputName = GetInputName( setting.Id );
String settingValue = setting.SettingValue;
int width = 500;
if (setting.DataType == SettingType.Int.ToString()) {
block.Set( lbl, Html.TextInput( inputName, settingValue, "width:40px;" ) );
}
else if (setting.DataType == SettingType.Bool.ToString()) {
block.Set( lbl, Html.CheckBox( inputName, "", "1", Convert.ToBoolean( setting.SettingValue ) ) );
}
else if (setting.DataType == SettingType.Droplist.ToString()) {
block.Set( lbl, Html.DropList( getDropOptions(setting.Options), inputName, "Name", "Value", setting.ValueInt ) );
}
else if (setting.DataType == SettingType.ShortText.ToString()) {
block.Set( lbl, Html.TextInput( inputName, settingValue, "width:" + width + "px;" ) );
}
else if (setting.DataType == SettingType.BigText.ToString()) {
block.Set( lbl, Html.TextArea( inputName, settingValue, "width:" + width + "px;height:300px;" ) );
}
else {
block.Set( lbl, Html.TextArea( inputName, settingValue, "width:" + width + "px;height:50px;" ) );
}
}
示例3: ReadyForNextGroupState
public ReadyForNextGroupState(ISetting setting, IGrid grid, IGroupFactory groupFactory, OnDeleteEndEventHandler onDeleteEndEvent)
{
_setting = setting;
_grid = grid;
_groupFactory = groupFactory;
_onDeleteEndEvent = onDeleteEndEvent;
}
示例4: GeneralOptionsViewModel
public GeneralOptionsViewModel(ISetting<GeneralOptions> setting, ISchedulerProvider schedulerProvider)
{
var reader = setting.Value.Subscribe(options =>
{
UseDarkTheme = options.Theme== Theme.Dark;
HighlightTail = options.HighlightTail;
HighlightDuration = options.HighlightDuration;
Scale = options.Scale;
});
var writter = this.WhenAnyPropertyChanged()
.Subscribe(vm =>
{
setting.Write(new GeneralOptions(UseDarkTheme ? Theme.Dark : Theme.Light, HighlightTail, HighlightDuration, Scale));
});
HighlightDurationText = this.WhenValueChanged(vm=>vm.HighlightDuration)
.Select(value => value.ToString("0.00 Seconds"))
.ForBinding();
ScaleText = this.WhenValueChanged(vm => vm.Scale)
.Select(value => $"{value} %" )
.ForBinding();
ScaleRatio= this.WhenValueChanged(vm => vm.Scale)
.Select(value =>(decimal)value / (decimal)100)
// .Sample(TimeSpan.FromMilliseconds(250))
.ForBinding();
_cleanUp = new CompositeDisposable(reader, writter, HighlightDurationText, ScaleText, ScaleRatio);
}
示例5: Source
public void Source(ISetting setting, TextWriter output)
{
string keyword;
string link;
switch (this.mode)
{
case StoreMode.Local:
keyword = "declare";
link = "as";
break;
default:
keyword = "set";
link = "to";
break;
}
output.Write (setting.BlockBegin);
output.Write (keyword);
output.Write (' ');
output.Write (this.name);
output.Write (' ');
output.Write (link);
output.Write (' ');
output.Write (this.expression);
output.Write (setting.BlockEnd);
}
示例6: Game
public Game(IGrid grid, ISetting setting)
{
_setting = setting;
_grid = grid;
currentControl = _grid;
}
示例7: SmartCPUBehaviour
public SmartCPUBehaviour(IGrid grid, ISetting setting, CPUMode difficulty)
{
_grid = grid;
_gridSimulator = new GridSimulator(grid, setting);
_outputter = new OutputBestMovement(_gridSimulator);
_grid.OnGroupAdd += new OnGroupAddEventHandler(OnGroupAddEvent);
Debug.Log("difficulty " + difficulty + "set");
switch(difficulty)
{
case CPUMode.Easy:
timeBeforeAction = 0.5f;
timeBetweenActions = 0.5f;
break;
case CPUMode.Normal:
timeBeforeAction = 0.5f;
timeBetweenActions = 0.3f;
break;
case CPUMode.Hard:
timeBeforeAction = 0.2f;
timeBetweenActions = 0.1f;
break;
case CPUMode.Kusotuyo:
timeBeforeAction = 0f;
timeBetweenActions = 0f;
break;
}
}
示例8: Set
public void Set(ISetting setting)
{
ISetting found = _settings.FirstOrDefault(s => s.Name == setting.Name);
if (found != null)
_settings.Remove(found);
_settings.Add(setting);
}
示例9: Source
public void Source(ISetting setting, TextWriter output)
{
output.Write (setting.BlockBegin);
output.Write ("for ");
if (!string.IsNullOrEmpty (this.key))
{
output.Write (this.key);
output.Write (", ");
}
output.Write (this.value);
output.Write (" in ");
output.Write (this.from);
output.Write (":");
this.body.Source (setting, output);
if (this.empty != null)
{
output.Write (setting.BlockContinue);
output.Write ("empty:");
this.empty.Source (setting, output);
}
output.Write (setting.BlockEnd);
}
示例10: RecentSearchCollection
public RecentSearchCollection(ILogger logger, ISetting<RecentSearch[]> setting)
{
if (logger == null) throw new ArgumentNullException("logger");
_logger = logger;
Items = _files.Connect()
.RemoveKey()
.AsObservableList();
var loader = setting.Value.Subscribe(files =>
{
_files.Edit(innerCache =>
{
//all files are loaded when state changes, so only add new ones
var newItems = files
.Where(f => !innerCache.Lookup(f.Text).HasValue)
.ToArray();
innerCache.AddOrUpdate(newItems);
});
});
var settingsWriter = _files.Connect()
.ToCollection()
.Subscribe(items =>
{
setting.Write(items.ToArray());
});
_cleanUp = new CompositeDisposable(settingsWriter, loader, _files,Items);
}
示例11: Create
public IGroup Create(ISetting setting)
{
IGroup nextGroup = _groupStocks[0];
var parent = nextGroup.Parent;
if (parent != null)
{
var childCount = parent.childCount;
for(int i = 0; i < childCount; i++)
{
var child = parent.GetChild(0);
child.SetParent(setting.Parent);
child.localScale = setting.Parent.localScale;
}
parent.gameObject.AddComponent<DestroyGameObject>();
}
else
{
nextGroup.Offset = Vector3.zero;
}
_groupStocks.Remove(_groupStocks[0]);
CreateNextStock(setting);
return nextGroup;
}
示例12: Source
public void Source(ISetting setting, TextWriter output)
{
output.Write (setting.BlockBegin);
output.Write ("dump ");
output.Write (this.expression);
output.Write (setting.BlockEnd);
}
示例13: getDataLineContainer
private HtmlGenericControl getDataLineContainer(ISetting setting)
{
HtmlGenericControl div_line = new HtmlGenericControl("div");
div_line.Attributes.Add("class", "control-line-of-controls");
HtmlGenericControl div_data_label = new HtmlGenericControl("div");
div_data_label.Attributes.Add("style", "padding-top: 3px; float: left; width: 200px");
div_data_label.Attributes.Add("align", "left");
div_data_label.Attributes.Add("class", "control-label");
div_data_label.InnerText = getLocalResource(setting);
HtmlGenericControl div_data_input = new HtmlGenericControl("div");
div_data_input.Attributes.Add("style", "float: left; width: 360px");
TextBox box = new TextBox
{
Text = setting.Value.ToString()
, ID = string.Format(m_objectKey, setting.SettingAttribute.SettingName)
, CssClass = "control-textbox"
, EnableTheming = false
};
box.Attributes.Add("style", "width: 100%");
div_data_input.Controls.Add(box);
div_line.Controls.Add(div_data_label);
div_line.Controls.Add(div_data_input);
return div_line;
}
示例14: Serialize
public static string Serialize(ISetting setting)
{
var settingData = GetSettingData(setting);
var settingSerializer = new SettingSerializerWriter(settingData);
return settingSerializer.Write();
}
示例15: GridEventManager
public GridEventManager(ISetting setting, IGrid grid, IGroupFactory groupFactory)
{
_grid = grid;
_groupFactory = groupFactory;
_setting = setting;
}