aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/Settings.Designer.cs
blob: 465246f32cb7244604ec28f2240413ab1aaff1b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Tango.MachineStudio.Stubs.Properties
{
    
    
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
    {
        
        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
        
        public static Settings Default
        {
            get
            {
                return defaultInstance;
            }
        }
    }
}
or: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Tango.SharedUI.Helpers;
using Tango.Touch.Controls;

namespace Tango.Touch.Components
{
    [ContentProperty(nameof(Content))]
    [TemplatePart(Name = PART_EllipseName, Type = typeof(Ellipse))]
    [TemplatePart(Name = PART_ScaleName, Type = typeof(ScaleTransform))]
    public class Ripple : Control
    {
        private const String PART_ScaleName = "PART_scale";
        private const String PART_EllipseName = "PART_ellipse";

        private ScaleTransform _scale;
        private Ellipse _ellipse;
        private bool _isAnimating;

        public UIElement Content
        {
            get { return (UIElement)GetValue(ContentProperty); }
            set { SetValue(ContentProperty, value); }
        }
        public static readonly DependencyProperty ContentProperty =
            DependencyProperty.Register("Content", typeof(UIElement), typeof(Ripple), new PropertyMetadata(null));

        public CornerRadius CornerRadius
        {
            get { return (CornerRadius)GetValue(CornerRadiusProperty); }
            set { SetValue(CornerRadiusProperty, value); }
        }
        public static readonly DependencyProperty CornerRadiusProperty =
            DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(Ripple), new PropertyMetadata(new CornerRadius()));

        public Brush RippleBrush
        {
            get { return (Brush)GetValue(RippleBrushProperty); }
            set { SetValue(RippleBrushProperty, value); }
        }
        public static readonly DependencyProperty RippleBrushProperty =
            DependencyProperty.Register("RippleBrush", typeof(Brush), typeof(Ripple), new PropertyMetadata(null));

        public ScrollViewer SynchedScrollViewer
        {
            get { return (ScrollViewer)GetValue(SynchedScrollViewerProperty); }
            set { SetValue(SynchedScrollViewerProperty, value); }
        }
        public static readonly DependencyProperty SynchedScrollViewerProperty =
            DependencyProperty.Register("SynchedScrollViewer", typeof(ScrollViewer), typeof(Ripple), new PropertyMetadata(null));

        public double RippleFactor
        {
            get { return (double)GetValue(RippleFactorProperty); }
            set { SetValue(RippleFactorProperty, value); }
        }
        public static readonly DependencyProperty RippleFactorProperty =
            DependencyProperty.Register("RippleFactor", typeof(double), typeof(Ripple), new PropertyMetadata(5.0));

        public bool Centered
        {
            get { return (bool)GetValue(CenteredProperty); }
            set { SetValue(CenteredProperty, value); }
        }
        public static readonly DependencyProperty CenteredProperty =
            DependencyProperty.Register("Centered", typeof(bool), typeof(Ripple), new PropertyMetadata(false));

        public bool Disabled
        {
            get { return (bool)GetValue(DisabledProperty); }
            set { SetValue(DisabledProperty, value); }
        }
        public static readonly DependencyProperty DisabledProperty =
            DependencyProperty.Register("Disabled", typeof(bool), typeof(Ripple), new PropertyMetadata(false,(d,e) => (d as Ripple).OnDisabledChanged()));

        private void OnDisabledChanged()
        {
            if (Disabled)
            {
                CancelRipple(true);
            }
        }


        #region Attached Properties

        #region PreventRipple

        /// <summary>
        /// Determines whether an element is a dropable target by the drag and drop service.
        /// </summary>
        public static readonly DependencyProperty PreventRippleProperty =
            DependencyProperty.RegisterAttached("PreventRipple",
            typeof(bool), typeof(Ripple),
            new FrameworkPropertyMetadata(false));

        /// <summary>
        /// Sets the PreventRipple attached property.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="value">if set to <c>true</c> [value].</param>
        public static void SetPreventRipple(FrameworkElement element, bool value)
        {
            element.SetValue(PreventRippleProperty, value);
        }

        /// <summary>
        /// Gets the PreventRipple attached property.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <returns></returns>
        public static bool GetPreventRipple(FrameworkElement element)
        {
            if (element != null)
            {
                return (bool)element.GetValue(PreventRippleProperty);
            }
            else
            {
                return false;
            }
        }

        #endregion

        #endregion

