void FilterSelected(FilterExpression filterExpression) {
			SelectUiElement(filterExpression);
			if (exprEditor != null)
				exprEditor.SelectFilter(filterExpression);
			else {
				dbg.Error("Interface not initialized!");
			}
		}
		void SelectUiElement(FilterExpression filterExpression) {
			if (AppDefaults.visualSettings.UseOnlyCommonFilterView) {
				exprEditor = new ExpressionDefaultEditor(arguments, AddFilter);
				panelFilterEditor.Children.Clear();
				panelFilterEditor.Children.Add((UserControl)exprEditor);
			} else {
				if (filterExpression.Dialect != null &&
					filterExpression.Dialect != DefaultDialects.dialecttopic1.dialect &&
					filterExpression.Dialect != DefaultDialects.dialecttopic2.dialect &&
					filterExpression.Dialect != DefaultDialects.dialectcontent1.dialect) {
					exprEditor = new ExpressionDefaultEditor(arguments, AddFilter);
					panelFilterEditor.Children.Clear();
					panelFilterEditor.Children.Add((UserControl)exprEditor);
				} else {
					exprEditor = new ExpressionFilterEditor(arguments, AddFilter);
					panelFilterEditor.Children.Clear();
					panelFilterEditor.Children.Add((UserControl)exprEditor);
				}
			}

		}
		void AddFilter(FilterExpression filter) {
			filtersList.Add(filter);
		}
		public void SelectFilter(FilterExpression filter) {
			valueExpression.Text = filter.Value;

			Dialects.ForEach(itm => {
				if (itm.dialect == filter.Dialect)
					valueExpressionType.SelectedItem = itm;
			});
		}
Пример #5
0
 void AddFilter(FilterExpression filter)
 {
     filtersList.Add(filter);
 }
		void FillExpressionTypeDialect(FilterExpression filter) {
			var tp = filter.FilterType;
			DialectsDictionary.Clear();

			FilterExpression.filterTypeNames.ForEach(x => {
				if (x.Key == tp) {
					valueExpressionType.SelectedItem = x;
				}
			});

			if (valueExpressionType.SelectedItem != null) {
				fillDialectByType(filter.FilterType);
				if (filter.Dialect != null) {
					DialectsDictionary.ForEach(d => {
						if (d.Key == filter.Dialect)
							valueExpressionDialect.SelectedItem = d;
					});
				}
			}	
		} 
		public void SelectFilter(FilterExpression filter) {
			if (filter == null)
				return;
			//fill type and dialect
			FillExpressionTypeDialect(filter);
			
			//fill expression
			ExpressionValue = filter.Value;
			//fill prefix list
			PrefixList.Clear();

			var arr = filter.Namespaces.ToArray();
			arr.ForEach(it=>{
				PrefixList.Add(new PrefixSpacePair() { Prefix = it.Name, Space = it.Namespace });
			});
		}