Beispiel #1
0
        /// <summary>
        /// Creates a new ShellViewModel
        /// </summary>
        /// <param name="main">Main view model</param>
        /// <param name="manager">Window manager</param>
        /// <param name="task">Mangas task</param>
        /// <param name="tray">Tray icon</param>
        public ShellViewModel(MainViewModel main, IWindowManager manager, MangasTask task,
            TrayIcon tray)
        {
            main_ = main;
            manager_ = manager;
            open_ = false;
            task_ = task;
            tray_ = tray;

            task_.MangaUpdated += TaskMangaUpdated;

            tray_.ItemClicked += IconItemClicked;
            tray_.DoubleClicked += IconDoubleClicked;
            tray_.NotificationClicked += IconNotificationClicked;

            tray_.AddItem(kShow);
            tray_.AddSeparator();
            tray_.AddItem(kStart);
            tray_.AddItem(kStop);
            tray_.AddSeparator();
            tray_.AddItem(kExit);

            tray_.Show();

            task_.Start();
        }
Beispiel #2
0
 /// <summary>
 /// Creates a new ChapterViewModel
 /// </summary>
 /// <param name="manga">Manga</param>
 /// <param name="chapter">Chapter to wrap</param>
 /// <param name="task">Mangas task</param>
 public ChapterViewModel(Manga manga, Chapter chapter, MangasTask task)
 {
     chapter_ = chapter;
     chapter_.Read += OnChapterRead;
     manga_ = manga;
     task_ = task;
 }
Beispiel #3
0
        /// <summary>
        /// Creates a new MainViewModel
        /// </summary>
        public MainViewModel(IChapterViewModelFactory chapter_factory, DialogManager dialog, MangasTask task,
            IMangaViewModelFactory manga_factory)
        {
            DisplayName = "MeliMelo - Mangas";

            chapter_factory_ = chapter_factory;
            dialog_ = dialog;
            manga_factory_ = manga_factory;
            mangas_ = new BindableCollection<MangaViewModel>();
            selected_manga_ = null;
            task_ = task;
        }
Beispiel #4
0
        /// <summary>
        /// Creates a new MangaViewModel
        /// </summary>
        /// <param name="factory">Chapter factory</param>
        /// <param name="manga">Manga to wrap</param>
        /// <param name="task">Mangas task</param>
        public MangaViewModel(IChapterViewModelFactory factory, Manga manga, MangasTask task)
        {
            DisplayName = manga.Name;

            chapters_ = new List<ChapterViewModel>();
            factory_ = factory;
            manga_ = manga;
            manga_.NewChapter += OnMangaNewChapter;
            task_ = task;

            foreach (var chapter in manga_.Chapters)
                chapters_.Add(factory_.Create(manga_, chapter, task_));
        }