Browse Source

添加注册到期提示页面

master
sc 2 years ago
parent
commit
c17474c77f
  1. 27
      MainWindow.xaml
  2. 31
      ViewModel/MainWindowViewModel.cs

27
MainWindow.xaml

@ -13,7 +13,7 @@
<ViewModel:MainWindowViewModel x:Key="MainWindowViewModel"/>
</Window.Resources>
<Grid>
<Menu IsTabStop="False" Grid.ColumnSpan="2">
<Menu IsTabStop="False" Grid.ColumnSpan="1">
<MenuItem x:Name="tab" Header="_文件" FontSize="16" Focusable ="False" >
<MenuItem Header="_许可证" Click="CDKEY_SET" FontSize="16"/>
<Separator/>
@ -24,7 +24,7 @@
<MenuItem Header="_备份/还原" FontSize="16" Name="_SQLBAK" Click="SQLBAK" IsEnabled="False"/>
<Separator/>
<MenuItem Header="_软件设置" FontSize="16" Name="_SOFTWARE_SET" Click="SOFTWARE_SET" IsEnabled="False"/>
<MenuItem Header="_转换设置" FontSize="16" Name="_EXCHANGE_SET" IsEnabled="False"/>
<MenuItem Header="_转换设置" FontSize="16" Name="_EXCHANGE_SET" IsEnabled="False"/>
<MenuItem Header="_打印设置" FontSize="16" Name="_PRINT_SET" Click="PRINT_SET" IsEnabled="False"/>
<MenuItem Header="_用户设置" FontSize="16" Name="_USER_SET" Click="USER_SET" IsEnabled="False"/>
<MenuItem Header="_登录限制" FontSize="16" Name="_USER_log" IsEnabled="False"/>
@ -189,16 +189,16 @@
</DataGridTemplateColumn>
<DataGridTextColumn Header="计算单位" Width="80" MaxWidth="80" MinWidth="80" CellStyle="{StaticResource CellStyle}" Binding="{Binding SHIFT}"/>
<DataGridTemplateColumn Header="原料名称" Width="200" MaxWidth="400" MinWidth="100" CellStyle="{StaticResource CellStyle}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="CP_PRODUCT_NAME" BorderThickness="0,0,0,0"
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="CP_PRODUCT_NAME" BorderThickness="0,0,0,0"
ItemsSource="{Binding stuff_Product, Source={StaticResource MainWindowViewModel}}"
DisplayMemberPath="ProductName"
Text="{Binding PRODUCT_NAME}"
DropDownClosed="CP_PRODUCT_NAME_DropDownClosed"
BorderBrush="{x:Null}" Background="{x:Null}" IsEditable="True" IsReadOnly="True" Focusable="True" IsTabStop="False"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="目标重量(g)" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" IsReadOnly="True" Binding="{Binding TARGET_WT}" CellStyle="{StaticResource CellStyle}"/>
<DataGridTextColumn Header="单位" Width="80" FontSize="15" MaxWidth="80" MinWidth="80" IsReadOnly="True" Binding="{Binding UNIT}" CellStyle="{StaticResource CellStyle}"/>
@ -215,10 +215,13 @@
<ContentControl x:Name="Deputy"/>
</Grid>
<Viewbox x:Name="cdk_box" Margin="0,0,0,0" Opacity="0.8" Visibility="Hidden">
<Grid Background="#FFA4A4A4" >
<TextBlock Height="40" Margin="0,0,0,0" TextWrapping="Wrap" Text="ReRegistration" Width="180" FontSize="28" HorizontalAlignment="Center" Foreground="Black" VerticalAlignment="Center"/>
</Grid>
</Viewbox>
<Grid Grid.Column="1" Margin="0,0,0,0" Background="White" Opacity="0.8" Visibility="{Binding Cdk_page}">
<TextBlock Height="50" Margin="0,0,0,300" TextWrapping="Wrap" Text="The registration code expires" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Height="50" Margin="0,0,0,200" TextWrapping="Wrap" Text="{Binding Cdk_time}" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Height="50" Margin="0,0,0,100" TextWrapping="Wrap" Text="Contact SUNLIGHT Reactivate" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Button Content="Reactivate" HorizontalAlignment="Center" Height="50" Margin="200,100,0,0" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="#FFDFDFDF" Click="CDKEY_SET"/>
<Button Content="Contact" HorizontalAlignment="Center" Height="50" Margin="0,100,200,0" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="#FFDFDFDF" Click="HELP"/>
</Grid>
</Grid>
</Window>

31
ViewModel/MainWindowViewModel.cs

@ -51,12 +51,26 @@ namespace formula_manage.ViewModel
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
public string sys_Time; //显示系统时间
public string cdk_time; //注册到期时间
public string cdk_page = "Hidden"; //注册到期页面状态
public string Sys_Time //通知UI控件参数改变
{
get { return sys_Time; }
set { sys_Time = value; OnPropertyChanged("Sys_Time"); }
}
public string Cdk_time //通知UI控件参数改变
{
get { return cdk_time; }
set { cdk_time = value; OnPropertyChanged("Cdk_time"); }
}
public string Cdk_page //通知UI控件参数改变
{
get { return cdk_page; }
set { cdk_page = value; OnPropertyChanged("Cdk_page"); }
}
string TEXT_SQLIP;
string TEXT_SQLNAME;
string TEXT_SQMOD;
@ -67,7 +81,7 @@ namespace formula_manage.ViewModel
string SN_KEY;
private void CDkey_()
{
{
string id_1 = SN_ID.Substring(5, 1) + SN_ID.Substring(0, 1) + SN_ID.Substring(4, 1) + SN_ID.Substring(1, 1) + SN_ID.Substring(3, 1) + SN_ID.Substring(2, 1);
if ((id_1 == SN_KEY.Substring(0, 6)) && (SN_KEY.Length == 16))
{
@ -81,21 +95,22 @@ namespace formula_manage.ViewModel
string MM = DateTime.Now.ToString("MM");
string DD = DateTime.Now.ToString("dd");
cdk_time = "Expires time: " + Y +"/"+ M +"/"+ D+ "Hidden";
if (string.Compare(Y, YY) < 0)
{
CDKEY cDKEY = new CDKEY();
cDKEY.ShowDialog();//实例化并置顶打开窗口
cdk_page = "Visible";
}
else if (string.Compare(M, MM) < 0)
{
CDKEY cDKEY = new CDKEY();
cDKEY.ShowDialog();//实例化并置顶打开窗口
cdk_page = "Visible";
}
else if (string.Compare(D, DD) < 0)
{
CDKEY cDKEY = new CDKEY();
cDKEY.ShowDialog();//实例化并置顶打开窗口
cdk_page = "Visible";
}
}
}
}
@ -150,6 +165,8 @@ namespace formula_manage.ViewModel
CountDown();
Sql_();
CDkey_();
stuff_Product = ToObservableCollection<Product>(STUFFdataTable); //stuff_Product表转换
mac_Machine = ToObservableCollection<Machine>(MACHINEdataTable);
flow_Workflow = ToObservableCollection<Workflow>(DissolvedataTable);

Loading…
Cancel
Save