Пример #1
0
		public override void OnChangeFilter(FilterChangeEventArgs args)
		{
			RequestRefresh();
			base.OnChangeFilter(args);
		}
Пример #2
0
		void BrowseViewFilterChanged(object sender, FilterChangeEventArgs e)
		{
			ResumeRecordListRowChanges();
		}
Пример #3
0
		public void OnChangeFilter(FilterChangeEventArgs args)
		{
			CheckDisposed();

			var window = (Form) m_mediator.PropertyTable.GetValue("window");
			using (new WaitCursor(window))
			{
				Logger.WriteEvent("Changing filter.");
				// if our clerk is in the state of suspending loading the list, reset it now.
				if (SuspendLoadListUntilOnChangeFilter)
					SuspendLoadListUntilOnChangeFilter = false;
				m_list.OnChangeFilter(args);
				// Remember the active filter for this list.
				string persistFilter = DynamicLoader.PersistObject(Filter, "filter");
				m_mediator.PropertyTable.SetProperty(FilterPropertyTableId, persistFilter, PropertyTable.SettingsGroup.LocalSettings);
				// adjust menu bar items according to current state of Filter, where needed.
				m_mediator.BroadcastMessage("AdjustFilterSelection", Filter);
				UpdateFilterStatusBarPanel();
				if (m_list.Filter != null)
					Logger.WriteEvent("Filter changed: "+m_list.Filter);
				else
					Logger.WriteEvent("Filter changed: (no filter)");
				// notify clients of this change.
				if (FilterChangedByClerk != null)
					FilterChangedByClerk(this, args);
			}
		}
Пример #4
0
		private void FilterChangedHandler(object sender, FilterChangeEventArgs args)
		{
			if (FilterChanged != null)
				FilterChanged(this, args);
		}
Пример #5
0
		/// <summary>
		/// Notify clients that the clerk has changed the filter.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void Clerk_FilterChangedByClerk(object sender, FilterChangeEventArgs e)
		{
			m_fHandlingFilterChangedByClerk = true;
			// Let the client(s) know about the change.
			m_browseViewer.UpdateFilterBar(Clerk.Filter);
			m_fHandlingFilterChangedByClerk = false;
		}
Пример #6
0
		/// <summary>
		/// Signal the clerk to change its filter to the user selected value.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="args"></param>
		private void FilterChangedHandler(object sender, FilterChangeEventArgs args)
		{
			// If we're in the process of notifying clients that the clerk has changed
			// the filter, we don't need to tell the clerk to change the filter (again)!
			if (m_fHandlingFilterChangedByClerk)
				return;
			Clerk.OnChangeFilter(args);
		}
Пример #7
0
		/// <summary>
		/// Handle adding and/or removing a filter.
		/// </summary>
		/// <param name="args"></param>
		public void OnChangeFilter(FilterChangeEventArgs args)
		{
			CheckDisposed();

			if (m_filter == null)
			{
				// Had no filter to begin with
				Debug.Assert(args.Removed == null);
				m_filter = args.Added is NullFilter? null : args.Added;
			}
			else if (m_filter.SameFilter(args.Removed))
			{
				// Simplest case: we had just one filter, the one being removed.
				// Change filter to whatever (if anything) replaces it.
				m_filter = args.Added is NullFilter? null : args.Added;
			}
			else if (m_filter is AndFilter)
			{
				AndFilter af = m_filter as AndFilter;
				if (args.Removed != null)
				{
					af.Remove(args.Removed);
				}
				if (args.Added != null)
				{
					//When the user chooses "all records/no filter", the RecordClerk will remove
					//its previous filter and add a NullFilter. In that case, we don't really need to add
					//	that filter. Instead, we can just add nothing.
					if (!(args.Added is NullFilter))
						af.Add(args.Added);
				}
				// Remove AndFilter if we get down to one.
				// This is not just an optimization, it allows the last filter to be removed
				// leaving empty, so the status bar can show that there is then no filter.
				if (af.Filters.Count == 1)
					m_filter = af.Filters[0] as RecordFilter;
			}
			else
			{
				// m_filter is not an AndFilter, so can't contain the one we're removing, nor IS it the one
				// we're removing...so we have no way to remove, and it's an error if we're trying to.
				Debug.Assert(args.Removed == null || args.Removed is NullFilter);
				if (args.Added != null && !(args.Added is NullFilter)) // presumably true or nothing changed, but for paranoia..
				{
					// We already checked for m_filter being null, so we now have two filters,
					// and need to make an AndFilter.
					AndFilter af = new AndFilter();
					af.Add(m_filter);
					af.Add(args.Added);
					m_filter = af;
				}
			}
			// Now we have a new filter, we have to recompute what to show.
			ReloadList();
		}