aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/RealTimeGraphX.WPF/Components/GraphSurfaceComponentBase.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-10-10 16:55:44 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-10-10 16:55:44 +0300
commit79eb19cbd10785a7dbc972bc0b26817932237419 (patch)
treee36176fc94ce6f26efc89b006d7e6faf7e4398cb /Software/Visual_Studio/SideChains/RealTimeGraphX.WPF/Components/GraphSurfaceComponentBase.cs
parentdf9197240ba5a643ce1599f36b7e3dd34aad6a60 (diff)
downloadTango-79eb19cbd10785a7dbc972bc0b26817932237419.tar.gz
Tango-79eb19cbd10785a7dbc972bc0b26817932237419.zip
Sign-out works !
Fixed issue where color conversion was busy while not in research module but research module in job view. Added new RealTimeGraphX !
Diffstat (limited to 'Software/Visual_Studio/SideChains/RealTimeGraphX.WPF/Components/GraphSurfaceComponentBase.cs')
-rw-r--r--Software/Visual_Studio/SideChains/RealTimeGraphX.WPF/Components/GraphSurfaceComponentBase.cs75
1 files changed, 75 insertions, 0 deletions
diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphX.WPF/Components/GraphSurfaceComponentBase.cs b/Software/Visual_Studio/SideChains/RealTimeGraphX.WPF/Components/GraphSurfaceComponentBase.cs
new file mode 100644
index 000000000..e0cf424aa
--- /dev/null
+++ b/Software/Visual_Studio/SideChains/RealTimeGraphX.WPF/Components/GraphSurfaceComponentBase.cs
@@ -0,0 +1,75 @@
+using RealTimeGraphX.EventArguments;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace RealTimeGraphX
+{
+ /// <summary>
+ /// Represents an <see cref="IGraphSurfaceComponent"/> base class.
+ /// </summary>
+ /// <seealso cref="System.Windows.Controls.Control" />
+ /// <seealso cref="RealTimeGraphX.IGraphSurfaceComponent" />
+ public class GraphSurfaceComponentBase : Control, IGraphSurfaceComponent
+ {
+ /// <summary>
+ /// Gets or sets the surface.
+ /// </summary>
+ public IGraphSurface Surface
+ {
+ get { return (IGraphSurface)GetValue(SurfaceProperty); }
+ set { SetValue(SurfaceProperty, value); }
+ }
+ public static readonly DependencyProperty SurfaceProperty =
+ DependencyProperty.Register("Surface", typeof(IGraphSurface), typeof(GraphSurfaceComponentBase), new PropertyMetadata(null, (d, e) => (d as GraphSurfaceComponentBase).OnSurfaceChanged()));
+
+ /// <summary>
+ /// Called when the <see cref="Surface"/> property has been changed.
+ /// </summary>
+ protected virtual void OnSurfaceChanged()
+ {
+ if (!this.IsInDesignMode() && Surface != null)
+ {
+ Surface.InputChanged -= Surface_InputChanged;
+ Surface.InputChanged += Surface_InputChanged;
+
+ if (Surface.Input != null)
+ {
+ OnSurfacePainterChanged(Surface.Input);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Handles the InputChanged event of the Surface.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="e">The <see cref="InputChangedEventArgs{IGraphRenderer}"/> instance containing the event data.</param>
+ private void Surface_InputChanged(object sender, InputChangedEventArgs<IGraphPainter> e)
+ {
+ OnSurfacePainterChanged(e.Input);
+ }
+
+ /// <summary>
+ /// Called when surface painter has changed.
+ /// </summary>
+ /// <param name="painter">The painter.</param>
+ protected virtual void OnSurfacePainterChanged(IGraphPainter painter)
+ {
+ //Do Nothing..
+ }
+
+ /// <summary>
+ /// Invokes the specified method on the component dispatcher.
+ /// </summary>
+ /// <param name="action">The action.</param>
+ protected void InvokeUI(Action action)
+ {
+ Dispatcher.BeginInvoke(action);
+ }
+ }
+}