public void PropertiesTest() { var vm = new ConnectionSetupEdit(); TestsHelper.TestPublicPropertiesGetSet(vm, x => vm.SystemName); }
public void GetSetPropertiesTest() { var tag = new ConnectionSetupEdit(); TestsHelper.TestPublicPropertiesGetSet(tag, x=>tag.SystemName); }
private static void Static(WeakEventListener<ConnectionSettingsViewModel, ConnectionSetupEdit, ChildChangedEventArgs> listener, ConnectionSetupEdit source) { source.ChildChanged -= listener.OnEvent; }
/// <summary> /// The edit expression. /// </summary> /// <param name="parentWindow"> /// The parent window. /// </param> /// <param name="variableList"> /// The variable list. /// </param> /// <param name="connection"> /// The connection. /// </param> /// <param name="expressionDesignerString"> /// The expression designer string. /// </param> /// <param name="saveAction"> /// The save action. /// </param> /// <param name="cancelAction"> /// The cancel action. /// </param> /// <param name="removeAction"> /// The remove action. /// </param> public void EditExpression( ITopLevelWindow parentWindow, DataVariableEditList variableList, ConnectionSetupEdit connection, string expressionDesignerString, Action saveAction, Action cancelAction, Action removeAction) { const string expressionResult = "Expression Result"; this.saveAction = saveAction; this.cancelAction = cancelAction; this.removeAction = removeAction; var source = new SourceFieldList { ExpressionName = "Received Data", Top = 10, Left = 10 }; source.Fields.Add(new SourceField(null) { DataType = NodeDataType.String, Name = "Data", SetName = "Data", SystemName = "Data", ConnectorOut = { DataType = NodeDataType.String, Name = "Data" } }); var expressions = new List<IExpressionObjectBase>(); var isNew = true; ExpressionContainer expressionsContainer; try { expressionsContainer = Serializer.Deserialize(expressionDesignerString); } catch { expressionsContainer = null; } if (!string.IsNullOrWhiteSpace(expressionDesignerString) && expressionsContainer != null) { isNew = false; var destinationFieldList = expressionsContainer.Expressions.FirstOrDefault(x => x.ExpressionName == expressionResult) as DestinationFieldList; if (destinationFieldList != null) { var newVariablesField = GetVariableList(variableList, expressionResult).Fields; var oldEdited = from f in newVariablesField where destinationFieldList.Fields.Select(x => x.SystemName).Contains(f.SystemName) select f; if (oldEdited.Any()) { foreach (var field in oldEdited) { var nf = destinationFieldList.Fields.First(x => x.SystemName == field.SystemName); nf.DataType = field.DataType; nf.Name = field.Name; } } foreach (var field in newVariablesField) { if (destinationFieldList.Fields.All(x => x.SystemName != field.SystemName)) { destinationFieldList.Fields.Add(field); } } //remove old field var oldList = new HashSet<string>(); foreach (var des in destinationFieldList.Fields) { if (newVariablesField.All(x => x.SystemName != des.SystemName)) { oldList.Add(des.SystemName); } } if (oldList.Any()) { foreach (var item in oldList) { var remove = destinationFieldList.Fields.FirstOrDefault(x => x.SystemName == item); if (remove != null) { destinationFieldList.Fields.Remove(remove); } } } } expressions.AddRange(expressionsContainer.Expressions); } else { expressions.Add(source); expressions.Add(GetVariableList(variableList, expressionResult)); } if (expressionsContainer != null) { var sourceFieldList = (from fl in expressions where fl is SourceFieldList select fl).Cast<SourceFieldList>().FirstOrDefault(); if (sourceFieldList != null) { var fieldList = sourceFieldList.Fields.Cast<IExpressionField>().ToList(); UpdateStoredFields(fieldList, source.Fields, (sf) => FinalizeUpdate(sourceFieldList, fieldList, source, expressions, parentWindow)); // Here we load all subtypes async that's why we need reload window after all subtypes are loaded } } if (!isNew) { return; } this.expressionDesigner.Diagram.Items.Clear(); ExpressionTranslator.TranslateToDiagram(expressions, this.expressionDesigner.Diagram); WindowManager.Value.ShowChildWindow(parentWindow, this); }
public void Initialize(ConnectionSetupEdit model, IConnectionListViewModel parent) { if (model == null) return; Model = model; ParentViewModel = parent; SelectedConnectionType = model.ConnectionType; SelectedComputerConnection = model.ComputerConnectionList.FirstOrDefault(); AffectedProcess = new ObservableCollection<AffectedProcessExternalDataCriteria>(); SetEventListener(); }