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.Editors;
using Tango.BL.Entities;
using Tango.MachineStudio.Technician.TechItems;
using Tango.Core;
namespace Tango.MachineStudio.Technician.Editors
{
[ContentProperty("InnerContent")]
public partial class DigitalOutElementEditor : ElementEditor
{
public DigitalOutElementEditor()
: base()
{
InitializeComponent();
}
public DigitalOutElementEditor(DigitalOutItem digitalOutItem)
: this()
{
DigitalOutItem = digitalOutItem;
DataContext = DigitalOutItem;
}
public DigitalOutElementEditor(DigitalOutItem digitalOutItem, Rect bounds)
: this(digitalOutItem)
{
Left = bounds.Left;
Top = bounds.Top;
Width = bounds.Width;
Height = bounds.Height;
}
private DigitalOutItem _digitalOutItem;
public DigitalOutItem DigitalOutItem
{
get { return _digitalOutItem; }
set { _digitalOutItem = value; RaisePropertyChanged(nameof(DigitalOutItem)); }
}
///
/// Clones this instance.
///
///
public override IElementEditor Clone()
{
try
{
var clonedItem = DigitalOutItem.Clone() as DigitalOutItem;
DigitalOutElementEditor cloned = new DigitalOutElementEditor(clonedItem);
cloned.Top = Top;
cloned.Left = Left;
cloned.Width = Width;
cloned.Height = Height;
cloned.Angle = Angle;
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);
}
}
///
/// Gets the hosted element.
///
[ParameterIgnore]
public override Object HostedElement
{
get { return DigitalOutItem; }
}
}
}