Commit e06f9c9a by wangonghui

修改Clock的问题

parent 0f0164fc
<UserControl x:Class="VIZ.Package.Module.ColorEditPanel"
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:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
mc:Ignorable="d"
x:Name="colorEditControl"
d:DesignHeight="300" d:DesignWidth="380">
<UserControl.Resources>
<dx:ColorToBrushConverter x:Key="ColorToBrushConverter" />
<Style x:Key="paletteColorsStyle" TargetType="ListBox">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem">
<Setter Property="Margin" Value="1,0,1,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Fill="{Binding Converter={StaticResource ColorToBrushConverter}}" Width="12" Height="12" Stroke="Gray" StrokeThickness="1" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate TargetType="RadioButton" x:Key="radioToggle">
<ToggleButton Content="{TemplateBinding Content}" IsChecked="{Binding IsChecked, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" />
</ControlTemplate>
<DataTemplate x:Key="itemTemplate">
<StackPanel Orientation="Horizontal" Margin="0,1,0,1">
<ListBox ItemsSource="{Binding Converter={StaticResource PaletteCollectionConverter}}" Margin="6,0,0,0" Style="{StaticResource paletteColorsStyle}"/>
<TextBlock Text="{Binding Name}" Margin="6,0,6,0"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="smallItemTemplate">
<StackPanel Orientation="Horizontal" Margin="0,1,0,1">
<TextBlock Text="{Binding Name}" Margin="6,0,6,0"/>
</StackPanel>
</DataTemplate>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel Grid.Row="0" Height="40">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<!--<ColumnDefinition Width="85"/>
<ColumnDefinition Width="85"/>
<ColumnDefinition Width="85"/>
<ColumnDefinition Width="85"/>-->
<ColumnDefinition Width="340"/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<dxe:ButtonEdit ShowText="False" AllowDefaultButton="False" IsEnabled="{Binding BtnGroupEnable,Mode=TwoWay}">
<dxe:ButtonInfo Content="Ambient" IsEnabled="{Binding Path=IsEnabledA,Mode=TwoWay}" Command="{Binding AmbCommand}"/>
<dxe:ButtonInfo Content="Diffuse" IsEnabled="{Binding Path=IsEnabledD,Mode=TwoWay}" Command="{Binding DiffCommand}"/>
<dxe:ButtonInfo Content="Specular" IsEnabled="{Binding Path=IsEnabledS,Mode=TwoWay}" Command="{Binding SpecCommand}"/>
<dxe:ButtonInfo Content="Emission" IsEnabled="{Binding Path=IsEnabledE,Mode=TwoWay}" Command="{Binding EmisCommand}"/>
</dxe:ButtonEdit>
<CheckBox Content="E" Margin="10,0,0,0"
ToolTip="Title Safe"
IsChecked="{Binding Path=IsEnabledAll,Mode=TwoWay}" Grid.Column="4">
</CheckBox>
<!--<Button Content="E" Grid.Column="4" IsEnabled="{Binding Path=IsEnabledAll,Mode=TwoWay}" Command="{Binding EnableCommand}" Style="{StaticResource CheckBox_Preview_TA}"/>-->
<!--<dxe:ToggleSwitch x:Name="toggleSwitch"
VerticalAlignment="Center"
HorizontalAlignment="Center"
CheckedStateContent="E"
UncheckedStateContent="E"
ContentPlacement="Inside"
Grid.Column="4"/>-->
</Grid>
</WrapPanel>
<WrapPanel Grid.Row="1" Height="40">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<WrapPanel Grid.Column="0" Height="40">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Shininess" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<dxe:TextEdit Grid.Column="1" Text="{Binding Path=Shininess,Mode=TwoWay}" HorizontalAlignment="Left" Height="30" Width="80" VerticalAlignment="Center"/>
</Grid>
</WrapPanel>
<WrapPanel Grid.Column="1" Height="40">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Alpha" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<dxe:TextEdit Grid.Column="1" Text="{Binding Path=Alpha,Mode=TwoWay}" HorizontalAlignment="Left" Width="80" Height="30" VerticalAlignment="Center"/>
</Grid>
</WrapPanel>
<Border Name="currentColor" BorderBrush="DarkGray" BorderThickness="1" Width="40" Background="{Binding Path=ColorValue, Converter={StaticResource ColorToBrushConverter} }" Grid.Column="2"/>
</Grid>
</WrapPanel>
<StackPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center">
<dxe:ColorEdit Color="{Binding Path=ColorValue,Mode=TwoWay}" ShowDefaultColorButton="False" >
</dxe:ColorEdit>
</StackPanel>
</Grid>
</UserControl>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.Framework.Core;
namespace VIZ.Package.Module
{
/// <summary>
/// Interaction logic for ColorEditPanel.xaml
/// </summary>
public partial class ColorEditPanel : UserControl
{
public ColorEditPanel()
{
InitializeComponent();
//WPF的绑定
WPFHelper.BindingViewModel(this, new ColorEditPanelModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using VIZ.Framework.Core;
namespace VIZ.Package.Module
{
public class ColorEditPanelModel : EditPanelModelBase
{
public override string GetFieldValue()
{
throw new NotImplementedException();
}
public ColorEditPanelModel()
{
InitCommand();
}
/// <summary>
/// 初始化方法
/// </summary>
private void InitCommand()
{
this.AmbCommand = new VCommand(AmbCmd);
this.DiffCommand = new VCommand(DiffCmd);
this.SpecCommand = new VCommand(SpecCmd);
this.EmisCommand = new VCommand(EmisCmd);
}
/// <summary>
/// 绑定color颜色
/// </summary>
private Color colorValue;
public Color ColorValue
{
get { return colorValue; }
set
{
colorValue = value;
this.RaisePropertyChanged(nameof(ColorValue));
if (IsEnabledAll)
{
if (IsEnabledA == false)
{
ambientColor = colorValue;
}
else if (IsEnabledD == false)
{
diffuseColor = colorValue;
}
else if (IsEnabledS == false)
{
specularColor = colorValue;
}
else if (IsEnabledE == false)
{
emissionColor = colorValue;
}
}
else
{
eColor = colorValue;
}
}
}
private Color ambientColor;
private Color diffuseColor;
private Color specularColor;
private Color emissionColor;
private Color eColor;
/// <summary>
/// 是否Ambient是否被禁用
/// </summary>
private bool isEnabledA = false;
public bool IsEnabledA
{
get { return isEnabledA; }
set
{
isEnabledA = value;
this.RaisePropertyChanged(nameof(IsEnabledA));
if(isEnabledA==false)
{
ColorValue = ambientColor;
}
}
}
/// <summary>
/// Diffuse 是否禁用
/// </summary>
private bool isEnabledD = true;
public bool IsEnabledD
{
get { return isEnabledD; }
set
{
isEnabledD = value;
this.RaisePropertyChanged(nameof(IsEnabledD));
if(IsEnabledD==false)
{
ColorValue = diffuseColor;
}
}
}
/// <summary>
/// Specular 是否被禁用
/// </summary>
private bool isEnabledS = true;
public bool IsEnabledS
{
get { return isEnabledS; }
set
{
isEnabledS = value;
this.RaisePropertyChanged(nameof(IsEnabledS));
if(IsEnabledS==false)
{
ColorValue = specularColor;
}
}
}
/// <summary>
/// Emission 是否被禁用
/// </summary>
private bool isEnabledE = true;
public bool IsEnabledE
{
get { return isEnabledE; }
set
{
isEnabledE = value;
this.RaisePropertyChanged(nameof(IsEnabledE));
if(isEnabledE==false)
{
ColorValue = emissionColor;
}
}
}
/// <summary>
/// E 是否禁用
/// </summary>
private bool isEnabledAll = true;
public bool IsEnabledAll
{
get { return isEnabledAll; }
set
{
isEnabledAll = value;
this.RaisePropertyChanged(nameof(IsEnabledAll));
if(isEnabledAll)
{
BtnGroupEnable = true;
if (IsEnabledA == false)
{
ColorValue = ambientColor;
}
else if (IsEnabledD == false)
{
ColorValue = diffuseColor;
}
else if (IsEnabledS == false)
{
ColorValue = specularColor;
}
else if (IsEnabledE == false)
{
ColorValue = emissionColor;
}
else if (IsEnabledAll == false)
{
ColorValue = eColor;
}
}
else
{
BtnGroupEnable = false;
ColorValue = eColor;
}
}
}
/// <summary>
/// BtnGroupEnable 是否禁用-
///
/// </summary>
private bool btnGroupEnable=true;
public bool BtnGroupEnable
{
get { return btnGroupEnable; }
set
{
btnGroupEnable = value;
this.RaisePropertyChanged(nameof(BtnGroupEnable));
}
}
/// <summary>
/// shininess类型
/// </summary>
private double shininess;
public double Shininess
{
get { return shininess; }
set
{
shininess = value;
this.RaisePropertyChanged(nameof(Shininess));
}
}
/// <summary>
/// alpha类型
/// </summary>
private double alpha;
public double Alpha
{
get { return alpha; }
set
{
alpha = value;
this.RaisePropertyChanged(nameof(Alpha));
}
}
/// <summary>
/// AmbCommand 方法
/// </summary>
public VCommand AmbCommand { get; set; }
private void AmbCmd()
{
IsEnabledA = false;
IsEnabledD = true;
IsEnabledS = true;
IsEnabledE = true;
}
/// <summary>
/// DiffCommand
/// </summary>
public VCommand DiffCommand { get; set; }
private void DiffCmd()
{
IsEnabledA = true;
IsEnabledD = false;
IsEnabledS = true;
IsEnabledE = true;
}
/// <summary>
/// SpecCommand 方法
/// </summary>
public VCommand SpecCommand { get; set; }
private void SpecCmd()
{
IsEnabledA = true;
IsEnabledD = true;
IsEnabledS = false;
IsEnabledE = true;
}
/// <summary>
/// EmisCommand 方法
/// </summary>
public VCommand EmisCommand { get; set; }
private void EmisCmd()
{
IsEnabledA = true;
IsEnabledD = true;
IsEnabledS = true;
IsEnabledE = false;
}
///// <summary>
///// EnableCommand 方法
///// </summary>
//public VCommand EnableCommand { get; set; }
//private void EnableCmd()
//{
// if (IsEnabledAll)
// {
// BtnGroupEnable = false;
// IsEnabledAll = true;
// }
// else
// {
// BtnGroupEnable = true;
// IsEnabledAll = false;
// }
//}
}
}
......@@ -141,6 +141,14 @@ namespace VIZ.Package.Module
ViewType = typeof(ClockEditPanel),
ViewCreated=this.OnViewCreated
}) ;
// 颜色类型
this.navigationConfigs.Add(new NavigationConfig
{
Key=VizControlFieldType.color.ToString(),
ViewType=typeof(ColorEditPanel),
ViewCreated=this.OnViewCreated
});
}
// =============================================================
......
......@@ -97,6 +97,10 @@
<DependentUpon>ClockEditPanel.xaml</DependentUpon>
</Compile>
<Compile Include="ControlObject\FieldEdit\Edit\ClockEdit\ClockEditPanelModel.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ColorEdit\ColorEditPanel.xaml.cs">
<DependentUpon>ColorEditPanel.xaml</DependentUpon>
</Compile>
<Compile Include="ControlObject\FieldEdit\Edit\ColorEdit\ColorEditPanelModel.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\RadioEdit\RadioEditPanel.xaml.cs">
<DependentUpon>RadioEditPanel.xaml</DependentUpon>
</Compile>
......@@ -450,6 +454,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ControlObject\FieldEdit\Edit\ColorEdit\ColorEditPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ControlObject\FieldEdit\Edit\RadioEdit\RadioEditPanel.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......
......@@ -597,6 +597,9 @@ namespace VIZ.Package.Service
if (type == "clock")
return VizControlFieldType.clock;
if (type == "color")
return VizControlFieldType.color;
return VizControlFieldType.none;
}
......
......@@ -107,6 +107,14 @@ namespace VIZ.Package.Storage
/// 时钟
/// </summary>
[Description("时钟")]
clock
clock,
/// <summary>
/// 颜色
/// </summary>
[Description("颜色")]
color
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment