aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/InsufficientLiquidQuantityViewVM.cs
blob: 8b15d2e00233c51f6ae11ef26dae3f90046fa5be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Integration.Operation;
using Tango.SharedUI;

namespace Tango.PPC.UI.Dialogs
{
    public class InsufficientLiquidQuantityViewVM : DialogViewVM
    {
        public InsufficientLiquidQuantityException Exception { get; set; }

        public InsufficientLiquidQuantityViewVM(InsufficientLiquidQuantityException ex)
        {
            Exception = ex;
        }
    }
}
t .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.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Tango.Core;
using Tango.Editors;

namespace Tango.Editors
{
    /// <summary>
    /// <para><img class="classImage" src="../Media/FrameworkElementEditor.png" /></para>
    /// Represents a <see cref="FrameworkElement"/> editor with position, size and angle control.
    /// </summary>
    /// <example>
    /// <para class="example-title">
    /// <img class="exampleIcon" src="../Icons/CodeExample.png" />
    /// <i>
    /// The following example demonstrates a basic scenario of using <see cref="N:WpfVideoTools.Tiles"/> and <see cref="N:Tango.Editors"/> by creating a simple video projection application with the following features:
    /// </i>
    /// <list type="bullet">
    /// <item>Use the mouse to draw any type of tile of the editor surface.</item>
    /// <item>Apply any input shape on any tile.</item>
    /// <item>Load any video and display it on any of the selected tile.</item>
    /// <item>Built in support for undo, redo, cut, copy and paste, delete and select operations.</item>
    /// <item>Built in support for saving/loading the editor state to memory or file.</item>
    /// <item>Built in support for tile and editor properties adjustment using the <see cref="ParameterizedEditor"/>.</item>
    /// </list>
    /// </para>
    /// <para><markup><video class="exampleVideo" autoplay="autoplay" loop="loop" controls="controls" src="../Media/EditorsExample.mp4"></video></markup></para>
    /// <code lang="XAML" source="../FullAPIExamples/Examples/Editors/EditorsExample.xaml" title="Elements editor example." />
    /// <i>Code-Behind.</i>
    /// <code lang="C#" source="../FullAPIExamples/Examples/Editors/EditorsExample.xaml.cs" title="Elements editor example." />
    /// </example>
    /// <seealso cref="Tango.Editors.ElementEditor" />
    [ContentProperty("InnerContent")]
    public partial class FrameworkElementEditor : ElementEditor
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="FrameworkElementEditor"/> class.
        /// </summary>
        public FrameworkElementEditor()
            : base()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="FrameworkElementEditor"/> class.
        /// </summary>
        /// <param name="frameworkElement">The framework element.</param>
        public FrameworkElementEditor(FrameworkElement frameworkElement)
            : this()
        {
            Element = frameworkElement;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="FrameworkElementEditor"/> class.
        /// </summary>
        /// <param name="frameworkElement">The framework element.</param>
        /// <param name="bounds">The bounds.</param>
        public FrameworkElementEditor(FrameworkElement frameworkElement, Rect bounds)
            : this(frameworkElement)
        {
            Left = bounds.Left;
            Top = bounds.Top;
            Width = bounds.Width;
            Height = bounds.Height;
        }

        /// <summary>
        /// Gets or sets the framework element.
        /// </summary>
        public FrameworkElement Element
        {
            get { return (FrameworkElement)GetValue(ElementProperty); }
            set { SetValue(ElementProperty, value); }
        }
        public static readonly DependencyProperty ElementProperty =
            DependencyProperty.Register("Element", typeof(FrameworkElement), typeof(FrameworkElementEditor), new PropertyMetadata(null));

        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns></returns>
        public override IElementEditor Clone()
        {
            try
            {
                FrameworkElementEditor cloned = new FrameworkElementEditor();

                if (Element is IConfigurable)
                {
                    cloned.Element = (Element as IConfigurable).Clone() as FrameworkElement;
                }
                else
                {
                    cloned.Element = FrameworkElementCloner.Clone(Element);
                }

                cloned.ElementDetached = ElementDetached;
                cloned.Top = Top;
                cloned.Left = Left;
                cloned.Width = Width;
                cloned.Height = Height;
                cloned.Angle = Angle;
                cloned.Background = Background;
                cloned.Foreground = Foreground;
                cloned.CornersBrush = CornersBrush;
                return cloned;
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("Could not clone this editor. You may have to create a custom editor and implement a custom Clone method.", ex);
            }
        }

        /// <summary>
        /// Gets the hosted element.
        /// </summary>
        [ParameterIgnore]
        public override Object HostedElement
        {
            get { return Element; }
        }

        /// <summary>
        /// Gets a configuration object representing the configurable properties. This configuration can be serialized to a stream or file, and later be loaded and applied to the configurable object.
        /// </summary>
        /// <returns></returns>
        public override IConfiguration GetConfiguration()
        {
            FrameworkElementEditorConfiguration config = new FrameworkElementEditorConfiguration(base.GetConfiguration() as ElementEditorConfiguration);

            try
            {
                config.ElementXaml = FrameworkElementCloner.Serialize(Element);
            }
            catch
            {
                Debug.WriteLine("Could not serialize framework element with ID " + ID);
            }

            return config;
        }

        /// <summary>
        /// Invoked when the attached editor has changed.
        /// </summary>
        protected override void OnAttachedEditorChanged()
        {
            base.OnAttachedEditorChanged();
        }

        /// <summary>
        /// Applies the specified configuration with an optional animation if supported by the configurable type.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="animation">The animation.</param>
        public override void SetConfiguration(IConfiguration configuration, ConfigurationAnimation animation)
        {
            if (!(configuration is FrameworkElementEditorConfiguration))
            {
                throw new InvalidConfigurationException();
            }

            var config = configuration as FrameworkElementEditorConfiguration;

            try
            {
                Element = FrameworkElementCloner.Deserialize(config.ElementXaml);
            }
            catch
            {
                Debug.WriteLine("Could not deserialize framework element with ID " + ID);
            }

            base.SetConfiguration(configuration, animation);
        }

        /// <summary>
        /// Called when the editor detached property has changed.
        /// </summary>
        protected override void OnElementDetachedChanged()
        {
            base.OnElementDetachedChanged();

            if (ElementDetached)
            {
                Element.Bind(Canvas.LeftProperty, this, LeftProperty, BindingMode.TwoWay);
                Element.Bind(Canvas.TopProperty, this, TopProperty, BindingMode.TwoWay);
                Element.Bind(FrameworkElement.WidthProperty, this, WidthProperty, BindingMode.TwoWay);
                Element.Bind(FrameworkElement.HeightProperty, this, HeightProperty, BindingMode.TwoWay);
                Element.RenderTransformOrigin = new Point(0.5, 0.5);
                RotateTransform rotate = new RotateTransform();
                Element.RenderTransform = rotate;
                rotate.Bind(RotateTransform.AngleProperty, this, AngleProperty, BindingMode.TwoWay);
            }
            else
            {
                Element.Unbind(Canvas.LeftProperty);
                Element.Unbind(Canvas.TopProperty);
                Element.Unbind(FrameworkElement.WidthProperty);
                Element.Unbind(FrameworkElement.HeightProperty);
                Element.RenderTransform = null;
            }
        }
    }
}