Exemple #1
0
            public void BindData(ExplerAdapter adapter, int position, ExplerItem item)
            {
                Path.Text = item.Name;
                Layout.SetOnClickListener(new AnonymousOnClickListener(v => adapter.ItemClick(item)));
                Path.SetOnClickListener(new AnonymousOnClickListener(v => adapter.ItemClick(item)));

                if (item.IsPicture)
                {
                    var thumbnail = TryCatch.Current.Invoke(null, () => GetImageThumbnail(item.FullName, Icon.Width, Icon.Height));
                    if (thumbnail == null)
                    {
                        Icon.SetImageResource(item.Icon);
                    }
                    else
                    {
                        Icon.SetImageBitmap(thumbnail);
                    }
                }
                else
                {
                    Icon.SetImageResource(item.Icon);
                }

                Size.Text = item.Size.FormetFileSize();
                Layout.SetOnLongClickListener(new AnonymousLongClickListener(v =>
                {
                    adapter.SelectedPosition = position;
                    return(false);
                }));
            }
Exemple #2
0
        void RenameClick(ExplerItem item, string text)
        {
            var last    = item.FullName.LastIndexOf(item.Name);
            var path    = item.FullName.Substring(0, last);
            var newPath = $"{path}{text}";

            TryCatch.Current.Invoke(() => File.Move(item.FullName, newPath));
        }
Exemple #3
0
        public void Add(ExplerAdapter adater, ExplerItem item, int position)
        {
            var one = new FileSizeAsyncTask(adater, item, position);

            this.Add(one);
            one.Owner = this;
            one.Execute();
        }
Exemple #4
0
 protected virtual void ItemClick(ExplerItem item)
 {
     if (item.IsDirectory)
     {
         Adapter.SetData(item.FullName);
     }
     else
     {
         TryCatch.Current.Show($"{item.Name}不是文件夹");
     }
 }
Exemple #5
0
 public FileSizeAsyncTask(ExplerAdapter adater, ExplerItem item, int position)
 {
     Adapter  = adater;
     Item     = item;
     Position = position;
 }