Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.51 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Navigation;
  13. using System.Windows.Shapes;
  14. using System.IO;
  15. using System.Security;
  16.  
  17. namespace Test2
  18. {
  19.     /// <summary>
  20.     /// Interaction logic for Page1.xaml
  21.     /// </summary>
  22.     public partial class Page1 : Page
  23.     {
  24.         public Page1()
  25.         {
  26.             InitializeComponent();
  27.         }
  28.  
  29.         private void Button_Click(object sender, RoutedEventArgs e)
  30.         {
  31.             //Gets current date and puts it into string.
  32.             string today = DateTime.Now.ToString("yyyy.MM.dd");
  33.             string yesterday = DateTime.Now.AddDays(-1).ToString("yyyy.MM.dd");
  34.  
  35.             TextBoxToday.Text = "" + today;
  36.             TextBoxYesterday.Text = "" + yesterday;
  37.  
  38.             try
  39.             {
  40.                 FileInfo f = new FileInfo("D:\\Client1\\2011.02.14.log");
  41.                 {
  42.                     if (f.Length > 0)
  43.                         ButtonToday.Background = Brushes.Green;
  44.                     else
  45.                         ButtonToday.Background = Brushes.Red;
  46.                 }
  47.             }
  48.             catch (SecurityException ex)
  49.             {
  50.                 MessageBox.Show("" + ex);
  51.             }
  52.              
  53.            
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement