コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();
            this.s = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
            string we = System.IO.Path.Combine(s, @"ProgramData\FreeRooms");

            System.IO.Directory.CreateDirectory(we);
            DateTime dateBegin = new DateTime(1, 1, 1);

            if (File.Exists(System.IO.Path.Combine(s, @"ProgramData\FreeRooms", @"" + "1" + ".txt")))
            {
                dateBegin = File.GetLastWriteTime(System.IO.Path.Combine(s, @"ProgramData\FreeRooms", @"" + "1" + ".txt"));
            }
            DateTime dateEnd = dateBegin.AddDays(14);
            DateTime today   = DateTime.Now;

            if (today >= dateBegin && today < dateEnd)
            {
                showdialogwithchoisdate();
                if ((time == "") || (week == "") || (dayofweek == ""))
                {
                    Close();
                }
                otbordata();
            }
            else
            {
                Window2 dff = new Window2();
                dff.ShowDialog();
                if (dff.zakrit == 1)
                {
                    showdialogwithchoisdate();
                    if ((time == "") || (week == "") || (dayofweek == ""))
                    {
                        Close();
                    }
                    otbordata();
                }
                else
                {
                    _1flor.Text       = "Базы данных не были обновлены!";
                    _1flor.Foreground = Brushes.Red;
                }
            }
        }
コード例 #2
0
 public MainWindow()
 {
     InitializeComponent();
     this.s = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
     string we = System.IO.Path.Combine(s, @"ProgramData\FreeRooms");
     System.IO.Directory.CreateDirectory(we);
     DateTime dateBegin = new DateTime(1, 1, 1);
     if (File.Exists(System.IO.Path.Combine(s, @"ProgramData\FreeRooms", @"" + "1" + ".txt")))
         dateBegin = File.GetLastWriteTime(System.IO.Path.Combine(s, @"ProgramData\FreeRooms", @"" + "1" + ".txt"));
     DateTime dateEnd = dateBegin.AddDays(14);
     DateTime today = DateTime.Now;
     if (today >= dateBegin && today < dateEnd)
     {
         showdialogwithchoisdate();
         if ((time == "") || (week == "") || (dayofweek == "")) Close();
         otbordata();
     }
     else 
     {
         Window2 dff = new Window2();
         dff.ShowDialog();
         if (dff.zakrit == 1)
         {
             showdialogwithchoisdate();
             if ((time == "") || (week == "") || (dayofweek == "")) Close();
             otbordata();
         }
         else
         {
             _1flor.Text = "Базы данных не были обновлены!";    
             _1flor.Foreground = Brushes.Red;
         }
         
     }
     
 }