Пример #1
0
        private async Task LoadLibrary()
        {
            Logger.Verbose("ManagerController.LoadLibrary:Start");
            managerService.BlogFiles.Clear();
            string path = Path.Combine(shellService.Settings.DownloadLocation, "Index");

            try
            {
                if (Directory.Exists(path))
                {
                    {
                        IReadOnlyList <IBlog> files = await GetIBlogsAsync(path);

                        foreach (IBlog file in files)
                        {
                            managerService.BlogFiles.Add(file);
                        }

                        BlogManagerFinishedLoadingLibrary?.Invoke(this, EventArgs.Empty);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Verbose("ManagerController:LoadLibrary: {0}", ex);
                shellService.ShowError(ex, Resources.CouldNotLoadLibrary, ex.Data["Filename"]);
            }
            Logger.Verbose("ManagerController.LoadLibrary:End");
        }
Пример #2
0
        private async Task LoadLibraryAsync()
        {
            Logger.Verbose("ManagerController.LoadLibrary:Start");
            _managerService.BlogFiles.Clear();
            string path = Path.Combine(_shellService.Settings.DownloadLocation, "Index");

            if (Directory.Exists(path))
            {
                IReadOnlyList <IBlog> files = await GetIBlogsAsync(path);

                foreach (IBlog file in files)
                {
                    _managerService.BlogFiles.Add(file);
                }
            }

            BlogManagerFinishedLoadingLibrary?.Invoke(this, EventArgs.Empty);
            Logger.Verbose("ManagerController.LoadLibrary:End");
        }
Пример #3
0
        private async Task LoadLibraryAsync()
        {
            Logger.Verbose("ManagerController.LoadLibrary:Start");
            _managerService.BlogFiles.Clear();

            foreach (var collection in _shellService.Settings.Collections)
            {
                var path = collection.DownloadLocation;

                if (Directory.Exists(path))
                {
                    collection.IsOnline = true;
                    path = Path.Combine(path, "Index");
                    if (Directory.Exists(path))
                    {
                        IReadOnlyList <IBlog> files = await GetIBlogsAsync(path);

                        foreach (IBlog file in files)
                        {
                            _managerService.BlogFiles.Add(file);
                        }
                    }
                    else
                    {
                        Directory.CreateDirectory(path);
                    }
                }
                else if (string.Compare(Directory.GetParent(path).FullName, path, true) != 0 && Directory.GetParent(path).Exists)
                {
                    collection.IsOnline = true;
                }
                else
                {
                    collection.IsOnline = false;
                }
            }

            BlogManagerFinishedLoadingLibrary?.Invoke(this, EventArgs.Empty);
            Logger.Verbose("ManagerController.LoadLibrary:End");
        }