Пример #1
0
        internal static SmartItem[] SelectedItems(this ListView list, SmartCollection collection)
        {
            if (list.SelectedItems.Count == 0)
            {
                return(null);
            }
            SmartItem[] items = new SmartItem[list.SelectedItems.Count];

            try { list.SelectedItems.CopyTo(items, 0); }
            catch (Exception exp) { ExceptionHelper.Log(exp); }

            list.UnselectAll();
            if (items.Length == 0)
            {
                return(null);
            }

            List <SmartItem> itemsList = new List <SmartItem>();

            for (int i = 0; i < items.Length; i++)
            {
                if ((items[i].Status == ItemStatus.CreateError) || ((items[i].Status == ItemStatus.UploadError) && (items[i].Length == 0)))
                {
                    AppMessage.Add("\"" + items[i].ItemName + "\" Dose not Exist.", MessageType.Warning);
                    collection.Remove(items[i]);
                }
                else
                {
                    itemsList.Add(items[i]);
                }
            }

            return((itemsList.Count > 0) ? itemsList.ToArray() : null);
        }
Пример #2
0
        internal async Task <bool> SetItemsAsync(string path)
        {
            if (CacheFolders)
            {
                PathHelper.AddEndningSlash(ref path);

                if (CachedFolders.ContainsKey(BrowsedPath))
                {
                    CachedFolders[BrowsedPath] = new SmartCollection();
                    CachedFolders[BrowsedPath].SetItems(Items);
                }

                if (CachedFolders.ContainsKey(path))
                {
                    BrowsedPath = path;
                    Items       = CachedFolders[path];
                    return(true);
                }
            }

            SmartItem[] _ServerItems = await getServerItemsAsync(path, true);

            if (_ServerItems != null)
            {
                Items.SetItems(_ServerItems);
                if (CacheFolders)
                {
                    CachedFolders.Add(path, null);
                }
                return(true);
            }

            return(false);
        }
Пример #3
0
 private static void _set()
 {
     CachedFolders = new Dictionary <string, SmartCollection>();
     Items         = new SmartCollection();
     BrowsedPath   = string.Empty;
     HomePath      = string.Empty;
 }
Пример #4
0
        internal void SetItems(SmartCollection collection)
        {
            this.Items.Clear();
            ClearCache();
            Files   = collection.Files;
            Folders = collection.Folders;

            for (int i = 0; i < collection.Items.Count; i++)
            {
                this.Items.Add(collection.Items[i]);
            }

            base.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
        }