コード例 #1
0
        public HomePage(MainWindow mWindow)
        {
            InitializeComponent();
            _mWindow = mWindow;

            ReferenseDALClass refClassDAL = new ReferenseDALClass();

            loadedControl = new LoadingAnimation();
            MainSheldueGrid.Children.Add(loadedControl);
            loadedControl.StartAnimation();
            allSheldueList = _mWindow.GetSheldue;
            if (allSheldueList == null)
            {
                userNotes = new List <UserNotes>(refClassDAL.SetConnectionDBSelectAll(_mWindow._userInfo.ID));
                _mWindow.KindThrowMessage.Foreground = FindResource("WarningForegroundColorUIElements") as SolidColorBrush;
                _mWindow.KindThrowMessage.Kind       = MaterialDesignThemes.Wpf.PackIconKind.WarningOutline;
                _mWindow.TextBlockMessageThrow.Text  = "Расписание загружается! Не закрывайте программу!";
                Storyboard sb = _mWindow.FindResource("ShowMessageThrowGrid") as Storyboard;
                sb.Begin();
                _mWindow.IsEnabled = false;
                switch (_mWindow._userInfo.Status)
                {
                case teacher:
                    Task.Run(() => this.Dispatcher.BeginInvoke((ThreadStart) delegate() { LoadSheldueAsyncMethod(false); }));
                    break;

                case student:
                    Task.Run(() => this.Dispatcher.BeginInvoke((ThreadStart) delegate() { LoadSheldueAsyncMethod(true); }));
                    break;
                }
            }
            else
            {
                ListViewSheldueDay.ItemsSource = allSheldueList;
                StopAnimation.Tick            += new EventHandler(StopMethodAnimation);
                StopAnimation.Interval         = new TimeSpan(0, 0, 1);
                StopAnimation.Start();
            }
            DateTime firstDate = GetFirstDateOfWeek(DayOfWeek.Monday);
            var      lastDate  = GetLastDateOfWeek(DayOfWeek.Saturday);

            GetListDateOfWeek(firstDate, lastDate);
            refClassDAL.SetConnectionDBDeleteNote(listDate[0]);
        }