本文整理汇总了C#中Service.SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Service.SetProperty方法的具体用法?C# Service.SetProperty怎么用?C# Service.SetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service.SetProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateService
private Service CreateService(ParseTreeNode node)
{
Service service = new Service(game.GetPlugin(grammar.GetName(node)));
foreach (Tuple<string, object> property in GetProperties(node))
{
ParseTreeNode propertyNode = (ParseTreeNode)property.Item2;
service.SetProperty(property.Item1, new Value(getStrVal(propertyNode)));
}
return service;
}
示例2: Workspace
private Workspace()
{
Plugins = new ObservableCollection<Plugin>();
Services = new FilteredObservableCollection<Plugin>(Plugins, p => p.Type == PluginType.Service);
Managers = new FilteredObservableCollection<Plugin>(Plugins, p => p.Type == PluginType.Manager);
Components = new FilteredObservableCollection<Plugin>(Plugins, p => p.Type == PluginType.Component);
Events = new ObservableCollection<StatementFactory>();
Actions = new ObservableCollection<StatementFactory>();
Statements = new ObservableCollection<StatementFactory>();
NewProjectCommand = new DelegateCommand(null, p =>
{
var create = true;
if (null != Project && CommandHistory.HasUnsavedChanges)
{
DialogService.Warn(Messages.NewProject, Messages.UnsavedMessage, MessageBoxButton.YesNoCancel, r =>
{
if (r == MessageBoxResult.Yes)
{
SaveProject();
}
else if (r == MessageBoxResult.Cancel)
{
create = false;
}
});
}
if (create)
{
Game game = new Game("Untitled Game");
KglGameStorage.AddDefaultUsings(game);
var service = new Service(GetPlugin(typeof(RenderService)));
service.SetProperty("Width", new Value(800, true));
service.SetProperty("Height", new Value(600, true));
game.AddService(service);
var scene = new Scene("Scene1");
var manager = new Manager(GetPlugin(typeof(RenderManager)));
scene.AddManager(manager);
game.AddScene(scene);
game.FirstScene = scene;
Project project = new Project();
project.Game = game;
DialogService.ShowDialog<ProjectDialog>(project, (result) =>
{
if (result == true)
{
ProjectStorage.CreateProject(project);
Project = project;
}
});
}
});
LoadProjectCommand = new DelegateCommand(null, p =>
{
var load = true;
if (null != Project && CommandHistory.HasUnsavedChanges)
{
DialogService.Warn(Messages.LoadProject, Messages.UnsavedMessage, MessageBoxButton.YesNoCancel, r =>
{
if (r == MessageBoxResult.Yes)
{
SaveProject();
}
else if (r == MessageBoxResult.Cancel)
{
load = false;
}
});
}
if (load)
{
DialogService.ShowLoadDialog((result, fileName) =>
{
if (result == true)
{
try
{
LoadProject(fileName);
}
catch (EditorException e)
{
DialogService.Warn(Messages.FailedToLoad, e.Message, MessageBoxButton.OK);
}
}
});
}
});
//.........这里部分代码省略.........