Browse Source

1111

样式分支
fyf 2 years ago
parent
commit
c4bccdf13b
5 changed files with 263 additions and 57 deletions
  1. +2
    -0
      BeDesignerSCADA/BeDesignerSCADA.csproj
  2. +202
    -55
      BeDesignerSCADA/Controls/CanvasPanelNew.xaml
  3. +31
    -0
      BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs
  4. BIN
     
  5. +28
    -2
      BeDesignerSCADA/Themes/Styles.xaml

+ 2
- 0
BeDesignerSCADA/BeDesignerSCADA.csproj View File

@@ -49,6 +49,7 @@
<ItemGroup>
<None Remove="Fonts\ds-digib.ttf" />
<None Remove="Images\bj.png" />
<None Remove="Images\Exp.png" />
<None Remove="Images\fyf.ico" />
<None Remove="Images\gaugeMask.png" />
<None Remove="Images\hbl.ico" />
@@ -84,6 +85,7 @@
<ItemGroup>
<Resource Include="Fonts\ds-digib.ttf" />
<Resource Include="Images\bj.png" />
<Resource Include="Images\Exp.png" />
<Resource Include="Images\fyf.ico" />
<Resource Include="Images\gaugeMask.png" />
<Resource Include="Images\hbl.ico" />


+ 202
- 55
BeDesignerSCADA/Controls/CanvasPanelNew.xaml View File

@@ -19,86 +19,233 @@
<ResourceDictionary Source="/BPASmartClient.SCADAControl;component/Themes/Generic.xaml" />

</ResourceDictionary.MergedDictionaries>
<Style x:Key="TheTabItem1" TargetType="{x:Type TabItem}">
<Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}" />
<Setter Property="Padding" Value="6,1,6,1" />
<!--#region Menu-->
<SolidColorBrush x:Key="Menu.Static.Background" Color="#FFF0F0F0" />
<SolidColorBrush x:Key="Expander.Static.Circle.Stroke" Color="#FF333333" />
<SolidColorBrush x:Key="Expander.Static.Circle.Fill" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="Expander.Static.Arrow.Stroke" Color="#FF333333" />
<SolidColorBrush x:Key="Expander.MouseOver.Circle.Stroke" Color="#FF5593FF" />
<SolidColorBrush x:Key="Expander.MouseOver.Circle.Fill" Color="#FFF3F9FF" />
<SolidColorBrush x:Key="Expander.MouseOver.Arrow.Stroke" Color="#FF000000" />
<SolidColorBrush x:Key="Expander.Pressed.Circle.Stroke" Color="#FF3C77DD" />
<SolidColorBrush x:Key="Expander.Pressed.Circle.Fill" Color="#FFD9ECFF" />
<SolidColorBrush x:Key="Expander.Pressed.Arrow.Stroke" Color="#FF000000" />
<SolidColorBrush x:Key="Expander.Disabled.Circle.Stroke" Color="#FFBCBCBC" />
<SolidColorBrush x:Key="Expander.Disabled.Circle.Fill" Color="#FFE6E6E6" />
<SolidColorBrush x:Key="Expander.Disabled.Arrow.Stroke" Color="#FF707070" />
<Style x:Key="ExpanderHeaderFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Border>
<Rectangle
Margin="0"
SnapsToDevicePixels="true"
Stroke="Black"
StrokeDashArray="1 2"
StrokeThickness="1" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border Padding="{TemplateBinding Padding}" Cursor="Hand">
<Grid
Height="25"
Margin="5"
SnapsToDevicePixels="False">
<Grid.Background>
<ImageBrush ImageSource="../Images/Exp.png" />
</Grid.Background>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Ellipse
x:Name="circle"
Width="19"
Height="19"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{StaticResource Expander.Static.Circle.Fill}"
Stroke="{StaticResource Expander.Static.Circle.Stroke}"
Visibility="Collapsed" />
<Path
x:Name="arrow"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 1,1.5 L 4.5,5 L 8,1.5"
SnapsToDevicePixels="false"
Stroke="{StaticResource Expander.Static.Arrow.Stroke}"
StrokeThickness="2"
Visibility="Collapsed" />
<ContentPresenter
Grid.Column="1"
Margin="4,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
RecognizesAccessKey="True"
SnapsToDevicePixels="True" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="arrow" Property="Data" Value="M 1,4.5 L 4.5,1 L 8,4.5" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="circle" Property="Stroke" Value="{StaticResource Expander.MouseOver.Circle.Stroke}" />
<Setter TargetName="circle" Property="Fill" Value="{StaticResource Expander.MouseOver.Circle.Fill}" />
<Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="circle" Property="Stroke" Value="{StaticResource Expander.Pressed.Circle.Stroke}" />
<Setter TargetName="circle" Property="StrokeThickness" Value="1.5" />
<Setter TargetName="circle" Property="Fill" Value="{StaticResource Expander.Pressed.Circle.Fill}" />
<Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.Pressed.Arrow.Stroke}" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="circle" Property="Stroke" Value="{StaticResource Expander.Disabled.Circle.Stroke}" />
<Setter TargetName="circle" Property="Fill" Value="{StaticResource Expander.Disabled.Circle.Fill}" />
<Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.Disabled.Arrow.Stroke}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="expang_1" TargetType="{x:Type Expander}">
<Setter Property="Foreground" Value="#FF5593FF" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<ControlTemplate TargetType="{x:Type Expander}">
<Border
x:Name="Bd"
Margin="5"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="0">
<ContentPresenter x:Name="Content" HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
ContentSource="Header"
Cursor="Hand"
Margin="0,10,0,10"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" >
<ContentPresenter.LayoutTransform>
<RotateTransform Angle="90" />
</ContentPresenter.LayoutTransform>

