public async Task <List <RecycleStorageItem> > GetRecycleBinItemsAsync()
        {
            try
            {
                IsNowHasAnyActionExcuting = true;

                if (await TryConnectToFullTrustExutor().ConfigureAwait(true))
                {
                    ValueSet Value = new ValueSet
                    {
                        { "ExcuteType", ExcuteType_Get_RecycleBinItems }
                    };

                    AppServiceResponse Response = await Connection.SendMessageAsync(Value);

                    if (Response.Status == AppServiceResponseStatus.Success && !Response.Message.ContainsKey("Error") && !string.IsNullOrEmpty(Convert.ToString(Response.Message["RecycleBinItems_Json_Result"])))
                    {
                        List <Dictionary <string, string> > Items  = JsonConvert.DeserializeObject <List <Dictionary <string, string> > >(Convert.ToString(Response.Message["RecycleBinItems_Json_Result"]));
                        List <RecycleStorageItem>           Result = new List <RecycleStorageItem>(Items.Count);

                        foreach (Dictionary <string, string> PropertyDic in Items)
                        {
                            FileSystemStorageItem Item = WIN_Native_API.GetStorageItems(PropertyDic["ActualPath"]).FirstOrDefault();
                            Result.Add(new RecycleStorageItem(Item, PropertyDic["OriginPath"], DateTime.FromBinary(Convert.ToInt64(PropertyDic["CreateTime"]))));
                        }

                        return(Result);
                    }
                    else
                    {
                        return(new List <RecycleStorageItem>(0));
                    }
                }
                else
                {
                    return(new List <RecycleStorageItem>(0));
                }
            }
            catch
            {
                return(new List <RecycleStorageItem>(0));
            }
            finally
            {
                IsNowHasAnyActionExcuting = false;
            }
        }
        public RecycleStorageItem(FileSystemStorageItem Item, string OriginPath, DateTimeOffset CreateTime)
        {
            if (Item == null)
            {
                throw new ArgumentNullException(nameof(Item), "Argument could not be null");
            }

            this.OriginPath    = OriginPath;
            ModifiedTimeRaw    = CreateTime;
            StorageType        = Item.StorageType;
            InternalPathString = Item.Path;
            Thumbnail          = Item.Thumbnail;

            if (StorageType != StorageItemTypes.Folder)
            {
                SizeRaw = Item.SizeRaw;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 初始化PhotoDisplaySupport的实例
 /// </summary>
 /// <param name="ImageSource">缩略图</param>
 /// <param name="File">文件</param>
 public PhotoDisplaySupport(FileSystemStorageItem Item)
 {
     PhotoFile = Item;
 }