Ejemplo n.º 1
0
 private void img5_MouseDown(object sender, MouseButtonEventArgs e)
 {
     //如果单击使用上次密码解锁选项
     if (last1 == "off")
     {
         //如果last等于off则修改为on
         img5.Source = new BitmapImage(new Uri("/Image/on.png", UriKind.Relative));
         //修改last1全局变量的值为on
         last1 = "on";
         //获得上次解锁用的密码
         MainWindow ma = new MainWindow();
         if (ma.Obtain("password") == null)
         {
             //调用自定义弹窗
             Warning1 warn = new Warning1();
             Warning1.txt = "密码为空!";
             if (warn.ShowDialog() == true)
             {
                 warn.Show();
             }
             //则修改回off
             img5.Source = new BitmapImage(new Uri("/Image/off.png", UriKind.Relative));
             //修改last1回off
             last1 = "off";
         }
     }
     else if (last1 == "on")
     {
         //如果last等于on则修改为off
         img5.Source = new BitmapImage(new Uri("/Image/off.png", UriKind.Relative));
         //修改last1全局变量的值为off
         last1 = "off";
     }
 }
Ejemplo n.º 2
0
 private void img3_MouseDown(object sender, MouseButtonEventArgs e)
 {
     //定时锁屏按键事件
     //如果单击定时锁屏
     if (Timing.timing_lock == false)
     {
         //获得配置文件中的mode和password
         MainWindow ma       = new MainWindow();
         string     mode     = ma.Obtain("mode");
         string     password = ma.Obtain("password");
         //如果timing_lock等于off则修改为on
         img3.Source = new BitmapImage(new Uri("/Image/on.png", UriKind.Relative));
         //判断是否使用功能
         int text1 = Convert.ToInt32(textbox1.Text);
         if (text1 <= 0)
         {
             //如果textbox1等于0,则弹窗提示无法计时
             //调用自定义弹窗
             Warning1 warn = new Warning1();
             Warning1.txt = "定时数值无效!";
             if (warn.ShowDialog() == true)
             {
                 warn.Show();
             }
             //如果timing_lock等于on则修改为off
             img3.Source = new BitmapImage(new Uri("/Image/off.png", UriKind.Relative));
         }
         else if (mode == "1" && password == null)
         {   //如果配置文件的设置,锁屏方式为密码锁屏,并且没有储存的密码,则报错
             //调用自定义弹窗
             Warning1 warn = new Warning1();
             Warning1.txt = "密码为空,无法锁屏!";
             if (warn.ShowDialog() == true)
             {
                 warn.Show();
             }
             //如果timing_lock等于on则修改为off
             img3.Source = new BitmapImage(new Uri("/Image/off.png", UriKind.Relative));
         }
         else
         {
             //修改timing_lock全局变量的值为on
             Timing.timing_lock = true;
             //把锁屏的值传给主函数用于做计时
             int lock_time = Convert.ToInt32(textbox1.Text) * 60;
             Timing.lock_time = lock_time;
         }
     }
     else if (Timing.timing_lock == true)
     {
         //如果timing_lock等于on则修改为off
         img3.Source = new BitmapImage(new Uri("/Image/off.png", UriKind.Relative));
         //修改timing_lock全局变量的值为off
         Timing.timing_lock = false;
     }
 }
Ejemplo n.º 3
0
 private void img1_MouseDown(object sender, MouseButtonEventArgs e)
 {
     //判断两次密码输入的值
     if (passwordbox1.Password == "")
     {
         //调用自定义弹窗
         Warning1 warn = new Warning1();
         Warning1.txt = "请输入密码!";
         if (warn.ShowDialog() == true)
         {
             warn.Show();
         }
         //错误后清空输入框内容
         passwordbox1.Password = null;
         passwordbox2.Password = null;
     }
     else if (passwordbox2.Password == "")
     {
         //调用自定义弹窗
         Warning1 warn = new Warning1();
         Warning1.txt = "请确认密码!";
         if (warn.ShowDialog() == true)
         {
             warn.Show();
         }
         //错误后清空输入框内容
         passwordbox1.Password = null;
         passwordbox2.Password = null;
     }
     else if (passwordbox1.Password != passwordbox2.Password)
     {
         //调用自定义弹窗
         Warning1 warn = new Warning1();
         Warning1.txt = "两次输入密码不一致";
         if (warn.ShowDialog() == true)
         {
             warn.Show();
         }
         //错误后清空输入框内容
         passwordbox1.Password = null;
         passwordbox2.Password = null;
     }
     else
     {
         //把密码传给配置文件
         MainWindow main = new MainWindow();
         main.Modify("password", Pass());
         //打开密码锁屏窗口,关闭当前窗口
         LockScreenKey screen = new LockScreenKey();
         screen.Show();
         this.Close();
     }
 }
Ejemplo n.º 4
0
 private void img4_MouseDown(object sender, MouseButtonEventArgs e)
 {
     //定时关机按键事件
     //如果单击定时关机
     if (Timing.timing_shutdown == false)
     {
         //如果timing_shutdown等于off则修改为on
         img4.Source = new BitmapImage(new Uri("/Image/on.png", UriKind.Relative));
         //判断是否使用功能
         int text2 = Convert.ToInt32(textbox2.Text);
         if (text2 <= 0)
         {
             //如果textbox1等于0,则弹窗提示无法计时
             //调用自定义弹窗
             Warning1 warn = new Warning1();
             Warning1.txt = "定时数值无效!";
             if (warn.ShowDialog() == true)
             {
                 warn.Show();
             }
             //如果timing_shutdown等于on则修改为off
             img4.Source = new BitmapImage(new Uri("/Image/off.png", UriKind.Relative));
         }
         else
         {
             //修改timing_shutdown全局变量的值为on
             Timing.timing_shutdown = true;
             //把锁屏的值传给主函数用于做计时
             int shutdown_time = Convert.ToInt32(textbox2.Text) * 60;
             Timing.shutdown_time = shutdown_time;
         }
     }
     else if (Timing.timing_shutdown == true)
     {
         //如果timing_shutdown等于on则修改为off
         img4.Source = new BitmapImage(new Uri("/Image/off.png", UriKind.Relative));
         //修改timing_shutdown全局变量的值为off
         Timing.timing_shutdown = false;
     }
 }