</ContentPresenter>
CornerRadius="3"
SnapsToDevicePixels="true">
<DockPanel>
<ToggleButton
x:Name="HeaderSite"
MinWidth="0"
MinHeight="0"
Margin="1"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
DockPanel.Dock="Top"
FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontStretch="{TemplateBinding FontStretch}"
FontStyle="{TemplateBinding FontStyle}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpanderDownHeaderStyle}" />
<ContentPresenter
x:Name="ExpandSite"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
DockPanel.Dock="Bottom"
Focusable="false"
Visibility="Collapsed" />
</DockPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Foreground" Value="#FFC1A800" />
<Setter Property="FontSize" Value="14" />
<Setter TargetName="Bd" Property="Background" Value="#FF1E535D"/>
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF707070"/>
<Setter TargetName="Bd" Property="BorderThickness" Value="1"/>
<Trigger Property="IsExpanded" Value="true">
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter Property="Foreground" Value="Black" />
<Setter Property="FontSize" Value="14" />
<Setter TargetName="Bd" Property="Background" Value="#FFDDDDDD"/>
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF707070"/>
<Setter TargetName="Bd" Property="BorderThickness" Value="1"/>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
</Trigger>
<!--<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Black" />
<Setter Property="FontSize" Value="14" />
<Setter TargetName="Bd" Property="Background" Value="#FFDDDDDD"/>
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF707070"/>
<Setter TargetName="Bd" Property="BorderThickness" Value="1"/>
</Trigger>-->
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<!--#endregion-->
</ResourceDictionary>
</UserControl.Resources>
<Grid x:Name="grid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="260"/>
<ColumnDefinition Width="250"/>
<ColumnDefinition/>
<ColumnDefinition Width="320"/>
</Grid.ColumnDefinitions>

<!--左侧选择区域-->
<Grid>
<TabControl TabStripPlacement="Left" Background="Transparent" BorderBrush="{StaticResource AccentBrush}" BorderThickness="1" Margin="4" Padding="5">
<TabItem Header="导航布局" Style="{DynamicResource TheTabItem1}"></TabItem>
<TabItem Header="页面" Style="{DynamicResource TheTabItem1}">

</TabItem>
<TabItem Header="组件树" Style="{DynamicResource TheTabItem1}">
<ListBox x:Name="CtlList" Background="Transparent" ItemTemplate="{DynamicResource ToolBoxStyle}" FontSize="14" BorderThickness="0" PreviewMouseMove="CtlList_PreviewMouseMove"/>
</TabItem>
</TabControl>
<!--<Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Background="Transparent" Margin="4">
</Border>-->
</Grid>
<Border x:Name="bordermain" BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Background="Transparent" Margin="4">
<Grid>
<Grid.RowDefinitions >
<RowDefinition Height="{Binding Height, ElementName=wapanl}"/>
<RowDefinition Height="{Binding Height, ElementName=PageList}" MaxHeight="500"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Expander Style="{DynamicResource expang_1}" x:Name="wapanl" Header="菜单布局" Grid.Row="0" IsExpanded="False">
<WrapPanel Margin="10,0,10,5" >
<RadioButton Margin="10,0,0,0" FontSize="14">顶部水平</RadioButton>
<RadioButton IsChecked="True" Margin="10,0,0,0" FontSize="14">左侧垂直</RadioButton>
<RadioButton Margin="10,0,0,0" FontSize="14">右侧垂直</RadioButton>
<RadioButton Margin="10,0,0,0" FontSize="14">底部水平</RadioButton>
</WrapPanel>
</Expander>
<Expander Style="{DynamicResource expang_1}" x:Name="expander" Margin="0,-10,0,0" Header="页面编辑" Grid.Row="1" IsExpanded="True">
<ListBox x:Name="PageList" Background="Transparent" Margin="0,0,0,10" MaxHeight="460" ScrollViewer.VerticalScrollBarVisibility="Auto" ItemTemplate="{DynamicResource PageBoxStyle}" FontSize="14" BorderThickness="0" >
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="设置首页">
<MenuItem.Icon>
<icon:PackIconModern Width="10" HorizontalAlignment="Center" Kind="HomeGarage" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="向上移动">
<MenuItem.Icon>
<icon:PackIconModern Width="10" HorizontalAlignment="Center" Kind="Upload" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="向下移动">
<MenuItem.Icon>
<icon:PackIconModern Width="10" HorizontalAlignment="Center" Kind="Download" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="编辑信息">
<MenuItem.Icon>
<icon:PackIconModern Width="10" HorizontalAlignment="Center" Kind="Edit" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="删除该页">
<MenuItem.Icon>
<icon:PackIconModern Width="10" HorizontalAlignment="Center" Kind="Delete" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
</Expander>
<icon:PackIconMaterial x:Name="icon" Width="24" Height="17" Grid.Row="1" Foreground="{StaticResource AccentBrush}"
Margin="0,0,15,0" Cursor="Hand" HorizontalAlignment="Right" VerticalAlignment="Top" ToolTip="添加页" BorderThickness="1" Kind="HospitalBoxOutline" />
<Expander Style="{DynamicResource expang_1}" Margin="0,-10,0,10" Header="组件列表" Grid.Row="2" IsExpanded="True"/>
<ListBox x:Name="CtlList" Grid.Row="2" Margin="0,30,0,0" Background="Transparent" ScrollViewer.VerticalScrollBarVisibility="Auto" ItemTemplate="{DynamicResource ToolBoxStyle}" FontSize="14" BorderThickness="0" PreviewMouseMove="CtlList_PreviewMouseMove" />
</Grid>
</Border>

