aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-06-14 11:57:22 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-06-14 11:57:22 +0300
commit03959e785f635697fcdf0f99aad9454fafbf4e2e (patch)
treedbaf0350a9fbf7502057f01a9b34fd2ff15df9fd /Software/Visual_Studio/Tango.SharedUI
parentcc08947f9bc9f1f98ab8835200fb7cda0494cff2 (diff)
downloadTango-03959e785f635697fcdf0f99aad9454fafbf4e2e.tar.gz
Tango-03959e785f635697fcdf0f99aad9454fafbf4e2e.zip
Improved UdpDiscoveryClient (I Think...).
Improved PPC NavigationManager by providing a way to navigate by module/view paths..
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI')
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs21
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/ExtensionMethods/FrameworkElementExtensions.cs13
2 files changed, 30 insertions, 4 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs
index 5a39948b2..72e7e50c8 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs
+++ b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs
@@ -9,6 +9,7 @@ using System.Windows.Controls;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
+using System.Windows.Threading;
using Tango.SharedUI.Helpers;
namespace Tango.SharedUI.Controls
@@ -228,7 +229,7 @@ namespace Tango.SharedUI.Controls
/// <returns></returns>
public static String GetNavigationName(FrameworkElement element)
{
- return element.GetValue(NavigationName).ToString();
+ return element.GetValue(NavigationName).ToStringSafe();
}
#endregion
@@ -438,12 +439,24 @@ namespace Tango.SharedUI.Controls
public void NavigateTo(FrameworkElement element)
{
- SelectedElement = element;
+ var e = Elements.SingleOrDefault(x => x == element);
+
+ if (e != null)
+ {
+ SelectedElement = element;
+ }
}
- public void NavigateTo(String navigationName)
+ public FrameworkElement NavigateTo(String navigationName)
{
- SelectedElement = Elements.SingleOrDefault(x => GetNavigationName(x) == navigationName);
+ var element = Elements.SingleOrDefault(x => GetNavigationName(x) == navigationName || x.GetType().Name == navigationName);
+
+ if (element != null)
+ {
+ SelectedElement = element;
+ }
+
+ return element;
}
public FrameworkElement GetAndDetach(String navigationName)
diff --git a/Software/Visual_Studio/Tango.SharedUI/ExtensionMethods/FrameworkElementExtensions.cs b/Software/Visual_Studio/Tango.SharedUI/ExtensionMethods/FrameworkElementExtensions.cs
index 422b078a4..8bfc9149a 100644
--- a/Software/Visual_Studio/Tango.SharedUI/ExtensionMethods/FrameworkElementExtensions.cs
+++ b/Software/Visual_Studio/Tango.SharedUI/ExtensionMethods/FrameworkElementExtensions.cs
@@ -1,15 +1,28 @@
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Markup;
using System.Windows.Media.Imaging;
+using Tango.SharedUI.Controls;
using Tango.SharedUI.Rendering;
public static class FrameworkElementExtensions
{
+ /// <summary>
+ /// Renders the element to bitmap file.
+ /// </summary>
+ /// <param name="element">The element.</param>
+ /// <param name="filePath">The file path.</param>
+ /// <param name="format">The format.</param>
+ /// <param name="renderSize">Size of the render.</param>
+ /// <param name="quality">The quality.</param>
public static void RenderToFile(this FrameworkElement element, String filePath, ImageFormat format, Size renderSize, int quality)
{
RenderWindow renderer = new RenderWindow(element);