Пример #1
0
 public BlogReaderViewModel(Controllers.IBlogReaderController mainController)
 {
     // Asigna el manager de blogs y el controlador de vistas
     BlogManager     = new Application.BlogReaderManager();
     ViewsController = mainController;
     // Asigna los objetos
     ConfigurationViewModel = new Configuration.ConfigurationViewModel(this);
     TreeBlogs           = new Blogs.TreeBlogs.TreeBlogsViewModel(this);
     BlogDownloadProcess = new Controllers.Process.BlogDownloadProcess(this);
 }
        /// <summary>
        ///		Inicializa el módulo
        /// </summary>
        public override void InitModule()
        {
            Controllers.Process.BlogDownloadProcess downloader = new Controllers.Process.BlogDownloadProcess(MinutesBetweenDownload, DownloadEnabled);

            // Inicializa el evento de descarga
            downloader.DownloadProcess += (sender, evntArgs) =>
            {
                HostController.Messenger.SendLog(ModuleName, MessageLog.LogType.Information,
                                                 ModuleName, evntArgs.Description, null);
                SendMesageChangeStatus(null);
            };
            downloader.BlogEntryDownload += (sender, evntArgs) =>
            {
                HostController.Messenger.SendParameters(ModuleName, "DOWNLOAD_BLOG_ENTRY",
                                                        "DOWNLOAD", GetParametersBlog(evntArgs.BlogEntry), null);
            };
            // Carga los datos
            BlogManager.Load();
            // Inicializa el proceso de descarga planificada de blogs
            HostController.Scheduler.AddProcess(downloader);
        }