<!--中间控制区域-->
<DockPanel Grid.Column="1">


+ 31
- 0
BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs View File

@@ -6,6 +6,7 @@ using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
@@ -38,6 +39,9 @@ namespace BeDesignerSCADA.Controls
/// </summary>
public string Path = string.Empty;
MainViewModelNew viewModel = new MainViewModelNew();

ObservableCollection<PageModel> pageModels = new ObservableCollection<PageModel>();

public CanvasPanelNew(string _Path)
{
InitializeComponent();
@@ -49,6 +53,17 @@ namespace BeDesignerSCADA.Controls
//控件加载
Assembly assembly = Assembly.LoadFile($"{System.AppDomain.CurrentDomain.BaseDirectory}\\BPASmartClient.SCADAControl.dll"); //Assembly.GetExecutingAssembly();
CtlList.ItemsSource = assembly.GetTypes().Where(t => t.GetInterface("IExecutable") != null).OrderBy(o => o.Name)?.ToList();
pageModels.Add(new PageModel { Name="首页面", PathName="首页面", visual= cav });
pageModels.Add(new PageModel { Name = "第二页面", PathName = "首页面", visual = cav });
pageModels.Add(new PageModel { Name = "第二页面", PathName = "首页面", visual = cav });
pageModels.Add(new PageModel { Name = "第二页面", PathName = "首页面", visual = cav });
pageModels.Add(new PageModel { Name = "第二页面", PathName = "首页面", visual = cav });
pageModels.Add(new PageModel { Name = "第二页面", PathName = "首页面", visual = cav });
pageModels.Add(new PageModel { Name = "第二页面", PathName = "首页面", visual = cav });
pageModels.Add(new PageModel { Name = "第二页面", PathName = "首页面", visual = cav });
pageModels.Add(new PageModel { Name = "第二页面", PathName = "首页面", visual = cav });

PageList.ItemsSource = pageModels;
//读取文件
FileRead(_Path);
}
@@ -509,4 +524,20 @@ namespace BeDesignerSCADA.Controls
}
#endregion
}

public class PageModel
{
/// <summary>
/// 页面名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 路径名称
/// </summary>
public string PathName { get; set; }
/// <summary>
/// 页面
/// </summary>
public object visual { get; set; }
}
}

BIN
View File


+ 28
- 2
BeDesignerSCADA/Themes/Styles.xaml View File

@@ -197,6 +197,33 @@
<!--#endregion-->

<!--#region 其他-->
<DataTemplate x:Key="PageBoxStyle">
<Grid x:Name="mains" Margin="2,5,0,5" Background="Transparent">
<Grid>
<Grid.Background>
<ImageBrush ImageSource="../Images/bj.png" Stretch="UniformToFill"/>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Rectangle Height="100" Width="200" Stroke="Cyan" StrokeThickness="1">
<Rectangle.Fill>
<VisualBrush Visual="{Binding visual,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
</Rectangle.Fill>
</Rectangle>
<TextBlock Grid.Row="1" FontWeight="Bold" Margin="5,0,0,0" FontSize="14" Foreground="#FFFFA500"
x:Name="txt"
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Text="{Binding Name}" />
</Grid>

</Grid>
</DataTemplate>

<DataTemplate x:Key="ToolBoxStyle">
<Grid Margin="2" Background="Transparent">
<Grid.ColumnDefinitions>
@@ -216,7 +243,6 @@
Margin="4"
Text="{Binding Name}" />
</Grid>

<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Name}" Value="TheButton">
<Setter TargetName="icon" Property="Kind" Value="GestureTapButton" />
@@ -463,7 +489,7 @@
</ContextMenu>

<!--#endregion-->
<!--#region 控制集合-->
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Foreground" Value="White" />


Loading…
Cancel
Save