예제 #1
0
        /// <summary>OKボタンクリックイベント</summary>
        /// <param name="sender">発生元オブジェクト</param>
        /// <param name="e">イベント情報</param>
        private void OkButton_Click(object sender, EventArgs e)
        {
            this.Shelf.Title = this.txtBookListName.Text;
            this.Shelf.DuplicateFolderPath = this.DuplicateFolderTextBox.Text;

            if (this.Shelf.FileNames.Any(i => i.FieldType == FieldType.Title) == false)
            {
                MessageBox.Show(Resources.InfoAutoAddedTitle, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Shelf.FileNames.Clear();
                this.Shelf.FileNames.Add(new FileNameModel("(", ") ", FieldType.Type, string.Empty));
                this.Shelf.FileNames.Add(new FileNameModel("[", "] ", FieldType.Writer, string.Empty));
                this.Shelf.FileNames.Add(new FileNameModel(string.Empty, " ", FieldType.Title, string.Empty));
                this.Shelf.FileNames.Add(new FileNameModel("第", "巻 ", FieldType.No, string.Empty));
                this.Shelf.FileNames.Add(new FileNameModel(string.Empty, " ", FieldType.SubTitle, string.Empty));
                this.Shelf.FileNames.Add(new FileNameModel("[", "] ", FieldType.ReleaseDate, string.Empty));
            }

            // 詳細リスト
            this.Shelf.Columns.Clear();
            foreach (ListViewItem item in this.ColumnListView.Items)
            {
                var listItem = new ColumnModel(BookModel.GetFieldType(item.Text), Convert.ToInt32(item.SubItems[1].Text));
                this.Shelf.Columns.Add(listItem);
            }

            this.Shelf.CollectSubTitle = this.CollectSubTitleCheckBox.Checked;
            this.Shelf.WriteJson();

            Settings.Default.IsAutoSave = this.AutoSaveCheckBox.Checked;
            Settings.Default.Save();

            this.DialogResult = DialogResult.OK;
            this.Dispose();
        }
예제 #2
0
        /// <summary>詳細表示:検索イベント</summary>
        /// <param name="sender">発生元オブジェクト</param>
        /// <param name="e">イベントデータ</param>
        private void DetailList_SearchSelected(object sender, SelectSearchEventArgs e)
        {
            this.cboFinderType.SelectedItem = e.FieldType.LabelName();
            this.SearchFinderComboBox.Text  = e.Value;
            var searchItem = new SearchModel(BookModel.GetFieldType(this.cboFinderType.Text), this.SearchFinderComboBox.Text);

            this.shelf.Books.RefreshSearchCriterias(searchItem);
            this.GroupListBox.Focus();

            // 検索フィルタ表示
            this.spcDetail.Panel1Collapsed        = false;
            this.ShowSearchFilterMenuItem.Checked = true;
        }
예제 #3
0
        /// <summary>ボタンクリックイベント</summary>
        /// <param name="sender">発生元オブジェクト</param>
        /// <param name="e">イベント情報</param>
        private void ColumnAddButton_Click(object sender, EventArgs e)
        {
            using (var dlgColumnSelect1 = new ColumnDialog())
            {
                var i = ((FieldType[])Enum.GetValues(typeof(FieldType))).Select(f => f.LabelName()).ToArray();
                dlgColumnSelect1.TypeComboBox.Items.AddRange(i);

                if (dlgColumnSelect1.ShowDialog() == DialogResult.OK)
                {
                    this.ColumnListView.Items.Add(BookModel.GetFieldType(dlgColumnSelect1.TypeComboBox.Text).LabelName())
                    .SubItems.Add("100");
                }
            }
        }
예제 #4
0
        /// <summary>詳細リストビュー 列クリックイベント</summary>
        /// <param name="sender">発生元オブジェクト</param>
        /// <param name="e">イベント情報</param>
        private void DetailListView_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            var columns = this.DetailListView.Columns.Cast <ColumnHeader>().ToList();

            columns.ForEach(c => c.Text = c.Text.Replace(Resources.ColumnOrderAsc, string.Empty));
            columns.ForEach(c => c.Text = c.Text.Replace(Resources.ColumnOrderDesc, string.Empty));

            // クリックされた列によりソートキーを指定
            this.Books.SortKey = BookModel.GetFieldType(this.DetailListView.Columns[e.Column].Text);

            columns[e.Column].Text = (this.books.IsSortOrderAsc ? Resources.ColumnOrderAsc : Resources.ColumnOrderDesc)
                                     + this.DetailListView.Columns[e.Column].Text;

            this.DetailListView.Refresh();
        }
예제 #5
0
        /// <summary>グループリストボックス 選択インデックス変更イベント</summary>
        /// <param name="sender">発生元オブジェクト</param>
        /// <param name="e">イベントデータ</param>
        private void GroupListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (((string)this.GroupListBox.SelectedItem) != Resources.GroupAll)
            {
                var gourpName  = this.GroupTypeComboBox.Text.Replace("別", string.Empty);
                var searchType = BookModel.GetFieldType(gourpName);
                var model      = new SearchModel(searchType, this.GroupListBox.Text);
                this.finds.RefreshSearchCriterias(model);
            }
            else
            {
                this.finds.RefreshSearchCriterias(new SearchModel(FieldType.Title, SearchModel.ALL));
            }

            this.DetailList.Refresh();

            Debug.Print($"GroupListBox 選択値:{this.GroupListBox.Text}");
        }
예제 #6
0
        /// <summary>種別コンボボックス ドロップダウンクローズイベント</summary>
        /// <param name="sender">発生元オブジェクト</param>
        /// <param name="e">イベントデータ</param>
        private void GroupTypeComboBox_DropDownClosed(object sender, EventArgs e)
        {
            this.finds.RefreshSearchCriterias(new SearchModel(FieldType.Title, SearchModel.ALL));

            var gourpName  = this.GroupTypeComboBox.Text.Replace("別", string.Empty);
            var searchType = BookModel.GetFieldType(gourpName);

            this.GroupListBox.Items.Clear();
            if (searchType == FieldType.Favorite)
            {
                this.GroupListBox.Items.Add(Resources.Favorite);
            }
            else
            {
                this.GroupListBox.Items.Add(Resources.GroupAll);
                this.GroupListBox.Items.AddRange(this.finds.GetCollectValues(searchType).ToArray());
            }

            this.GroupListBox.SelectedIndex = 0;
            this.selectedGroupTypeIndex     = this.GroupTypeComboBox.SelectedIndex;
        }
예제 #7
0
        /// <summary>
        /// OKボタンクリックイベント
        /// </summary>
        /// <param name="sender">発生元オブジェクト</param>
        /// <param name="e">イベント情報</param>
        private void OK_Button_Click(object sender, EventArgs e)
        {
            if (this.FieldTypeComboBox.Text == Resources.Title && this.SearchCombobox.Text == string.Empty)
            {
                MessageBox.Show(Resources.ErrorSelectChangeReplaceStringNotFound, Application.ProductName, MessageBoxButtons.OK);
                return;
            }

            this.Models.ReplaceValue(BookModel.GetFieldType(this.FieldTypeComboBox.Text), this.SearchCombobox.Text, this.cboValue.Text);

            if (Settings.Default.IsAutoSave)
            {
                foreach (var model in this.Models)
                {
                    this.Shelf.FileNames.ChangeFileName(model);
                }
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }