public LibraryFilter(Configuration.ConfigLibraryList libraryListSettings) { LibraryListSettings = libraryListSettings; text = ""; filters = libraryListSettings.Filter.Filters; dateFilters = libraryListSettings.Filter.DateFilters; afterDate = libraryListSettings.Filter.AfterDate; beforeDate = libraryListSettings.Filter.BeforeDate; sortType = libraryListSettings.SortType; sortOrder = libraryListSettings.SortOrder; }
public LibraryToolStrip(LibraryFilter libraryFilter, LibraryModel libraryModel, Configuration.ConfigLibraryList libraryListSettings, int filterDelay) { InitializeComponent(); LibraryFilter = libraryFilter; LibraryModel = libraryModel; LibraryListSettings = libraryListSettings; toolStrip = new ToolStrip(); filterTextBox = new ToolStripSpringTextBox(); dateFilterButton = new ToolStripDropDownButton(); dateFilterAfterButton = new ToolStripMenuItem(); dateFilterAfterDateTimePicker = new DateTimePicker(); dateFilterBeforeButton = new ToolStripMenuItem(); dateFilterBeforeDateTimePicker = new DateTimePicker(); filterButton = new ToolStripDropDownButton(); filterNoneButton = new ToolStripMenuItem(); filterAllButton = new ToolStripMenuItem(); filterQuerySearchButton = new ToolStripMenuItem(); filterTaggedSearchButton = new ToolStripMenuItem(); sortButton = new ToolStripDropDownButton(); sortTypeCreationTimeButton = new ToolStripMenuItem(); sortTypeLastAccessTimeButton = new ToolStripMenuItem(); sortTypeLastWriteTimeButton = new ToolStripMenuItem(); sortOrderAscendingButton = new ToolStripMenuItem(); sortOrderDescendingButton = new ToolStripMenuItem(); filterTimer = new Timer(components); SuspendLayout(); // // filter textbox // filterTextBox.Dock = DockStyle.Fill; filterTextBox.Margin = new Padding(0, 0, 6, 0); filterTextBox.TextChanged += FilterTextBox_TextChanged; // // date filter button // dateFilterButton.Text = "&Date"; dateFilterButton.AutoToolTip = false; dateFilterAfterButton.Name = "after"; dateFilterAfterButton.Text = "&After"; dateFilterAfterButton.Click += DateFilterAfterButton_Click; dateFilterAfterDateTimePicker.ShowUpDown = true; dateFilterAfterDateTimePicker.ValueChanged += DateFilterAfterDateTimePicker_ValueChanged; dateFilterBeforeButton.Name = "before"; dateFilterBeforeButton.Text = "&Before"; dateFilterBeforeButton.Click += DateFilterBeforeButton_Click; dateFilterBeforeDateTimePicker.ShowUpDown = true; dateFilterBeforeDateTimePicker.ValueChanged += DateFilterBeforeDateTimePicker_ValueChanged; ContextMenuStrip dateFilterContextMenuStrip = new ContextMenuStrip(); dateFilterContextMenuStrip.ShowCheckMargin = true; dateFilterContextMenuStrip.Items.Add(dateFilterAfterButton); ToolStripControlHost afterValueControlHost = new ToolStripControlHost(dateFilterAfterDateTimePicker); dateFilterContextMenuStrip.Items.Add(afterValueControlHost); dateFilterContextMenuStrip.Items.Add(new ToolStripSeparator()); dateFilterContextMenuStrip.Items.Add(dateFilterBeforeButton); ToolStripControlHost beforeValueControlHost = new ToolStripControlHost(dateFilterBeforeDateTimePicker); dateFilterContextMenuStrip.Items.Add(beforeValueControlHost); dateFilterContextMenuStrip.Opening += DateFilterContextMenuStrip_Opening; dateFilterContextMenuStrip.RenderMode = ToolStripRenderMode.Professional; dateFilterContextMenuStrip.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow; dateFilterButton.DropDown = dateFilterContextMenuStrip; // // filter button // filterButton.Text = "&Filters"; filterButton.AutoToolTip = false; filterNoneButton.Name = "none"; filterNoneButton.Text = "&None"; filterNoneButton.Click += FilterNoneButton_Click; filterAllButton.Name = "all"; filterAllButton.Text = "&All"; filterAllButton.Click += FilterAllButton_Click; filterQuerySearchButton.Name = "folders"; filterQuerySearchButton.Text = "&Folders"; filterQuerySearchButton.Click += FilterQuerySearchButton_Click; filterTaggedSearchButton.Name = "archives"; filterTaggedSearchButton.Text = "&Archives"; filterTaggedSearchButton.Click += FilterTaggedSearchButton_Click; ContextMenuStrip filterContextMenuStrip = new ContextMenuStrip(); filterContextMenuStrip.ShowCheckMargin = true; filterContextMenuStrip.Items.Add(filterNoneButton); filterContextMenuStrip.Items.Add(filterAllButton); filterContextMenuStrip.Items.Add(new ToolStripSeparator()); filterContextMenuStrip.Items.Add(filterQuerySearchButton); filterContextMenuStrip.Items.Add(filterTaggedSearchButton); filterContextMenuStrip.Opening += FilterContextMenuStrip_Opening; filterContextMenuStrip.RenderMode = ToolStripRenderMode.Professional; filterContextMenuStrip.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow; filterButton.DropDown = filterContextMenuStrip; // // sort button // sortButton.Text = "&Sort"; sortButton.AutoToolTip = false; sortTypeCreationTimeButton.Name = "creationTime"; sortTypeCreationTimeButton.Text = "&Creation Time"; sortTypeCreationTimeButton.Click += SortTypeCreationTimeButton_Click; sortTypeLastAccessTimeButton.Name = "lastAccessTime"; sortTypeLastAccessTimeButton.Text = "Last &Access Time"; sortTypeLastAccessTimeButton.Click += SortTypeLastAccessTimeButton_Click; sortTypeLastWriteTimeButton.Name = "lastWriteTime"; sortTypeLastWriteTimeButton.Text = "Last &Write Time"; sortTypeLastWriteTimeButton.Click += SortTypeLastWriteTimeButton_Click; sortOrderAscendingButton.Name = "sort_order_ascending"; sortOrderAscendingButton.Text = "&Ascending"; sortOrderAscendingButton.Click += SortOrderAscendingButton_Click; sortOrderDescendingButton.Name = "sort_order_descending"; sortOrderDescendingButton.Text = "&Descending"; sortOrderDescendingButton.Click += SortOrderDescendingButton_Click; ContextMenuStrip sortContextMenuStrip = new ContextMenuStrip(); sortContextMenuStrip.ShowCheckMargin = true; sortContextMenuStrip.Items.Add(sortTypeCreationTimeButton); sortContextMenuStrip.Items.Add(sortTypeLastAccessTimeButton); sortContextMenuStrip.Items.Add(sortTypeLastWriteTimeButton); sortContextMenuStrip.Items.Add(new ToolStripSeparator()); sortContextMenuStrip.Items.Add(sortOrderAscendingButton); sortContextMenuStrip.Items.Add(sortOrderDescendingButton); sortContextMenuStrip.Opening += SortContextMenuStrip_Opening; sortContextMenuStrip.RenderMode = ToolStripRenderMode.Professional; sortContextMenuStrip.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow; sortButton.DropDown = sortContextMenuStrip; // // timer // filterTimer.Interval = filterDelay; filterTimer.Tick += FilterTimer_Tick; // // toolStrip // toolStrip.Dock = DockStyle.Fill; toolStrip.CanOverflow = false; toolStrip.Items.Add(filterTextBox); toolStrip.Items.Add(dateFilterButton); toolStrip.Items.Add(filterButton); toolStrip.Items.Add(sortButton); // // this // Controls.Add(toolStrip); libraryFilter.FiltersChanged += LibraryFilter_FiltersChanged; libraryFilter.DateFiltersChanged += LibraryFilter_DateFiltersChanged; libraryFilter.AfterDateChanged += LibraryFilter_AfterDateChanged; libraryFilter.BeforeDateChanged += LibraryFilter_BeforeDateChanged; libraryFilter.SortTypeChanged += LibraryFilter_SortTypeChanged; libraryFilter.SortOrderChanged += LibraryFilter_SortOrderChanged; ResumeLayout(false); }