partial void PexConstructor(IVortexObject parent, string readableTail, string symbolTail) { this._modeController._changeMode.LogPayloadDecoration = () => LogStepDetailsInfo(); this._modeController._stepBackward.LogPayloadDecoration = () => LogStepDetailsInfo(); this._modeController._stepForward.LogPayloadDecoration = () => LogStepDetailsInfo(); this._modeController._stepIn.LogPayloadDecoration = () => LogStepDetailsInfo(); }
partial void PexConstructor(IVortexObject parent, string readableTail, string symbolTail) { _createTask.InitializeExclusively(Create); _readTask.InitializeExclusively(Read); _updateTask.InitializeExclusively(Update); _deleteTask.InitializeExclusively(Delete); }
/// <summary> /// Get the Plain (POCO) object populated with current online data. /// </summary> /// <remarks> /// This method uses dynamic casting, which may impact the performance of the data exchange. /// </remarks> /// <param name="obj">Onliner from which the plain is created.</param> /// <returns>Plain (POCO) object populated with current online data.</returns> public static object CreatePlain(this IVortexObject obj) { dynamic o = obj; var plain = o.CreatePlainerType(); o.FlushOnlineToPlain(plain); return(plain); }
public TreeViewWrapper(IVortexObject obj) { Wrapper = obj; if (Wrapper.GetType() == typeof(IVortexObject)) { HasChildren = true; Children = Wrapper.GetKids(); } }
private string Translate(string text, IVortexObject sender) { if (sender != null && sender.GetValueTags().FirstOrDefault() != null) { return(sender.GetValueTags().FirstOrDefault().Translator.Translate(StringInterpolator.Interpolate(text, sender))); } return(text); }
/// <summary> /// Sets the logging for the 'Edit' -> 'Online' value change. /// </summary> /// <param name="obj">Root twin object</param> /// <returns>AppBuilder</returns> public TcoAppBuilder SetEditValueChangeLogging(IVortexObject obj) { foreach (var valtag in obj.GetValueTags()) { valtag.EditValueChange = LoggingHelpers.EditValueChange; } return(this); }
public Recorder(IVortexObject vortexObject) { _recordedObject = vortexObject; Tasks = _recordedObject.GetDescendants <IsTask>(); foreach (var task in Tasks) { task.RecordTaskAction = this.Record; } }
public static IEnumerable <T> GetChildren <T>(this IVortexObject obj, IEnumerable <object> excluding) where T : IVortexObject { if (excluding == null) { excluding = new List <Type>(); } var children = obj.GetChildren().Where(p => p is T && !excluding.Any(e => e != p)).Select(p => (T)p); return(children); }
public void Import(IEnumerable <string> records, IVortexObject crudDataObject = null, char separator = ';') { var documents = records.ToArray(); var header = documents[0]; var headerItems = header.Split(separator); var dictionary = new List <ImportItems>(); // Prepare swappable object var onliner = typeof(T).Name.Replace("Plain", string.Empty); var adapter = new Vortex.Connector.ConnectorAdapter(typeof(DummyConnectorFactory)); var dummyConnector = adapter.GetConnector(new object[] { }); var onlinerType = Assembly.GetAssembly(typeof(T)).GetTypes().FirstOrDefault(p => p.Name == onliner); IVortexObject prototype; if (crudDataObject == null) { prototype = Activator.CreateInstance(onlinerType, new object[] { dummyConnector, string.Empty, string.Empty }) as IVortexObject; } else { prototype = crudDataObject; } var valueTags = prototype.RetrieveValueTags(); // Get headered dictionary foreach (var headerItem in headerItems) { dictionary.Add(new ImportItems() { Key = headerItem }); } // Load values for (int i = 2; i < documents.Count(); i++) { var documentItems = documents[i].Split(separator); for (int a = 0; a < documentItems.Count(); a++) { dictionary[a].Value = documentItems[a]; } UpdateDocument(dictionary, valueTags, prototype); } }
partial void PexConstructor(IVortexObject parent, string readableTail, string symbolTail) { _context = parent.GetParent <TcoContext>(); // TODO: This is temporary should be made in in VortexBase library Task.Run(() => { while (true) { System.Threading.Thread.Sleep(2000); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsActive))); } }); }
/// <summary> /// Searches recursively the parents of this <see cref="IVortexObject"/> until encounters object of given /// type. When the root object <see cref="Vortex.Connector.IConnector"/> is hit climbing up the hierarchy the method returns pre-existing parent. /// </summary> /// <remarks> /// Take into consideration possible performance degradation due to use of reflections in this method. /// </remarks> /// <typeparam name="T"></typeparam> /// <param name="obj">Searched object</param> /// <param name="parent">[optional] Pre-existing parent. </param> /// <returns>Parent object of given type.</returns> public static T GetParent <T>(this IVortexObject obj, T parent = null) where T : class { if (obj is Vortex.Connector.RootVortexerObject || obj is Vortex.Connector.IConnector || obj == null) { return(parent); } if (obj is T) { parent = (T)obj; return(parent); } return(GetParent <T>(obj.GetParent())); }
partial void PexConstructor(IVortexObject parent, string readableTail, string symbolTail) { this._stopTask.LogPayloadDecoration = () => this.CreatePlain(); this._haltTask.LogPayloadDecoration = () => this.CreatePlain(); this._setPositionTask.LogPayloadDecoration = () => this._setPositionTask.CreatePlain(); this._soEResetTask.LogPayloadDecoration = () => this.CreatePlain(); this._resetTask.LogPayloadDecoration = () => this.CreatePlain(); this._homeTask.LogPayloadDecoration = () => this._homeTask.CreatePlain(); this._moveAbsoluteTask.LogPayloadDecoration = () => this._moveAbsoluteTask.CreatePlain(); this._moveRelativeTask.LogPayloadDecoration = () => this._moveRelativeTask.CreatePlain(); this._moveModuloTask.LogPayloadDecoration = () => this._moveModuloTask.CreatePlain(); this._moveVelocityTask.LogPayloadDecoration = () => this._moveVelocityTask.CreatePlain(); this._moveAbsoluteTask.CodeProvider = new MoveAbsoluteTaskCodeProvider(this); this._moveRelativeTask.CodeProvider = new MoveRelativeTaskCodeProvider(this); this._moveModuloTask.CodeProvider = new MoveModuloTaskCodeProvider(this); this._moveVelocityTask.CodeProvider = new MoveVelocityTaskCodeProvider(this); }
/// <summary> /// Searches recursively the children of this <see cref="IVortexObject"/> /// </summary> /// <remarks> /// Take into consideration possible performance degradation due to use of reflections in this method. /// </remarks> /// <typeparam name="T"></typeparam> /// <param name="obj">Searched object</param> /// <param name="children">[optional] Pre-existing children. </param> /// <returns>Children of this object.</returns> public static IEnumerable <T> GetDescendants <T>(this IVortexObject obj, IList <T> children = null) where T : IVortexObject { children = children != null ? children : new List <T>(); if (obj is Vortex.Connector.IVortexObject && obj != null) { foreach (var child in obj.GetChildren()) { if (child is T) { children.Add((T)obj); } GetDescendants <T>(child, children); } } return(children); }
/// <summary> /// Searches recursively the children of this <see cref="IVortexObject"/> /// </summary> /// <remarks> /// Take into consideration possible performance degradation due to use of reflections in this method. /// </remarks> /// <typeparam name="T"></typeparam> /// <param name="obj">Searched object</param> /// <param name="children">[optional] Pre-existing children. </param> /// <returns>Children of this object.</returns> public static IEnumerable <T> GetDescendants <T>(this IVortexObject obj, IList <T> children = null) where T : class { children = children != null ? children : new List <T>(); if (obj != null) { foreach (var child in obj.GetChildren()) { var ch = child as T; if (ch != null) { children.Add(ch); } GetDescendants <T>(child, children); } } return(children); }
/// <summary> /// Gets descendant objects of given type up to given tree depth. /// </summary> /// <remarks> /// Take into consideration possible performance degradation due to use of reflections in this method. /// </remarks> /// <typeparam name="T">Descendant type</typeparam> /// <param name="obj">Root object</param> /// <param name="depth">Depth to search for descendant objects</param> /// <param name="children">[optional] Pre-existing descendants.</param> /// <param name="currentDepth">[optional] Current depth</param> /// <returns>Descendant of given type up to given depth.</returns> public static IEnumerable <T> GetDescendants <T>(this IVortexObject obj, int depth, IList <T> children = null, int currentDepth = 0) where T : class { children = children != null ? children : new List <T>(); currentDepth++; if (obj != null && currentDepth < depth) { foreach (var child in obj.GetChildren()) { var ch = child as T; if (ch != null) { children.Add(ch); } GetDescendants <T>(child, depth, children, currentDepth); } } currentDepth--; return(children); }
public SwiftRecorderViewModel(IVortexObject treeRootObject) { TreeRootObject = treeRootObject; StartRecordingCommand = new RelayCommand(a => StartRecording()); StopRecordingCommand = new RelayCommand(a => StopRecording()); }
partial void PexConstructor(IVortexObject parent, string readableTail, string symbolTail) { ChangeTracker = new ValueChangeTracker(this); }
/// <summary> /// Get the children of given type of this <see cref="IVortexObject"/> /// </summary> /// <remarks> /// Take into consideration possible performance degradation due to use of reflections in this method. /// </remarks> /// <typeparam name="T"></typeparam> /// <param name="obj">Searched object</param> /// <returns>Children of this object.</returns> public static IEnumerable <T> GetChildren <T>(this IVortexObject obj) where T : IVortexObject { var children = obj.GetChildren().Where(p => p is T).Select(p => (T)p); return(children); }
partial void PexConstructor(IVortexObject parent, string readableTail, string symbolTail) { this.Connector.IdentityProvider.AddIdentity(this); }
partial void PexConstructor(IVortexObject parent, string readableTail, string symbolTail) { this._enabled.Subscribe(ValidateCanExecute); this._isServiceable.Subscribe(ValidateCanExecute); CanExecuteChanged += TcoToggleTask_CanExecuteChanged; }
public MoveAbsoluteTaskCodeProvider(IVortexObject origin) { Origin = origin; }
partial void PexConstructor(IVortexObject parent, string readableTail, string symbolTail) { _context = parent.GetParent <IsTcoContext>(); _context?.AddMessage(this); _parentObject = parent.GetParent <IsTcoObject>(); }
private void UpdateDocument(List <ImportItems> dictionary, IEnumerable <IValueTag> valueTags, IVortexObject prototype) { string id = dictionary.FirstOrDefault(p => p.Key == "_EntityId").Value; var existing = this.Repository.Queryable.Where(p => p._EntityId == id).FirstOrDefault(); if (existing != null) { ((dynamic)prototype).CopyPlainToShadow(existing); } ((dynamic)prototype)._EntityId.Shadow = id; if (existing != null) { ((dynamic)prototype).ChangeTracker.StartObservingChanges(); } // Swap values to shadow foreach (var item in dictionary) { if (!string.IsNullOrEmpty(item.Key)) { var tag = valueTags.FirstOrDefault(p => p.Symbol == item.Key); OnlinerBaseType type = tag as OnlinerBaseType; if (type is OnlinerString || type is OnlinerWString) { ((dynamic)tag).Shadow = (CastValue(type, item.Value) as string)?.Replace('►', ';'); } else { ((dynamic)tag).Shadow = CastValue(type, item.Value); } } } if (existing != null) { ((dynamic)prototype).ChangeTracker.StopObservingChanges(); } if (existing != null) { ((dynamic)prototype).ChangeTracker.Import(existing); ((dynamic)existing).CopyShadowToPlain((dynamic)prototype); this.Repository.Update(existing._EntityId, existing); } else { T newRecord = new T(); ((dynamic)prototype).ChangeTracker.Import(newRecord); ((dynamic)newRecord).CopyShadowToPlain((dynamic)prototype); this.Repository.Create(newRecord._EntityId, newRecord); } }
partial void PexConstructor(IVortexObject parent, string readableTail, string symbolTail) { this.Connector.IdentityProvider.AddIdentity(this); this.MessageHandler = new TcoObjectMessageHandler(this, this); }
public void AddChild(IVortexObject vortexObject) { _obj.AddChild(vortexObject); }
public void AddChild(IVortexObject vortexObject) { _children.Add(vortexObject); }
partial void PexConstructor(IVortexObject parent, string readableTail, string symbolTail) { }
public MoveVelocityTaskCodeProvider(IVortexObject origin) { Origin = origin; }
partial void PexConstructor(IVortexObject parent, string readableTail, string symbolTail) { expectDequeingTags = this._buffer.Select(p => p.ExpectDequeing as IValueTag).ToList(); }
public TreeWrapperObject(IVortexObject obj) { _obj = obj; }