当前位置: 首页>>代码示例>>C#>>正文


C# Service.SetProperty方法代码示例

本文整理汇总了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;
 }
开发者ID:kinectitude,项目名称:kinectitude,代码行数:10,代码来源:KglGameStorage.cs

示例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);
                            }
                        }
                    });
                }
            });
//.........这里部分代码省略.........
开发者ID:kinectitude,项目名称:kinectitude,代码行数:101,代码来源:Workspace.cs


注:本文中的Service.SetProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。