diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-13 14:22:32 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-13 14:22:32 +0300 |
| commit | 4490b0a76d4188cb285d62b106e208803ceaa133 (patch) | |
| tree | a24f3d5653979ebaff86b524f452d20c74df3327 /Software/Visual_Studio/PPC/Tango.PPC.Common/Controls | |
| parent | d3c0c73dc2aeae2dacf4224ce7997609132426a1 (diff) | |
| download | Tango-4490b0a76d4188cb285d62b106e208803ceaa133.tar.gz Tango-4490b0a76d4188cb285d62b106e208803ceaa133.zip | |
PPC.Common Logs and comments!
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Controls')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs | 51 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs | 32 |
2 files changed, 71 insertions, 12 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs index 36779c571..7cd8fc9f0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs @@ -21,17 +21,34 @@ using Tango.Core.Components; namespace Tango.PPC.Common.Controls { + /// <summary> + /// Represents an asynchronous UI element capable of displaying it's content on a thread different from the UI thread. + /// This is possible by XML serialization of the visual content and extracting it to a new window which will be created on a new thread. + /// The window will then be synchronized to the original control position and size. + /// </summary> + /// <remarks> + /// This new window will override all elements of the main window so use with caution! + /// </remarks> + /// <seealso cref="System.Windows.Controls.ContentControl" /> public partial class AsyncAdornerControl : ContentControl { private bool _loaded; private Window _window; + /// <summary> + /// Initializes a new instance of the <see cref="AsyncAdornerControl"/> class. + /// </summary> public AsyncAdornerControl() { Loaded += AsyncAdornerControl_Loaded; IsVisibleChanged += AsyncAdornerControl_IsVisibleChanged; } + /// <summary> + /// Handles the IsVisibleChanged event of the AsyncAdornerControl control. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> instance containing the event data.</param> private void AsyncAdornerControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (Visibility == Visibility.Visible) @@ -44,20 +61,21 @@ namespace Tango.PPC.Common.Controls } } - public Type ViewType - { - get { return (Type)GetValue(ViewTypeProperty); } - set { SetValue(ViewTypeProperty, value); } - } - public static readonly DependencyProperty ViewTypeProperty = - DependencyProperty.Register("ViewType", typeof(Type), typeof(AsyncAdornerControl), new PropertyMetadata(null)); - + /// <summary> + /// Raises the <see cref="E:System.Windows.FrameworkElement.SizeChanged" /> event, using the specified information as part of the eventual event data. + /// </summary> + /// <param name="sizeInfo">Details of the old and new size involved in the change.</param> protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) { base.OnRenderSizeChanged(sizeInfo); SyncBounds(); } + /// <summary> + /// Handles the Loaded event of the AsyncAdornerControl control. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void AsyncAdornerControl_Loaded(object sender, RoutedEventArgs e) { if (!this.IsInDesignMode()) @@ -73,7 +91,6 @@ namespace Tango.PPC.Common.Controls System.Windows.Application.Current.MainWindow.LocationChanged += MainWindow_LocationChanged; Visibility v = Visibility; - Type type = ViewType; var xaml = FrameworkElementSerializer.Serialize(Content as FrameworkElement); object dc = this.DataContext; @@ -122,12 +139,20 @@ namespace Tango.PPC.Common.Controls } } + /// <summary> + /// Handles the LocationChanged event of the MainWindow control. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void MainWindow_LocationChanged(object sender, EventArgs e) { SyncBounds(); } - private void SyncBounds() + /// <summary> + /// Synchronizes the bounds of the window with the bounds of the original control. + /// </summary> + public void SyncBounds() { if (_window != null) { @@ -147,6 +172,9 @@ namespace Tango.PPC.Common.Controls } } + /// <summary> + /// Hides the element window. + /// </summary> private void HideWindow() { if (_window != null) @@ -158,6 +186,9 @@ namespace Tango.PPC.Common.Controls } } + /// <summary> + /// Shows the element window. + /// </summary> private void ShowWindow() { if (_window != null) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs index 6df09856e..bf2e2f1a0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs @@ -18,8 +18,10 @@ using Tango.Touch.Controls; namespace Tango.PPC.Common.Controls { /// <summary> - /// Interaction logic for TwineCatalogControl.xaml + /// Represents the twin color catalog control. /// </summary> + /// <seealso cref="System.Windows.Controls.UserControl" /> + /// <seealso cref="System.Windows.Markup.IComponentConnector" /> public partial class TwineCatalogControl : UserControl { private Catalog _catalog; @@ -27,6 +29,9 @@ namespace Tango.PPC.Common.Controls private bool _preventChange; private double _lastScrollPosition = 0; + /// <summary> + /// Gets or sets the selected catalog item. + /// </summary> public CatalogItem SelectedItem { get { return (CatalogItem)GetValue(SelectedItemProperty); } @@ -35,6 +40,9 @@ namespace Tango.PPC.Common.Controls public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register("SelectedItem", typeof(CatalogItem), typeof(TwineCatalogControl), new PropertyMetadata(null,(d,e) => (d as TwineCatalogControl).OnSelectedItemChanged())); + /// <summary> + /// Initializes a new instance of the <see cref="TwineCatalogControl"/> class. + /// </summary> public TwineCatalogControl() { InitializeComponent(); @@ -55,6 +63,11 @@ namespace Tango.PPC.Common.Controls }; } + /// <summary> + /// Handles the Scrolling event of the ScrollViewer control. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="Touch.Controls.DoubleValueChangedEventArgs"/> instance containing the event data.</param> private void ScrollViewer_Scrolling(object sender, Touch.Controls.DoubleValueChangedEventArgs e) { if (!_preventChange) @@ -75,6 +88,11 @@ namespace Tango.PPC.Common.Controls } } + /// <summary> + /// Handles the Loaded event of the TwineCatalogControl control. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void TwineCatalogControl_Loaded(object sender, RoutedEventArgs e) { if (!_loaded) @@ -88,6 +106,11 @@ namespace Tango.PPC.Common.Controls } } + /// <summary> + /// Handles the ValueChanged event of the TouchSlider control. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="RoutedPropertyChangedEventArgs{System.Double}"/> instance containing the event data.</param> private void TouchSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { if (_catalog.Groups.Count == 0) return; @@ -108,6 +131,9 @@ namespace Tango.PPC.Common.Controls } } + /// <summary> + /// Called when the selected item has been changed + /// </summary> private void OnSelectedItemChanged() { if (!_preventChange) @@ -120,10 +146,12 @@ namespace Tango.PPC.Common.Controls } } + /// <summary> + /// Gets the touch ListBox. + /// </summary> public TouchListBox TouchListBox { get { return list; } } - } } |
