Ejemplo n.º 1
0
        // timer that waits for pages to load their data (usually to recieve it from the server) before displaying the page

        private void LoadPage_Tick(object sender, EventArgs e)
        {
            switch (currentPageID)
            {
            case 1:
                if (GUIlobbyRoom.DoneLoadingData())         // this is initially false and is being checked every second; When page data has been loaded this becomes true
                {
                    loadPage.Stop();                        // stop the check that occures every second once the data was loaded
                    MainFrame.Content = GUIlobbyRoom;       // display the page
                    GUIloading        = null;               // you no longer need the loading GUI page
                }
                else
                {
                    GUIloading.updateMessages(GUIlobbyRoom.getLoadedDataChecklist());     // update the checklist for loaded data
                }
                break;

            case 2:
                if (GUIcollection.DoneLoading())
                {
                    loadPage.Stop();
                    MainFrame.Content = GUIcollection;
                    GUIloading        = null;
                }
                else
                {
                    GUIloading.updateMessages(GUIcollection.getLoadedDataChecklist());
                }
                break;

            case 3:
                if (GUIpreGameRoom.DoneLoading())
                {
                    loadPage.Stop();
                    MainFrame.Content = GUIpreGameRoom;
                    GUIloading        = null;
                }
                else
                {
                    GUIloading.updateMessages(GUIpreGameRoom.getLoadedDataChecklist());
                }
                break;

            case 4:
                if (GUIgameRoom.DoneLoading())
                {
                    loadPage.Stop();
                    MainFrame.Content = GUIgameRoom;
                    GUIloading        = null;
                    GUIgameRoom.startRolling();
                }
                else
                {
                    GUIloading.updateMessages(GUIgameRoom.getLoadedDataChecklist());
                }
                break;

            default: break;
            }
        }