virtual internal void InitialExplorer(ExplorerFactoryBase factory)
        {
            if (factory.IsNull())
            {
                throw new ArgumentNullException("factory");
            }

            RemoveExplorer();
            this.RootFactory = factory;
            this.RootFactory.GetRootFoldersAsync((items) =>
            {
                this.RunOnUIThread(() =>
                {
                    try
                    {
                        foreach (var item in items)
                        {
                            if (RootFolder.IsNull())
                            {
                                LogHelper.Debug("RootFolder is NULL, add root");
                                RootFolder = item;
                                if (RootFolder is LocalRootFolder)
                                {
                                    (RootFolder as LocalRootFolder).DriverChanged += FileExplorerViewModel_DriverChanged;
                                }
                            }
                            else
                            {
                                //Not implement now
                                //if (item is CloudRootFolder)
                                //{
                                //    if (0 == string.Compare(item.FolderPath, RootFolder.FolderPath))
                                //    {
                                //        LogHelper.Debug("Duplicate root for CloudRootFolder, so ignore this callback");
                                //        continue;
                                //    }
                                //}
                            }
                            this.Items.Add(item);
                        }
                    }
                    catch (Exception ex)
                    {
                        LogHelper.Debug(string.Format("InitialExplorer error:{0}", ex.Message));
                    }
                });

                FileBase.RaiseCheckedChanged(RootFolder, false);
            });
        }
示例#2
0
        internal void InitialExplorer(ExplorerFactoryBase factory)
        {
            if (factory.IsNull())
            {
                throw new ArgumentNullException("factory");
            }

            RemoveExplorer();
            this.RootFactory = factory;
            this.RootFactory.GetRootFoldersAsync((items) =>
            {
                this.RunOnUIThread(() =>
                {
                    foreach (var item in items)
                    {
                        if (RootFolder.IsNull())
                        {
                            RootFolder = item;
                        }
                        this.Items.Add(item);
                    }
                });
            });
        }