diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-19 15:25:33 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-19 15:25:33 +0200 |
| commit | cc3bf81fabd005fa74c2b9663589892480f1a6bb (patch) | |
| tree | 37d7a5d21ad32d1aaf3041e3bc08d7d031699325 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters | |
| parent | 65d969946d89d7572f071c1387d10ecc58e94f61 (diff) | |
| download | Tango-cc3bf81fabd005fa74c2b9663589892480f1a6bb.tar.gz Tango-cc3bf81fabd005fa74c2b9663589892480f1a6bb.zip | |
Added Event Types and Action Types to DB Module !
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs new file mode 100644 index 000000000..4673d12b2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.DAL.Observables; +using Tango.MachineStudio.DB.ViewModels; + +namespace Tango.MachineStudio.DB.Converters +{ + public class EventTypeActionsToStringConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) return ""; + + if (value is IEnumerable<EventTypesAction>) + { + IEnumerable<EventTypesAction> eventActions = value as IEnumerable<EventTypesAction>; + return String.Join(", ", eventActions.Where(x => !x.Deleted).Select(x => x.ActionTypes.Name)); + } + else + { + IEnumerable<MultiComboVM<ActionType>> eventActions = value as IEnumerable<MultiComboVM<ActionType>>; + return String.Join(", ", eventActions.Where(x => x.IsSelected).Select(x => x.Entity.Name)); + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} |
