Beispiel #1
0
        private void chapterListContextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (dgvNovelList.SelectedRows.Count == 0)
            {
                return;
            }
            if (e.ClickedItem.Text == "Read")
            {
                string novelTitle = dgvNovelList.SelectedRows[0].Cells["NovelTitle"].Value.ToString();
                Novel  novel      = NovelLibrary.Instance.GetNovel(novelTitle);

                SetAllNovelUnread();
                novel.Reading = true;

                if (nrf == null || !nrf.Visible)
                {
                    nrf = new NovelReaderForm();
                    nrf.StartPosition = FormStartPosition.Manual;
                    nrf.DesktopBounds = Configuration.Instance.NovelReaderRect;
                    nrf.Show();
                }
                nrf.SetReadingNovel(novel);
                Console.WriteLine(novelTitle);
            }
            else if (e.ClickedItem.Text == "Update")
            {
                string novelTitle = dgvNovelList.SelectedRows[0].Cells["NovelTitle"].Value.ToString();
                Novel  novel      = NovelLibrary.Instance.GetNovel(novelTitle);
                BackgroundService.Instance.UpdateSingleNovel(novel);
                Console.WriteLine(novelTitle);
            }
            else if (e.ClickedItem.Text == "Edit Source")
            {
                string novelTitle = dgvNovelList.SelectedRows[0].Cells["NovelTitle"].Value.ToString();
                Novel  novel      = NovelLibrary.Instance.GetNovel(novelTitle);
                BackgroundService.Instance.novelSourceController.SetNovel(novel);
                this.Visible = false;
                Console.WriteLine(novelTitle);
            }
            else if (e.ClickedItem.Text == "Delete")
            {
                string       novelTitle   = dgvNovelList.SelectedRows[0].Cells["NovelTitle"].Value.ToString();
                DialogResult deleteResult = MessageBox.Show("Are you sure you want to delete " + novelTitle + "?", "Delete Novel", MessageBoxButtons.YesNo);
                if (deleteResult == DialogResult.No)
                {
                    return;
                }

                DialogResult deleteDataResult = MessageBox.Show("Do you want to delete the data also? ", "Delete All Data", MessageBoxButtons.YesNo);
                if (deleteDataResult == DialogResult.Yes)
                {
                    BackgroundService.Instance.DeleteNovel(novelTitle, true);
                }
                else
                {
                    BackgroundService.Instance.DeleteNovel(novelTitle, false);
                }
            }
        }
Beispiel #2
0
        private void dgvNovelList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row        = dgvNovelList.Rows[e.RowIndex];
            string          novelTilte = row.Cells["NovelTitle"].Value.ToString();
            Novel           novel      = NovelLibrary.Instance.GetNovel(novelTilte);

            SetAllNovelUnread();
            novel.Reading = true;

            if (nrf == null || !nrf.Visible)
            {
                nrf = new NovelReaderForm();
                nrf.StartPosition = FormStartPosition.Manual;
                nrf.DesktopBounds = Configuration.Instance.NovelReaderRect;
                nrf.Show();
            }
            nrf.SetReadingNovel(novel);
        }
        private void dgvNovelList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row = dgvNovelList.Rows[e.RowIndex];
            string novelTilte = row.Cells["NovelTitle"].Value.ToString();
            Novel novel = NovelLibrary.Instance.GetNovel(novelTilte);

            SetAllNovelUnread();
            novel.Reading = true;

            if (nrf == null || !nrf.Visible)
            {
                nrf = new NovelReaderForm();
                nrf.StartPosition = FormStartPosition.Manual;
                nrf.DesktopBounds = Configuration.Instance.NovelReaderRect;
                nrf.Show();
            }
            nrf.SetReadingNovel(novel);
        }