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


C# MainViewModel.Clear方法代码示例

本文整理汇总了C#中MainViewModel.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# MainViewModel.Clear方法的具体用法?C# MainViewModel.Clear怎么用?C# MainViewModel.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MainViewModel的用法示例。


在下文中一共展示了MainViewModel.Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildModel

		public static MainViewModel BuildModel(MainViewModel model, bool loadAdminDefaults = false, bool loadFactoryDefaults = false, bool loadUserOptionsAsAdmin = false)
		{
			model.Clear();
			UIOptionRootType optionsRoot = OptionMapper.DefaultXmlToOptionModel();
			if (!loadFactoryDefaults)
			{
				bool isAdminModel = true;

				/*
				 * In the scenerio that we are in admin mode and we are loading user settings, 
				 * we need to pretend we're a normal user. So we check flag loadUserOptionsAsAdmin. 
				 */
				if (loadUserOptionsAsAdmin || !model.AppModel.IsAdmin)
					isAdminModel = false;

				OptionMapper.UpdateOptionModelWithCurrent(optionsRoot, isAdminModel || loadAdminDefaults);
			}

			if (!model.AppModel.IsAdmin)
			{
				// Filter out Categories ... based upon Enabled Features
				FilterCategories(optionsRoot);
			}

			OptionMapper.OptionModelToUIModel(model, optionsRoot);
			if (model.AppModel.IsAdmin)
			{
				// For Admin mode, we first load the 'current = XML + HKLM', and then the 'default = 'XML'.
				// Now, 'default' will not be having any info about the DocumentProviders as they are
				// defined as OptionGroupInstances (i.e., dynamic), and hence not a part of the XML.
				// So, when the 'current' is loaded, we cache the value of the DocumentProviders from
				// the 'internal' node, which is then used to 'update/dirty' up the 'default' model
				if (loadFactoryDefaults)
				{
					// Loading the 'default' model - 'update/dirty' with cached data for DocumentProviders
					OptionMapper.UpdateInternalSubCategory(model, optionsRoot, _internalSubCategory);
					_internalSubCategory = null;
				}
				else
				{
					// Loading the 'current' model - cache the value of the DocumentProviders
					UIOptionCategoryType internalCat = optionsRoot.Categories.Find(cat => cat.Name == "Internal");
					_internalSubCategory = internalCat.SubCategories.Find(cat => cat.Name == "Internal");
				}
			}

			return model;
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:48,代码来源:OptionsLoadSaveHelper.cs


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