diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-10 19:01:05 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-10 19:01:05 +0200 |
| commit | 3fdcdac577d552bbdf6d7320c6ffb0753e810a08 (patch) | |
| tree | 55e392cea80a3539164abb1fd16c15986c92b287 /Software/Visual_Studio/Tango.Core | |
| parent | 3eabdee9604ad67cdbab7ee35bdfa249402f8831 (diff) | |
| download | Tango-3fdcdac577d552bbdf6d7320c6ffb0753e810a08.tar.gz Tango-3fdcdac577d552bbdf6d7320c6ffb0753e810a08.zip | |
Started working on machine designer view models.
Added NAME field to MACHINE table.
Diffstat (limited to 'Software/Visual_Studio/Tango.Core')
3 files changed, 33 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs index 84a73bf7c..8ac80034d 100644 --- a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs +++ b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows; @@ -32,6 +33,15 @@ namespace Tango.Core } /// <summary> + /// Raises the property changed event. + /// </summary> + /// <param name="propName">Name of the property.</param> + protected virtual void RaisePropertyChangedAuto([CallerMemberName] string caller = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(caller)); + } + + /// <summary> /// Raises all relay commands CanExecute methods in the current instance. /// </summary> protected virtual void InvalidateRelayCommands() diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs new file mode 100644 index 000000000..0e430e631 --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +public static class IEnumerableExtensions +{ + /// <summary> + /// Creates a new observable collection from the specified enumerable. + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="enumerable">The enumerable.</param> + /// <returns></returns> + public static ObservableCollection<T> ToObservableCollection<T>(this IEnumerable<T> enumerable) + { + return new ObservableCollection<T>(enumerable); + } +} + diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj index 7af35f628..fd3eeddf9 100644 --- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj +++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj @@ -59,6 +59,7 @@ <Compile Include="ExtensionMethods\DateTimeExtensions.cs" /> <Compile Include="ExtensionMethods\DependencyObjectExtensions.cs" /> <Compile Include="ExtensionMethods\EnumExtensions.cs" /> + <Compile Include="ExtensionMethods\IEnumerableExtensions.cs" /> <Compile Include="ExtensionMethods\IMessageExtensions.cs" /> <Compile Include="ExtensionMethods\IParameterizedExtensions.cs" /> <Compile Include="ExtensionMethods\ObjectExtensions.cs" /> |
