예제 #1
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            Waiter.ExecAsync(ui => {
                ui.Caption = "Connecting to SQL Server...";
                context = new ScheduleContext(DB.Default);
                loader = new CellLoader(context);
                ui.Caption = "Loading data...";
                context.LoadCells(calendar.MonthStart.Last(DayOfWeek.Sunday), calendar.MonthStart.Last(DayOfWeek.Sunday) + 7 * 6);

                BeginInvoke(new Action(delegate {
                    calendar.ContentRenderer = new Controls.SchedulizerCalendarContentRenderer(calendar.CalendarPainter, loader);
                    calendar.Invalidate();

                    UpdateCellPanel();

                    if (IsWordRunning) {
                        HandleWord();
                    } else {
                        wordBinderMenu.BeforePopup += wordBinderMenu_BeforePopup;
                        //TODO: Timer?
                    }
                }));
            }, "Loading", false);
        }