Пример #1
0
        public Form1()
        {
            InitializeComponent();

            BackgroundDownloader.Start();

            mSelectedMatrixRows        = new List <int>();
            mSelectedMatrixCellRows    = new List <int>();
            mSelectedMatrixCellColumns = new List <int>();
            mHighlightedCells          = new List <Point>();

            LoadData(false);
        }
Пример #2
0
        public void Start_Normal_OK()
        {
            // Arrange
            BackgroundDownloader downloader =
                new BackgroundDownloader(
                    TestApp.Repositories,
                    TestApp.PodCastDownloader,
                    TestApp.EpisodeSaver);

            // Act
            downloader.Start();

            // Assert
            Thread.Sleep(1000);
        }
Пример #3
0
        public void ChangeToChapter(string chapter)
        {
            chapter = simple_to_full_chapter_[chapter];

            if (chapter == current_chapter_)
            {
                return;
            }
            current_chapter_ = chapter;

            string url = website_ + current_chapter_;

            if (!chapter_to_background_.ContainsKey(chapter))
            {
                List <Image> new_storage = new List <Image>();
                chapter_to_images_[chapter] = new_storage;
                BackgroundDownloader bd = new BackgroundDownloader(url, new_storage);
                chapter_to_background_[chapter] = bd;
                bd.Start();
            }

            current_page_index_ = 0;

            List <Image> storage = chapter_to_images_[current_chapter_];
            Image        img     = null;

            while (img == null)
            {
                try {
                    Monitor.Enter(storage);
                    if (storage.Count == 0)
                    {
                        continue;
                    }
                    else
                    {
                        img = storage[current_page_index_];
                    }
                }
                finally {
                    Monitor.Exit(storage);
                }
            }

            MangaKitsuneForm.Inst.DrawImage(img);
        }