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;
            }
        }
    }
}
Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;

namespace Tango.Touch.Controls
{
    public class TouchButton : Button, ITouchControl
    {
        private bool _executingDelayCommand;

        #region ITouchControl

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

        public bool EnableDropShadow
        {
            get { return (bool)GetValue(EnableDropShadowProperty); }
            set { SetValue(EnableDropShadowProperty, value); }
        }
        public static readonly DependencyProperty EnableDropShadowProperty =
            DependencyProperty.Register("EnableDropShadow", typeof(bool), typeof(TouchButton), new PropertyMetadata(true));

        public double BlurRadius
        {
            get { return (double)GetValue(BlurRadiusProperty); }
            set { SetValue(BlurRadiusProperty, value); }
        }
        public static readonly DependencyProperty BlurRadiusProperty =
            DependencyProperty.Register("BlurRadius", typeof(double), typeof(TouchButton), new PropertyMetadata(10.0));

        public double ShadowDepth
        {
            get { return (double)GetValue(ShadowDepthProperty); }
            set { SetValue(ShadowDepthProperty, value); }
        }
        public static readonly DependencyProperty ShadowDepthProperty =
            DependencyProperty.Register("ShadowDepth", typeof(double), typeof(TouchButton), new PropertyMetadata(1.0));

        public Color ShadowColor
        {
            get { return (Color)GetValue(ShadowColorProperty); }
            set { SetValue(ShadowColorProperty, value); }
        }
        public static readonly DependencyProperty ShadowColorProperty =
            DependencyProperty.Register("ShadowColor", typeof(Color), typeof(TouchButton), new PropertyMetadata(Colors.Gray));

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

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

        public Brush RippleBrush
        {
            get { return (Brush)GetValue(RippleBrushProperty); }
            set { SetValue(RippleBrushProperty, value); }
        }
        public static readonly DependencyProperty RippleBrushProperty =
            DependencyProperty.Register("RippleBrush", typeof(Brush), typeof(TouchButton), new PropertyMetadata(new SolidColorBrush(Colors.White) { Opacity = 0.5 }));

        public ICommand DelayCommand
        {
            get { return (ICommand)GetValue(DelayCommandProperty); }
            set { SetValue(DelayCommandProperty, value); }
        }
        public static readonly DependencyProperty DelayCommandProperty =
            DependencyProperty.Register("DelayCommand", typeof(ICommand), typeof(TouchButton), new PropertyMetadata(null, (d, e) => (d as TouchButton).OnDelayCommandChanged()));

        public Duration DelayCommandDuration
        {
            get { return (Duration)GetValue(DelayCommandDurationProperty); }
            set { SetValue(DelayCommandDurationProperty, value); }
        }
        public static readonly DependencyProperty DelayCommandDurationProperty =
            DependencyProperty.Register("DelayCommandDuration", typeof(Duration), typeof(TouchButton), new PropertyMetadata(new Duration(TimeSpan.FromSeconds(0.5))));

        #endregion

        public TouchButton()
        {

        }

        protected override void OnPreviewMouseDoubleClick(MouseButtonEventArgs e)
        {
            e.Handled = true;
        }

        protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
        {
            if (e.ClickCount >= 2)
            {
                e.Handled = true;
                return;
            }

            base.OnPreviewMouseDown(e);
        }

        protected override void OnClick()
        {
            if (IsEnabled)
            {
                base.OnClick();
                PerformDelayCommand();
            }
        }

        private async void PerformDelayCommand()
        {
            if (DelayCommand != null && !_executingDelayCommand)
            {
                try
                {
                    _executingDelayCommand = true;
                    await Task.Delay(DelayCommandDuration.TimeSpan);
                    DelayCommand.Execute(CommandParameter);
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    _executingDelayCommand = false;
                }
            }
        }

        private void OnDelayCommandChanged()
        {
            if (DelayCommand != null)
            {
                DelayCommand.CanExecuteChanged -= DelayCommand_CanExecuteChanged;
                DelayCommand.CanExecuteChanged += DelayCommand_CanExecuteChanged;
            }
        }

        private void DelayCommand_CanExecuteChanged(object sender, EventArgs e)
        {
            if (DelayCommand != null)
            {
                IsEnabled = DelayCommand.CanExecute(null);
            }
        }

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