Example #1
0
		public AppSettingsPageVM(AppSettingsPage page, PageContext context) {
			if (page == null)
				throw new ArgumentNullException(nameof(page));
			if (context == null)
				throw new ArgumentNullException(nameof(context));
			Page = page;
			Children = new List<AppSettingsPageVM>();
			this.context = context;
		}
Example #2
0
        static AppSettingsPageVM TryCreate(object obj, IAppSettingsPageContainerMetadata md, PageContext context)
        {
            Guid?guid = md.Guid == null ? null : TryParseGuid(md.Guid);

            Debug.Assert(guid != null, "Invalid GUID");
            if (guid == null)
            {
                return(null);
            }

            Guid?parentGuid = md.ParentGuid == null ? rootGuid : TryParseGuid(md.ParentGuid);

            Debug.Assert(parentGuid != null, "Invalid Parent GUID");
            if (parentGuid == null)
            {
                return(null);
            }

            if (string.IsNullOrEmpty(md.Title))
            {
                return(null);
            }

            var title = ResourceHelper.GetString(obj, md.Title);
            var icon  = ImageReferenceHelper.GetImageReference(obj, md.Icon) ?? ImageReference.None;

            return(new AppSettingsPageVM(new AppSettingsPageContainer(title, md.Order, guid.Value, parentGuid.Value, icon), context));
        }
Example #3
0
 public AppSettingsPageVM(AppSettingsPage page, PageContext context)
 {
     Page         = page ?? throw new ArgumentNullException(nameof(page));
     Children     = new List <AppSettingsPageVM>();
     this.context = context ?? throw new ArgumentNullException(nameof(context));
 }