コード例 #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;
            }
        }
コード例 #2
0
        // GAME ROOM

        public void loadGameRoom(int GameRoomID, int DeckID, string OwnNickName, string OppNickName)
        {
            GUIgameRoom = new GUIPages.GUIGameRoom(this, com, GameRoomID, DeckID, OwnNickName, OppNickName, CardCollection);
            List <string> loadedDataChecklistTitles = new List <string>()
            {
                "Setting up initial conditions",
                "Fetching hand",
                "Waiting for opponent"
            };

            GUIloading        = new GUIPages.GUILoading(GUIgameRoom.BackgroundImageSource, loadedDataChecklistTitles, GUIgameRoom.getLoadedDataChecklist());
            MainFrame.Content = GUIloading;
            currentPageID     = 4;
            loadPage.Start();
        }