Browse Source

注册提醒页面关闭倒计时

master
sc 2 years ago
parent
commit
eab45768e4
  1. 1
      MainWindow.xaml
  2. 35
      ViewModel/MainWindowViewModel.cs

1
MainWindow.xaml

@ -221,6 +221,7 @@
<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"/>
<TextBlock Height="50" Margin="0,0,0,0" TextWrapping="Wrap" Text="{Binding Cdk_pageT}" Width="500" FontSize="34" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
</Grid>
</Grid>

35
ViewModel/MainWindowViewModel.cs

@ -53,6 +53,8 @@ namespace formula_manage.ViewModel
public string sys_Time; //显示系统时间
public string cdk_time; //注册到期时间
public string cdk_page = "Hidden"; //注册到期页面状态
public string cdk_pageT; //注册到期页面关闭时间
int cdk_pageT_T;////注册到期页面关闭时间计算
public string Sys_Time //通知UI控件参数改变
{
@ -70,6 +72,11 @@ namespace formula_manage.ViewModel
get { return cdk_page; }
set { cdk_page = value; OnPropertyChanged("Cdk_page"); }
}
public string Cdk_pageT //通知UI控件参数改变
{
get { return cdk_pageT; }
set { cdk_pageT = value; OnPropertyChanged("Cdk_pageT"); }
}
string TEXT_SQLIP;
string TEXT_SQLNAME;
@ -95,21 +102,24 @@ namespace formula_manage.ViewModel
string MM = DateTime.Now.ToString("MM");
string DD = DateTime.Now.ToString("dd");
cdk_time = "Expires time: " + Y +"/"+ M +"/"+ D+ "Hidden";
Cdk_time = "Expires time: " + Y +"/"+ M +"/"+ D;
if (string.Compare(Y, YY) < 0)
{
cdk_page = "Visible";
}
else if (string.Compare(M, MM) < 0)
if (string.Compare(M, MM) < 0)
{
cdk_page = "Visible";
if (string.Compare(D, DD) < 0)
{
Cdk_page = "Visible";
cdk_pageT_T = -1; //防止触发倒计时
}
else if (string.Compare(D, DD) < 0)
else if (string.Compare(D, DD) < 3)
{
cdk_page = "Visible";
Cdk_page = "Visible";
cdk_pageT_T = 30; //页面关闭倒计时30秒
}
}
}
}
}
@ -252,11 +262,18 @@ namespace formula_manage.ViewModel
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件
{
Sys_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
if (cdk_pageT_T > 0) //提示注册画面关闭倒计时
{
cdk_pageT_T--;
Cdk_pageT = cdk_pageT_T.ToString();
if(cdk_pageT_T == 1) Cdk_page = "Hidden";
}
}
void Tick_Event_1h(object sender, EventArgs e)//Tick_Event周期执行事件
{
CDkey_();
}
}

Loading…
Cancel
Save