Beispiel #1
0
        /*============PrivateFunction=======*/

        private void SetControl()
        {
            dgvNovelList.AutoGenerateColumns = false;

            DataGridViewCell               novelTitleCell         = new DataGridViewTextBoxCell();
            DataGridViewCell               rankingCell            = new DataGridViewTextBoxCell();
            DataGridViewCell               chapterCountStatusCell = new DataGridViewTextBoxCell();
            DataGridViewLinkCell           sourceEditLinkCell     = new DataGridViewLinkCell();
            DataGridViewCheckBoxCell       makeAudioCell          = new DataGridViewCheckBoxCell();
            UpdateDataGridViewProgressCell updateProgressCell     = new UpdateDataGridViewProgressCell();

            DataGridViewTextBoxColumn novelTitleColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate     = novelTitleCell,
                Name             = "NovelTitle",
                HeaderText       = "Novel Title",
                DataPropertyName = "NovelTitle",
                AutoSizeMode     = DataGridViewAutoSizeColumnMode.AllCells,
                ReadOnly         = true
            };

            DataGridViewTextBoxColumn rankingColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate     = rankingCell,
                Name             = "Rank",
                HeaderText       = "Rank",
                DataPropertyName = "Rank",
                Width            = 50,
                ReadOnly         = true
            };

            DataGridViewTextBoxColumn chapterCountStatusColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate     = chapterCountStatusCell,
                Name             = "ChapterCountStatus",
                HeaderText       = "Chapters",
                DataPropertyName = "ChapterCountStatus",
                AutoSizeMode     = DataGridViewAutoSizeColumnMode.AllCells,
                ReadOnly         = true
            };

            DataGridViewComboBoxColumn stateColumn = new DataGridViewComboBoxColumn()
            {
                Name             = "State",
                HeaderText       = "State",
                DataPropertyName = "State",
                DataSource       = Enum.GetValues(typeof(Novel.NovelState)),
                ValueType        = typeof(Novel.NovelState),
                AutoSizeMode     = DataGridViewAutoSizeColumnMode.AllCells,
                FlatStyle        = FlatStyle.Popup
                                   //Width = 100
            };

            DataGridViewCheckBoxColumn makeAudioColumn = new DataGridViewCheckBoxColumn()
            {
                CellTemplate     = makeAudioCell,
                Name             = "MakeAudio",
                HeaderText       = "Make Audio",
                DataPropertyName = "MakeAudio",
                AutoSizeMode     = DataGridViewAutoSizeColumnMode.AllCells,
                FlatStyle        = FlatStyle.Popup
                                   //Width = 100,
            };

            DataGridViewLinkColumn editSourceLinkColumn = new DataGridViewLinkColumn()
            {
                CellTemplate = sourceEditLinkCell,
                Name         = "SourceEdit",
                HeaderText   = "Edit Source",
                Text         = "Edit",
                UseColumnTextForLinkValue = true,
                LinkColor        = Color.Blue,
                VisitedLinkColor = Color.Blue,
                AutoSizeMode     = DataGridViewAutoSizeColumnMode.AllCells
            };

            UpdateDataGridViewProgressColumn updateProgressColumn = new UpdateDataGridViewProgressColumn()
            {
                CellTemplate     = updateProgressCell,
                Name             = "UpdateProgress",
                HeaderText       = "Update Progress",
                DataPropertyName = "UpdateProgress",
                AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill
                                   //Width = 250,
            };

            dgvNovelList.Columns.Add(rankingColumn);
            dgvNovelList.Columns.Add(novelTitleColumn);
            dgvNovelList.Columns.Add(chapterCountStatusColumn);
            dgvNovelList.Columns.Add(stateColumn);
            dgvNovelList.Columns.Add(makeAudioColumn);
            dgvNovelList.Columns.Add(editSourceLinkColumn);
            dgvNovelList.Columns.Add(updateProgressColumn);


            dgvNovelList.DataSource = NovelLibrary.Instance.NovelList;
        }
        /*============PrivateFunction=======*/

        private void BindGrid()
        {
            dgvNovelList.AutoGenerateColumns = false;

            DataGridViewCell novelTitleCell = new DataGridViewTextBoxCell();
            DataGridViewCell rankingCell = new DataGridViewTextBoxCell();
            DataGridViewCell chapterCountCell = new DataGridViewTextBoxCell();
            DataGridViewCell newChapterCountCell = new DataGridViewTextBoxCell();
            DataGridViewCheckBoxCell makeAudioCell = new DataGridViewCheckBoxCell();
            UpdateDataGridViewProgressCell updateProgressCell = new UpdateDataGridViewProgressCell();

            DataGridViewTextBoxColumn novelTitleColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate = novelTitleCell,
                Name = "NovelTitle",
                HeaderText = "Novel Title",
                DataPropertyName = "NovelTitle",
                Width = 200,
                ReadOnly = true
            };

            DataGridViewTextBoxColumn rankingColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate = rankingCell,
                Name = "Rank",
                HeaderText = "Rank",
                DataPropertyName = "Rank",
                Width = 100,
                ReadOnly = true
            };

            DataGridViewTextBoxColumn chapterCountColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate = chapterCountCell,
                Name = "ChapterCount",
                HeaderText = "Chapter Count",
                DataPropertyName = "ChapterCount",
                Width = 150,
                ReadOnly = true
            };

            DataGridViewTextBoxColumn newChapterCountColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate = newChapterCountCell,
                Name = "NewChapterCount",
                HeaderText = "New Chapter Count",
                DataPropertyName = "NewChapterCount",
                Width = 150,
                ReadOnly = true
            };

            DataGridViewComboBoxColumn stateColumn = new DataGridViewComboBoxColumn()
            {
                Name = "State",
                HeaderText = "State",
                DataPropertyName = "State",
                DataSource = Enum.GetValues(typeof(Novel.NovelState)),
                ValueType = typeof(Novel.NovelState),
                Width = 100
            };

            DataGridViewCheckBoxColumn makeAudioColumn = new DataGridViewCheckBoxColumn()
            {
                CellTemplate = makeAudioCell,
                Name = "MakeAudio",
                HeaderText = "Make Audio",
                DataPropertyName = "MakeAudio",
                Width = 100,
            };

            UpdateDataGridViewProgressColumn updateProgressColumn = new UpdateDataGridViewProgressColumn()
            {
                CellTemplate = updateProgressCell,
                Name = "UpdateProgress",
                HeaderText = "Update Progress",
                DataPropertyName = "UpdateProgress",
                Width = 100,
            };
            
            dgvNovelList.Columns.Add(novelTitleColumn);
            dgvNovelList.Columns.Add(rankingColumn);
            dgvNovelList.Columns.Add(chapterCountColumn);
            dgvNovelList.Columns.Add(newChapterCountColumn);
            dgvNovelList.Columns.Add(stateColumn);
            dgvNovelList.Columns.Add(makeAudioColumn);
            dgvNovelList.Columns.Add(updateProgressColumn);

            dgvNovelList.DataSource = NovelLibrary.Instance.NovelList;


        }
        /*============PrivateFunction=======*/

        private void BindGrid()
        {
            dgvNovelList.AutoGenerateColumns = false;

            DataGridViewCell               novelTitleCell      = new DataGridViewTextBoxCell();
            DataGridViewCell               rankingCell         = new DataGridViewTextBoxCell();
            DataGridViewCell               chapterCountCell    = new DataGridViewTextBoxCell();
            DataGridViewCell               newChapterCountCell = new DataGridViewTextBoxCell();
            DataGridViewCheckBoxCell       makeAudioCell       = new DataGridViewCheckBoxCell();
            UpdateDataGridViewProgressCell updateProgressCell  = new UpdateDataGridViewProgressCell();

            DataGridViewTextBoxColumn novelTitleColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate     = novelTitleCell,
                Name             = "NovelTitle",
                HeaderText       = "Novel Title",
                DataPropertyName = "NovelTitle",
                Width            = 200,
                ReadOnly         = true
            };

            DataGridViewTextBoxColumn rankingColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate     = rankingCell,
                Name             = "Rank",
                HeaderText       = "Rank",
                DataPropertyName = "Rank",
                Width            = 100,
                ReadOnly         = true
            };

            DataGridViewTextBoxColumn chapterCountColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate     = chapterCountCell,
                Name             = "ChapterCount",
                HeaderText       = "Chapter Count",
                DataPropertyName = "ChapterCount",
                Width            = 150,
                ReadOnly         = true
            };

            DataGridViewTextBoxColumn newChapterCountColumn = new DataGridViewTextBoxColumn()
            {
                CellTemplate     = newChapterCountCell,
                Name             = "NewChapterCount",
                HeaderText       = "New Chapter Count",
                DataPropertyName = "NewChapterCount",
                Width            = 150,
                ReadOnly         = true
            };

            DataGridViewComboBoxColumn stateColumn = new DataGridViewComboBoxColumn()
            {
                Name             = "State",
                HeaderText       = "State",
                DataPropertyName = "State",
                DataSource       = Enum.GetValues(typeof(Novel.NovelState)),
                ValueType        = typeof(Novel.NovelState),
                Width            = 100
            };

            DataGridViewCheckBoxColumn makeAudioColumn = new DataGridViewCheckBoxColumn()
            {
                CellTemplate     = makeAudioCell,
                Name             = "MakeAudio",
                HeaderText       = "Make Audio",
                DataPropertyName = "MakeAudio",
                Width            = 100,
            };

            UpdateDataGridViewProgressColumn updateProgressColumn = new UpdateDataGridViewProgressColumn()
            {
                CellTemplate     = updateProgressCell,
                Name             = "UpdateProgress",
                HeaderText       = "Update Progress",
                DataPropertyName = "UpdateProgress",
                Width            = 100,
            };

            dgvNovelList.Columns.Add(novelTitleColumn);
            dgvNovelList.Columns.Add(rankingColumn);
            dgvNovelList.Columns.Add(chapterCountColumn);
            dgvNovelList.Columns.Add(newChapterCountColumn);
            dgvNovelList.Columns.Add(stateColumn);
            dgvNovelList.Columns.Add(makeAudioColumn);
            dgvNovelList.Columns.Add(updateProgressColumn);

            dgvNovelList.DataSource = NovelLibrary.Instance.NovelList;
        }