/// <summary> /// Adding objects' pair to the collection /// </summary> private void AddDoubleObject() { ObjectModel objectFrom, objectTo; GeneratoFromToObjects(out objectFrom, out objectTo); if (objectFrom == null || objectTo == null) { return; } ObjectCollection.Add(ObjectModel.ConvertToModel(objectFrom, objectTo)); }
/// <summary> /// Adding single object to the collection depending on type /// </summary> private void AddSingleObject(object obj) { if (obj is OutlinesNetTcp) { ObjectCollection.Add(ObjectModel.ConvertToModel(obj as OutlinesNetTcp, _directoryManager)); } else if (obj is CropPlan.ListItem) { ObjectCollection.Add(ObjectModel.ConvertToModel(obj as CropPlan.ListItem, _directoryManager)); } else if (obj is FieldVersion.ListItem) { ObjectCollection.Add(ObjectModel.ConvertToModel(obj as FieldVersion.ListItem, _directoryManager)); } }
/// <summary> /// Generating objects for objects' pair before adding to the collection /// </summary> private void GeneratoFromToObjects(out ObjectModel objectFrom, out ObjectModel objectTo) { objectFrom = null; objectTo = null; if (ObjectFrom is FieldVersion.ListItem) { objectFrom = ObjectModel.ConvertToModel(ObjectFrom as FieldVersion.ListItem, _directoryManager); } else if (ObjectFrom is OutlinesNetTcp) { objectFrom = ObjectModel.ConvertToModel(ObjectFrom as OutlinesNetTcp, _directoryManager); } if (ObjectTo is FieldVersion.ListItem) { objectTo = ObjectModel.ConvertToModel(ObjectTo as FieldVersion.ListItem, _directoryManager); } else if (ObjectTo is OutlinesNetTcp) { objectTo = ObjectModel.ConvertToModel(ObjectTo as OutlinesNetTcp, _directoryManager); } }