示例#1
0
        public async static Task FillGeneralProperties(PropertiesFlyoutGeneral flyout, StorageFile file, BasicProperties basicProps)
        {
            try
            {
                if (!string.IsNullOrEmpty(file.DisplayType))
                    flyout.SetPropsKindTitle(file.DisplayType);

                DocumentProperties doc = await file.Properties.GetDocumentPropertiesAsync();
                if (doc != null)
                {
                    if (doc.Author != null && doc.Author.Count > 0)
                        flyout.Authors.Text = NameCreditsStr("", doc.Author);
                    else
                        flyout.HideAuthors();

                    if (!string.IsNullOrEmpty(doc.Title))
                        flyout.DocumentTitle.Text = doc.Title;
                    else
                        flyout.HideDocumentTitle();

                    if (!string.IsNullOrEmpty(doc.Comment))
                        flyout.Comments.Text = doc.Comment.Substring(0, Math.Min(200, doc.Comment.Length));
                    else
                        flyout.HideComments();

                    if (doc.Keywords != null && doc.Keywords.Count > 0)
                        flyout.Keywords.Text = NameCreditsStr("", doc.Keywords);
                    else
                        flyout.HideKeywords();
                }

                if (!string.IsNullOrEmpty(file.ContentType))
                    flyout.ContentType.Text = file.ContentType;
                else
                    flyout.HideContentType();

                if (basicProps != null && basicProps.DateModified.Year > 1700)
                    flyout.DateModified.Text = DateTime_ToString(basicProps.DateModified, EDateTimeFormat.G);
                else
                    flyout.HideDateModified();

                if (file.DateCreated.Year > 1700)
                    flyout.DateCreated.Text = DateTime_ToString(file.DateCreated, EDateTimeFormat.G);
                else
                    flyout.HideDateCreated();

                FileAttributes attr = file.Attributes;
                if ((uint)attr > 0)
                    flyout.Attributes.Text = attr.ToString();
                else
                    flyout.HideAttributes();

                //if (!string.IsNullOrEmpty(file.FolderRelativeId))
                //    flyout.FolderRelativeId.Text = file.FolderRelativeId;
                //else
                flyout.HideFolderRelativeId();

                //DisplayName
                //IsAvailable
            }
            catch (Exception ex) { Debug.WriteLine(ex.ToString()); }
        }