@@ -0,0 +1,167 @@ | |||
using System; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
namespace BPASmartClient.SCADAControl.Converters | |||
{ | |||
public class HoneycombPanel : Panel | |||
{ | |||
private double _unitLength; | |||
private HoneycombStuffer _stuffer; | |||
private static int GetXCount(int count) | |||
{ | |||
if (count == 0) return 0; | |||
count -= 1; | |||
var index = (int)Math.Floor(Math.Pow((12.0 * count + 25) / 36, 0.5) - 5.0 / 6); | |||
var valeIndex = 3 * index * index + 5 * index; | |||
var centerValue = valeIndex + 2; | |||
return count >= centerValue | |||
? 4 * index + 6 | |||
: count > valeIndex | |||
? 4 * index + 4 | |||
: 4 * index + 2; | |||
} | |||
private static int GetYCount(int count) | |||
{ | |||
if (count == 0) return 0; | |||
count -= 1; | |||
var index = (int)Math.Floor(Math.Pow(count / 3.0 + 0.25, 0.5) - 0.5); | |||
var valeIndex = 3 * index * index + 3 * index; | |||
return count > valeIndex | |||
? 2 * index + 2 | |||
: 2 * index; | |||
} | |||
/* | |||
* layout order | |||
* | |||
* ● ● | |||
* (7) (8) | |||
* | |||
* ● ● ● | |||
* (6) (1) (9) | |||
* | |||
* ● ● ● ... | |||
* (5) (0) (2) | |||
* | |||
* ● ● ... | |||
* (4) (3) | |||
* | |||
*/ | |||
protected override Size MeasureOverride(Size availableSize) | |||
{ | |||
var maxSize = new Size(); | |||
foreach (UIElement child in InternalChildren) | |||
{ | |||
if (child != null) | |||
{ | |||
child.Measure(availableSize); | |||
maxSize.Width = Math.Max(maxSize.Width, child.DesiredSize.Width); | |||
maxSize.Height = Math.Max(maxSize.Height, child.DesiredSize.Height); | |||
} | |||
} | |||
_unitLength = Math.Max(maxSize.Width, maxSize.Height) / 2; | |||
var xCount = GetXCount(InternalChildren.Count); | |||
var yCount = GetYCount(InternalChildren.Count); | |||
var availableWidth = xCount * _unitLength; | |||
var availableHeight = yCount * Math.Pow(3, 0.5) * _unitLength + _unitLength * 2; | |||
return new Size(availableWidth, availableHeight); | |||
} | |||
protected override Size ArrangeOverride(Size finalSize) | |||
{ | |||
var childLength = _unitLength * 2; | |||
_stuffer = new HoneycombStuffer(new Rect(finalSize.Width / 2 - _unitLength, | |||
finalSize.Height / 2 - _unitLength, childLength, childLength)); | |||
foreach (UIElement child in InternalChildren) | |||
{ | |||
child.Arrange(_stuffer.Move()); | |||
} | |||
return finalSize; | |||
} | |||
private class HoneycombStuffer | |||
{ | |||
private int _turns; | |||
private int _maxIndex; | |||
private int _currentIndex = -1; | |||
private readonly double _offsetX; | |||
private readonly double _offsetY; | |||
private Rect _childBounds; | |||
private readonly double[] _offsetXArr; | |||
private readonly double[] _offsetYArr; | |||
public HoneycombStuffer(Rect childBounds) | |||
{ | |||
_childBounds = childBounds; | |||
_offsetX = childBounds.Width / 2; | |||
_offsetY = Math.Pow(3, 0.5) * _offsetX; | |||
_offsetXArr = new[] | |||
{ | |||
2 * _offsetX, | |||
_offsetX, | |||
-_offsetX, | |||
-2 * _offsetX, | |||
-_offsetX, | |||
_offsetX | |||
}; | |||
_offsetYArr = new[] | |||
{ | |||
0, | |||
_offsetY, | |||
_offsetY, | |||
0, | |||
-_offsetY, | |||
-_offsetY | |||
}; | |||
} | |||
public Rect Move() | |||
{ | |||
_currentIndex++; | |||
if (_currentIndex > _maxIndex) | |||
{ | |||
_turns++; | |||
_maxIndex = _turns * 6 - 1; | |||
_currentIndex = 0; | |||
_childBounds.Offset(_offsetX, -_offsetY); | |||
return _childBounds; | |||
} | |||
if (_turns > 0) | |||
{ | |||
var index = _currentIndex / _turns; | |||
_childBounds.Offset(_offsetXArr[index], _offsetYArr[index]); | |||
} | |||
return _childBounds; | |||
} | |||
} | |||
} | |||
} |
@@ -7,11 +7,13 @@ | |||
mc:Ignorable="d" | |||
d:DesignHeight="270" d:DesignWidth="180" > | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
<Viewbox Width="auto" Height="auto" Grid.Row="1"> | |||
<Grid Width="180" Height="270"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
Margin="0 10 0 35" | |||
@@ -19,61 +21,64 @@ | |||
Foreground="#FF1FD622" | |||
Tag="出料控制" | |||
Text="出料中..." Visibility="Collapsed"/> | |||
<Ellipse Grid.Row="0" Tag="出料圆" Margin="0,40,0,0" Visibility="Collapsed" StrokeThickness="60" Width="150" Height="70" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Top"> | |||
<Ellipse.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform AngleY="0"/> | |||
<RotateTransform Angle="0"/> | |||
<TranslateTransform/> | |||
</TransformGroup> | |||
</Ellipse.RenderTransform> | |||
<Ellipse.Stroke> | |||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" Opacity="0.4"> | |||
<GradientStop Color="#CCA48E42"/> | |||
<GradientStop Color="#CC2D48DA" Offset="1"/> | |||
<GradientStop Color="#FF3FD256" Offset="0.305"/> | |||
<!--<GradientStop Color="#FFB12C87" Offset="0.67"/>--> | |||
</LinearGradientBrush> | |||
</Ellipse.Stroke> | |||
</Ellipse> | |||
<Ellipse Grid.Row="0" Tag="出料圆" Margin="0,40,0,0" Visibility="Collapsed" StrokeThickness="60" Width="150" Height="70" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Top"> | |||
<Ellipse.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform AngleY="0"/> | |||
<RotateTransform Angle="0"/> | |||
<TranslateTransform/> | |||
</TransformGroup> | |||
</Ellipse.RenderTransform> | |||
<Ellipse.Stroke> | |||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" Opacity="0.4"> | |||
<GradientStop Color="#CCA48E42"/> | |||
<GradientStop Color="#CC2D48DA" Offset="1"/> | |||
<GradientStop Color="#FF3FD256" Offset="0.305"/> | |||
<!--<GradientStop Color="#FFB12C87" Offset="0.67"/>--> | |||
</LinearGradientBrush> | |||
</Ellipse.Stroke> | |||
</Ellipse> | |||
<TextBlock | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Bottom" | |||
Margin="0 0 0 35" | |||
FontSize="45" | |||
Foreground="#FFCCD61F" Tag="Title" | |||
Text="{Binding Title,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> | |||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center"> | |||
<TextBlock | |||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center"> | |||
<TextBlock | |||
Margin="0,20,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#FF00FFF9" Tag="Value" | |||
Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> | |||
<TextBlock | |||
<TextBlock | |||
Margin="0,20,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#FF00FFF9" | |||
Text="(g)" /> | |||
</StackPanel> | |||
<TextBlock | |||
</StackPanel> | |||
<TextBlock | |||
Grid.Row="1" Tag="Text" | |||
Margin="0,70,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="25" | |||
Foreground="#FFFFA400" | |||
Text="{Binding Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> | |||
<Image | |||
<Image | |||
Grid.RowSpan="2" | |||
Source="/BPASmartClient.SCADAControl;component/Images/光柱.png" | |||
Stretch="Fill" /> | |||
<!--<StackPanel Tag="ControlEvent" HorizontalAlignment="Right" Orientation="Vertical" Grid.Row="1" VerticalAlignment="Bottom" > | |||
<!--<StackPanel Tag="ControlEvent" HorizontalAlignment="Right" Orientation="Vertical" Grid.Row="1" VerticalAlignment="Bottom" > | |||
<Image Margin="20,10,0,0" Tag="出料" Source="/BPASmartClient.SCADAControl;component/Images/借出.png" Cursor="Hand" ToolTip="出料" Width="24" ></Image> | |||
<Image Margin="20,10,0,10" Tag="停止出料" Source="/BPASmartClient.SCADAControl;component/Images/退出.png" Cursor="Hand" Width="24" ToolTip="停止出料"></Image> | |||
</StackPanel>--> | |||
</Grid> | |||
</Viewbox> | |||
</Grid> | |||
</UserControl> |
@@ -9,11 +9,12 @@ | |||
Foreground="#FF00EDFF" | |||
BorderBrush="Transparent" | |||
BorderThickness="4" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
d:DesignHeight="800" d:DesignWidth="800"> | |||
<Ellipse Tag="Ellipse" | |||
Fill="{Binding ElementName=root,Path=BJColor,Mode=TwoWay}" | |||
Stroke="{Binding ElementName=root,Path=Foreground}" | |||
StrokeThickness="{Binding ElementName=root,Path=BorderThickness}" | |||
StrokeThickness="{Binding ElementName=root,Path=BKThickness}" | |||
StrokeDashArray="{Binding ElementName=root,Path=DoubleArray,Mode=TwoWay}" | |||
> | |||
</Ellipse> | |||
@@ -1,6 +1,7 @@ | |||
using BPASmartClient.Compiler; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
@@ -70,14 +71,15 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
Width = 80; | |||
Height = 80; | |||
} | |||
BKStrokeDashArray.CollectionChanged += BKStrokeDashArray_CollectionChanged; | |||
} | |||
public bool IsCheckedColor | |||
private void BKStrokeDashArray_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) | |||
{ | |||
get { return (bool)GetValue(IsCheckedProperty); } | |||
set { SetValue(IsCheckedProperty, value); } | |||
Refresh(); | |||
} | |||
public static readonly DependencyProperty IsCheckedProperty = | |||
DependencyProperty.Register("IsChecked", typeof(bool), typeof(TheEllipse), new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged))); | |||
public Brush BJColor | |||
{ | |||
get { return (Brush)GetValue(BJColorProperty); } | |||
@@ -85,16 +87,36 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
} | |||
public static readonly DependencyProperty BJColorProperty = | |||
DependencyProperty.Register("BJColor", typeof(Brush), typeof(TheEllipse), new PropertyMetadata(new SolidColorBrush(Colors.Transparent))); | |||
public double BKThickness | |||
{ | |||
get { return (double)GetValue(BKThicknessProperty); } | |||
set { SetValue(BKThicknessProperty, value); } | |||
} | |||
public static readonly DependencyProperty BKThicknessProperty = | |||
DependencyProperty.Register("BKThickness", typeof(double), typeof(TheEllipse), new PropertyMetadata(1.0)); | |||
public ObservableCollection<double> BKStrokeDashArray | |||
{ | |||
get { return (ObservableCollection<double>)GetValue(BKStrokeDashArrayProperty); } | |||
set { SetValue(BKStrokeDashArrayProperty, value); } | |||
} | |||
public static readonly DependencyProperty BKStrokeDashArrayProperty = | |||
DependencyProperty.Register("BKStrokeDashArray", typeof(ObservableCollection<double>), typeof(TheEllipse), new PropertyMetadata(new ObservableCollection<double>(),new PropertyChangedCallback(OnPropertyChanged))); | |||
public DoubleCollection DoubleArray | |||
{ | |||
get { return (DoubleCollection)GetValue(DoubleArrayProperty); } | |||
set { SetValue(DoubleArrayProperty, value); } | |||
} | |||
public static readonly DependencyProperty DoubleArrayProperty = | |||
DependencyProperty.Register("DoubleArray", typeof(DoubleCollection), typeof(TheEllipse), new PropertyMetadata(new DoubleCollection())); | |||
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||
{ | |||
(d as TheEllipse)?.Refresh(); | |||
} | |||
private void Refresh() | |||
{ | |||
//if (LeftTog != null) | |||
//{ | |||
// LeftTog.Fill = IsCheckedColor ? new SolidColorBrush(Colors.Transparent) : this.Foreground; | |||
//} | |||
DoubleArray = new DoubleCollection(BKStrokeDashArray); | |||
} | |||
public event EventHandler PropertyChange; //声明一个事件 | |||
public string ControlType => "控件"; | |||
@@ -11,10 +11,12 @@ | |||
BorderThickness="4" | |||
Tag="10" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<Border Tag="border" | |||
Background="{Binding ElementName=root,Path=BJColor,Mode=TwoWay}" | |||
BorderBrush="{Binding ElementName=root,Path=Foreground}" | |||
BorderThickness="{Binding ElementName=root,Path=BorderThickness}" | |||
CornerRadius="{Binding ElementName=root,Path=Tag}" | |||
/> | |||
<Rectangle Tag="border" | |||
Fill="{Binding ElementName=root,Path=BJColor,Mode=TwoWay}" | |||
Stroke="{Binding ElementName=root,Path=Foreground}" | |||
StrokeThickness="{Binding ElementName=root,Path=BKThickness}" | |||
StrokeDashArray="{Binding ElementName=root,Path=DoubleArray,Mode=TwoWay}" | |||
> | |||
</Rectangle> | |||
</UserControl> |
@@ -1,6 +1,7 @@ | |||
using BPASmartClient.Compiler; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
@@ -70,24 +71,20 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
Width = 80; | |||
Height = 80; | |||
} | |||
BKStrokeDashArray.CollectionChanged += BKStrokeDashArray_CollectionChanged; | |||
} | |||
public bool IsCheckedColor | |||
private void BKStrokeDashArray_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) | |||
{ | |||
get { return (bool)GetValue(IsCheckedProperty); } | |||
set { SetValue(IsCheckedProperty, value); } | |||
Refresh(); | |||
} | |||
public static readonly DependencyProperty IsCheckedProperty = | |||
DependencyProperty.Register("IsChecked", typeof(bool), typeof(TheRectangle), new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged))); | |||
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||
{ | |||
(d as TheRectangle)?.Refresh(); | |||
} | |||
private void Refresh() | |||
{ | |||
if (LeftTog != null) | |||
{ | |||
LeftTog.Background = IsCheckedColor ? new SolidColorBrush(Colors.Transparent) : this.Foreground; | |||
} | |||
DoubleArray = new DoubleCollection(BKStrokeDashArray); | |||
} | |||
public Brush BJColor | |||
@@ -97,6 +94,28 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
} | |||
public static readonly DependencyProperty BJColorProperty = | |||
DependencyProperty.Register("BJColor", typeof(Brush), typeof(TheRectangle), new PropertyMetadata(new SolidColorBrush(Colors.Transparent))); | |||
public double BKThickness | |||
{ | |||
get { return (double)GetValue(BKThicknessProperty); } | |||
set { SetValue(BKThicknessProperty, value); } | |||
} | |||
public static readonly DependencyProperty BKThicknessProperty = | |||
DependencyProperty.Register("BKThickness", typeof(double), typeof(TheRectangle), new PropertyMetadata(1.0)); | |||
public ObservableCollection<double> BKStrokeDashArray | |||
{ | |||
get { return (ObservableCollection<double>)GetValue(BKStrokeDashArrayProperty); } | |||
set { SetValue(BKStrokeDashArrayProperty, value); } | |||
} | |||
public static readonly DependencyProperty BKStrokeDashArrayProperty = | |||
DependencyProperty.Register("BKStrokeDashArray", typeof(ObservableCollection<double>), typeof(TheRectangle), new PropertyMetadata(new ObservableCollection<double>(), new PropertyChangedCallback(OnPropertyChanged))); | |||
public DoubleCollection DoubleArray | |||
{ | |||
get { return (DoubleCollection)GetValue(DoubleArrayProperty); } | |||
set { SetValue(DoubleArrayProperty, value); } | |||
} | |||
public static readonly DependencyProperty DoubleArrayProperty = | |||
DependencyProperty.Register("DoubleArray", typeof(DoubleCollection), typeof(TheRectangle), new PropertyMetadata(new DoubleCollection())); | |||
public event EventHandler PropertyChange; //声明一个事件 | |||
public string ControlType => "控件"; | |||
private bool isExecuteState; | |||
@@ -0,0 +1,87 @@ | |||
<UserControl x:Class="BPASmartClient.SCADAControl.CustomerControls.TheWuLiaoControl" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:kj="clr-namespace:BPASmartClient.SCADAControl.Converters" | |||
xmlns:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls" | |||
mc:Ignorable="d" | |||
x:Name="main" | |||
Width="200" Height="200"> | |||
<UserControl.Resources> | |||
<Style x:Key="ListBoxItemCustom" TargetType="ListBoxItem"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> | |||
<Setter Property="Padding" Value="0" /> | |||
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=ItemsControl}}" /> | |||
<Setter Property="VerticalContentAlignment" Value="Top" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="BorderBrush" Value="Transparent" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ListBoxItem"> | |||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ListBoxBaseStyle" TargetType="ListBox"> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> | |||
<Setter Property="BorderThickness" Value="1" /> | |||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" /> | |||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="true" /> | |||
<Setter Property="ScrollViewer.PanningMode" Value="Both" /> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Padding" Value="2,2,2,0" /> | |||
</Style> | |||
<Style x:Key="ListBoxCustom" BasedOn="{StaticResource ListBoxBaseStyle}" TargetType="ListBox"> | |||
<Setter Property="ItemContainerStyle" Value="{StaticResource ListBoxItemCustom}" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Ellipse Fill="Transparent" Stroke="{Binding Foreground, ElementName=main}" StrokeThickness="{Binding BorderThickness, ElementName=main}" Width="{Binding Width, ElementName=main}" Height="{Binding Width, ElementName=main}"/> | |||
<Viewbox Width="auto" Height="auto" > | |||
<Grid> | |||
<ListBox Background="Transparent" Margin="30" ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Path=vs}" Style="{DynamicResource ListBoxCustom}" BorderThickness="0" > | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<kj:HoneycombPanel /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Width="150" Height="150" Margin="10"> | |||
<Ellipse Width="140" Height="140" Fill="Transparent" Stroke="{Binding Foreground, ElementName=main}" StrokeThickness="{Binding BorderThickness, ElementName=main}"/> | |||
<TextBlock Text="一号料仓" Margin="0,-10,0,0" Foreground="{Binding Foreground, ElementName=main}" HorizontalAlignment="Center"></TextBlock> | |||
<Viewbox Width="auto" Height="auto"> | |||
<ListBox Background="Transparent" ItemsSource="{Binding dataModel}" Style="{DynamicResource ListBoxCustom}" BorderThickness="0" > | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<kj:HoneycombPanel /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<Ellipse Width="100" Height="100" Fill="Transparent" Stroke="{Binding Foreground, ElementName=main}" StrokeThickness="{Binding BorderThickness, ElementName=main}" Margin="10"/> | |||
<TextBlock HorizontalAlignment="Center" Foreground="{Binding Foreground, ElementName=main}" VerticalAlignment="Center" FontSize="24" Text="味精"></TextBlock> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</Viewbox> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</Grid> | |||
</Viewbox> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,119 @@ | |||
using BPASmartClient.Compiler; | |||
using BPASmartClient.DATABUS; | |||
using BPASmartClient.MessageCommunication; | |||
using BPASmartClient.MessageCommunication.MsgControl; | |||
using BPASmartClient.MessageName; | |||
using BPASmartClient.MessageName.EnumHelp; | |||
using BPASmartClient.MessageName.发送消息Model; | |||
using BPASmartClient.MessageName.接收消息Model; | |||
using BPASmartClient.MessageName.接收消息Model.物料仓; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.ComponentModel; | |||
using System.Drawing.Design; | |||
using System.Linq; | |||
using System.Reflection; | |||
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.Media; | |||
using System.Windows.Media.Animation; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
using System.Windows.Threading; | |||
namespace BPASmartClient.SCADAControl.CustomerControls | |||
{ | |||
/// <summary> | |||
/// TheWuLiaoControl.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class TheWuLiaoControl : UserControl, IExecutable, IDisposable | |||
{ | |||
public TheWuLiaoControl() | |||
{ | |||
InitializeComponent(); | |||
vs.Add(new shujuModel | |||
{ | |||
name = "", | |||
dataModel = new ObservableCollection<string> { "", "" } | |||
}); | |||
vs.Add(new shujuModel | |||
{ | |||
name = "", | |||
dataModel = new ObservableCollection<string> { "", "", "", "" } | |||
}); | |||
Width = 200; | |||
Height = 200; | |||
} | |||
public string ControlType => "物料仓"; | |||
private bool isExecuteState; | |||
public bool IsExecuteState | |||
{ | |||
get { return isExecuteState; } | |||
set | |||
{ | |||
isExecuteState = value; | |||
if (IsExecuteState) | |||
{ | |||
IsEnabled = true; | |||
Register(); | |||
} | |||
} | |||
} | |||
public event EventHandler PropertyChange; //声明一个事件 | |||
/// <summary> | |||
/// 数据模板 | |||
/// </summary> | |||
private ObservableCollection<shujuModel> vs | |||
{ | |||
get { return (ObservableCollection<shujuModel>)GetValue(vsProperty); } | |||
set { SetValue(vsProperty, value); } | |||
} | |||
private static readonly DependencyProperty vsProperty = | |||
DependencyProperty.Register("vs", typeof(ObservableCollection<shujuModel>), typeof(TheWuLiaoControl), new PropertyMetadata(new ObservableCollection<shujuModel>())); | |||
/// <summary> | |||
/// 数据模板 | |||
/// </summary> | |||
private Dictionary<string, object> DataModel | |||
{ | |||
get { return (Dictionary<string, object>)GetValue(DataModelProperty); } | |||
set { SetValue(DataModelProperty, value); } | |||
} | |||
private static readonly DependencyProperty DataModelProperty = | |||
DependencyProperty.Register("DataModel", typeof(Dictionary<string, object>), typeof(TheWuLiaoControl), new PropertyMetadata(new Dictionary<string, object>())); | |||
public void Register() | |||
{ | |||
Class_DataBus.GetInstance().BindingAction += BindingActionHeader; | |||
} | |||
public void BindingActionHeader(object sender, EventArgs e) | |||
{ | |||
this.Dispatcher.Invoke((Action)(() => | |||
{ | |||
DataModel = Class_DataBus.GetInstance().Dic_RedisDataBinding; | |||
PropertyChange?.Invoke(this, EventArgs.Empty); | |||
})); | |||
} | |||
public void Dispose() | |||
{ | |||
} | |||
} | |||
public class shujuModel | |||
{ | |||
public string name { get; set; } | |||
public ObservableCollection<string> dataModel { get; set; } | |||
} | |||
} |
@@ -2293,4 +2293,6 @@ | |||
<GradientStop Offset="1" Color="#E3E3E3" /> | |||
</LinearGradientBrush> | |||
<!--#endregion--> | |||
</ResourceDictionary> |
@@ -296,7 +296,10 @@ | |||
<mypro:PropertyDefinition DisplayName="前景色" Category="颜色设置" Name="Foreground"/> | |||
<mypro:PropertyDefinition DisplayName="背景色" Category="颜色设置" Name="Background"/> | |||
<mypro:PropertyDefinition DisplayName="填充颜色" Category="颜色设置" Name="BJColor"/> | |||
<mypro:PropertyDefinition DisplayName="边框宽度" Category="基本属性" Name="BKThickness"/> | |||
<mypro:PropertyDefinition DisplayName="虚线绘制" Category="基本属性" Name="BKStrokeDashArray"/> | |||
<mypro:PropertyDefinition DisplayName="边框色" Category="颜色设置" Name="BorderBrush"/> | |||
<mypro:PropertyDefinition DisplayName="填充" Category="基本属性" DisplayOrder="5" Name="WaveFill"/> | |||
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="WaveThickness"/> | |||
@@ -371,6 +371,11 @@ | |||
<Setter TargetName="txt" Property="Text" Value="圆形" /> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding Name}" Value="TheWuLiaoControl"> | |||
<Setter TargetName="icon" Property="Kind" Value="AlphaGCircleOutline" /> | |||
<Setter TargetName="txt" Property="Text" Value="物料集合控件" /> | |||
</DataTrigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||