Пример #1
0
		private void ProcessInternalOptions(MainViewModel model, UIOptionSubCategoryType subCategory)
		{
			var docProvs = subCategory.Options.Find(op => op.Name == "DocumentProviders") as UIOptionGroupType;
			var defaultDocProv = subCategory.Options.Find(op => op.Name == "DefaultDocumentProvider") as UIOptionType;

			StringOption defaultDocProvOpt = CreateShellOption(null, defaultDocProv) as StringOption;
			model.AddOption(defaultDocProvOpt);

			foreach (UIOptionGroupInstanceType instance in docProvs.OptionGroupInstances)
			{
				if (instance.Name == DefaultXmlReadVisitor.InstanceTemplateName)
				{
					continue;
				}

				if (instance.Name == "Offline Document Provider")
				{
					continue;
				}

				OptionGroupInstance shelloptiongroup = CreateShellOptionGroupInstance(null, instance);
				BoolOption enabledOpt =
					(from x in shelloptiongroup.SubOptions where x.Name == "Enabled" select x).FirstOrDefault() as BoolOption;
				model.AddOption(enabledOpt);

				if (IsFeatureEnabled(instance) || model.AppModel.IsAdmin)
				{
					DMSEnableOption newOpt = new DMSEnableOption(instance.Name, enabledOpt, defaultDocProvOpt)
					                         	{
					                         		Category = model.GetCategory("DMS"),
					                         		SubCategory = model.GetSubCategory("DMS", "General")
					                         	};

					newOpt.IsEnabled = ShouldOptionBeEnabled(newOpt, model.AppModel.IsAdmin);

					model.AddOption(newOpt);
				}
			}
		}
Пример #2
0
		private void ProcessSubCategory(MainViewModel model, Dictionary<string, AreaOption> areas, Category shellCategory,
		                                UIOptionSubCategoryType subCategory)
		{
			Category shellSubCategory = model.GetSubCategory(shellCategory.Name, subCategory.Name) ??
			                            BuildShellSubCategory(shellCategory, subCategory);
			shellSubCategory.Model = model;
			foreach (var option in subCategory.Options)
			{
				ProcessOption(model, areas, shellCategory, shellSubCategory, option);
			}
		}
Пример #3
0
		private static void LoadGroup(MainViewModel viewModel, OptionBaseType opt)
		{

			Category cat = viewModel.GetSubCategory(opt.CategoryRef, opt.SubCategoryRef);
			if (cat == null)
				return;

			List<IOption> toRemove = new List<IOption>();
			foreach (IOption existingopt in cat.Options)
			{
				if (existingopt is OptionGroupInstance)
					toRemove.Add(existingopt);
			}

			foreach (IOption i in toRemove)
				cat.Options.Remove(i);


			UIOptionGroupType group = opt as UIOptionGroupType;
			foreach (var inst in group.OptionGroupInstances)
			{
				OptionGroupInstance newGroup = OptionMapper.CreateShellOptionGroupInstance(cat, inst);
				newGroup.IsDirty = true;
				newGroup.Deploy = inst.Deploy;
				newGroup.CanChangeDeploy = viewModel.AppModel.IsAdmin;

				foreach (IOption subOpt in newGroup.SubOptions)
				{
					subOpt.IsDirty = true;
					subOpt.Deploy = inst.Deploy;
					if (subOpt is EncryptionOption)
					{
						(subOpt as EncryptionOption).Value = Workshare.Interop.Options.OptionApi.GetRawString(group.Name, inst.Name, subOpt.Name, subOpt.StringValue, _entropy);
					}
				}
				cat.Options.Add(newGroup);
			}
		}