        static Ripple()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(Ripple), new FrameworkPropertyMetadata(typeof(Ripple)));
        }

        public Ripple()
        {
            this.Loaded += Ripple_Loaded;
        }

        private void Ripple_Loaded(object sender, RoutedEventArgs e)
        {
            if (SynchedScrollViewer != null)
            {
                SynchedScrollViewer.ScrollChanged += (_, __) => CancelRipple(true);
            }
        }

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _scale = GetTemplateChild(PART_ScaleName) as ScaleTransform;
            _ellipse = GetTemplateChild(PART_EllipseName) as Ellipse;

            FrameworkElement parent = this.FindAncestor<Button>();

            if (parent == null)
            {
                parent = this.FindAncestor<ListBoxItem>();
            }

            if (parent == null)
            {
                parent = this.FindAncestor<DataGridRow>();
            }

            if (parent == null)
            {
                parent = this.FindAncestor<TouchListBoxItem>();
            }

            if (parent == null)
            {
                parent = this.FindAncestor<Border>();
            }

            if (parent == null)
            {
                parent = this.FindAncestor<FrameworkElement>();
            }

            //parent.PreviewTouchDown += Parent_PreviewTouchDown;
            //parent.TouchMove += (_, __) => CancelRipple();
            //parent.PreviewTouchUp += Parent_PreviewTouchUp;

            if (parent != null)
            {

                parent.RegisterForPreviewMouseOrTouchDown(this, (x, e) =>
                {
                    if (!GetPreventRipple(e.OriginalSource as FrameworkElement))
                    {
                        OnRippleDown(e.Location);
                    }
                });
                parent.PreviewMouseUp += Parent_PreviewMouseUp;
            }

            //parent.PreviewMouseDown += Parent_PreviewMouseDown;
            //parent.PreviewTouchDown += Parent_PreviewTouchDown;
            //parent.TouchMove += (_, __) => CancelRipple();
            //parent.PreviewTouchUp += Parent_PreviewTouchUp;
        }

        private void Parent_PreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            OnRippleUp(new Point(e.GetPosition(this).X, e.GetPosition(this).Y));
        }

        private void Parent_PreviewTouchUp(object sender, TouchEventArgs e)
        {
            OnRippleUp(new Point(e.GetTouchPoint(this).Position.X, e.GetTouchPoint(this).Position.Y));
        }

        private void Parent_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            OnRippleDown(new Point(e.GetPosition(this).X, e.GetPosition(this).Y));
        }

        private void Parent_PreviewTouchDown(object sender, TouchEventArgs e)
        {
            OnRippleDown(new Point(e.GetTouchPoint(this).Position.X, e.GetTouchPoint(this).Position.Y));
        }

        public void CancelRipple(bool immidiate = false)
        {
            if (_isAnimating)
            {
                _isAnimating = false;
                DoubleAnimation ani = new DoubleAnimation();
                ani.To = 0;
                ani.Duration = TimeSpan.FromSeconds(immidiate ? 0 : 0.1);
                _scale.BeginAnimation(ScaleTransform.ScaleXProperty, ani);
                _scale.BeginAnimation(ScaleTransform.ScaleYProperty, ani);
            }
        }

        private void OnRippleUp(Point position)
        {
            if (!(position.X >= 0 && position.X <= ActualWidth && position.Y >= 0 && position.Y <= ActualHeight))
            {
                CancelRipple();
            }
        }

        private void OnRippleDown(Point position)
        {
            if (Disabled) return;

            _isAnimating = true;

            if (!Centered)
            {
                Canvas.SetLeft(_ellipse, position.X - (_ellipse.Width / 2));
                Canvas.SetTop(_ellipse, position.Y - (_ellipse.Height / 2));
            }
            else
            {
                Canvas.SetLeft(_ellipse, (ActualWidth / 2) - (_ellipse.Width / 2));
                Canvas.SetTop(_ellipse, (ActualHeight / 2) - (_ellipse.Height / 2));
            }

            DoubleAnimation ani = new DoubleAnimation();
            ani.From = 0;
            ani.To = RippleFactor;
            ani.AutoReverse = true;
            ani.Duration = TimeSpan.FromSeconds(0.3);
            ani.AccelerationRatio = 0.2;
            ani.DecelerationRatio = 0.2;
            _scale.BeginAnimation(ScaleTransform.ScaleXProperty, ani);
            _scale.BeginAnimation(ScaleTransform.ScaleYProperty, ani);
        }
    }
}