Start() public method

public Start ( ) : void
return void
示例#1
0
        void RestartButton_Click(object sender, EventArgs e)
        {
            matched      = 0;
            timePassed   = 0;
            NameBox.Text = "";
            StartTimer.Start();
            NameBox.Hide();
            AskName.Hide();
            DisplayVictory.Hide();
            SubmitButton.Hide();

            Deck deck = new Deck();

            PictureBox[] boxes = new PictureBox[] { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8, pictureBox9, pictureBox10, pictureBox11, pictureBox12, pictureBox13, pictureBox14, pictureBox15, pictureBox16 };


            totalCards = boxes.Count();
            foreach (PictureBox pictureBox in boxes)
            {
                Card card = deck.Deal();
                pictureBox.Image = card.CurrentImage;
                pictureBox.Tag   = card;
                pictureBox.Show();
            }
        }
示例#2
0
        private void InitializeControls()
        {
            Commands.NotifyFeatureCommandCollectionExecuting += NotifyFeatureCommandCollectionExecuting;
            Commands.NotifyFeatureCommandCollectionExecuted  += NotifyFeatureCommandCollectionExecuted;
            Commands.NotifyFeatureCommandsCollectionFinish   += NotifyFeatureCommandsCollectionFinish;
            Commands.NotifyFeatureCommandsCollectionStart    += NotifyFeatureCommandsCollectionStart;

            FeaturesProgressBar.Value   = 0;
            FeaturesProgressBar.Maximum = Commands.Count;

            StartTimer.Start();
        }
示例#3
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SupportActionBar.Elevation = 0;
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SetContentView(Resource.Layout.exercise_question);
            WebView            = FindViewById <WebView>(Resource.Id.webView1);
            group              = FindViewById <RadioGroup>(Resource.Id.radio_group);
            NextBtn            = FindViewById <ImageButton>(Resource.Id.btn_floating_action);
            pb                 = FindViewById <ProgressBar>(Resource.Id.pb);
            TimerText          = FindViewById <TextView>(Resource.Id.text_timer);
            TextQuestionNumber = FindViewById <TextView>(Resource.Id.question_number);

            tv = FindViewById <TextView>(Resource.Id.tv);
            // TextQuestion = FindViewById<TextView>(Resource.Id.question);
            ExaminationID  = Intent.GetIntExtra(nameof(ExaminationID), 0);
            CurExamination = await Data.Examination.DB.RowsAsync.FirstOrDefaultAsync(c => c.ID == ExaminationID);

            await CurExamination.LoadCourse();

            await CurExamination.LoadModule();

            //await CurExamination.LoadQuestions();
            var guid = Guid.NewGuid();

            UserExamination = new UserExamination {
                CreationDate = DateTime.Now, UserID = SessionManager.User.ID, StartTime = DateTime.Now, CourseID = CurExamination.CourseID.Value, ModuleID = CurExamination.ModuleID.Value
            };
            UserExamination.ID            = guid;
            UserExamination.ExaminationID = CurExamination.ID;
            Questions = Question.DB.Rows.Where(c => c.ExaminationID == ExaminationID).ToList().Shuffled().ToList();// (List<Question>)CurExamination.Questions.Shuffled();
            Count     = Questions.Count;
            pb.Max    = Count;
            // uptask = new UpdatePB(this, pb, tv, Count);
            // uptask.Execute(100);
            if (Questions.Count > 0)
            {
                Question = Questions.FirstOrDefault();
                SessionManager.CanViewResults = false;
            }
            UserExamination.DB.Insert(UserExamination);
            var answers = Answer.DB.Rows.Where(c => c.QuestionID == Question.ID).ToList().Shuffled().ToList();

            StartExercise(Question, answers, group);
            StartTimer = new StartTimer(this, TimerText)
            {
                StartDate = DateTime.Now,
            };
            StartTimer.Start();
            tv.Text = $"Question {Counter} of {Count}";
            TextQuestionNumber.Text = $"Question number {Counter}";
            pb.Progress             = Counter; // SetProgress(Counter, true);
        }
示例#4
0
 private void startAutoTypeAction(Boolean isClipboardAction)
 {
     this.mIsClipboardAction = isClipboardAction;
     this.Text           = mTitle + ": Delaying " + ((int)DelayStartSecsNum.Value).ToString() + " seconds before typing..";
     mStartTextSend      = false;
     StartTimer.Interval = ((int)DelayStartSecsNum.Value * 1000);
     ProgBar.Maximum     = StartTimer.Interval / ProgTimer.Interval;
     ProgBar.Minimum     = 0;
     ProgBar.Value       = ProgBar.Maximum;
     ProgBar.Refresh();
     StartTimer.Start();
     ProgTimer.Start();
 }
示例#5
0
文件: Form1.cs 项目: cddchen/homework
 private void Form1_Load(object sender, EventArgs e)
 {
     dir = new List <Tuple <int, int> >();
     dir.Add(new Tuple <int, int>(-1, 0));
     dir.Add(new Tuple <int, int>(-1, -1));
     dir.Add(new Tuple <int, int>(0, -1));
     dir.Add(new Tuple <int, int>(1, -1));
     dir.Add(new Tuple <int, int>(1, 0));
     dir.Add(new Tuple <int, int>(1, 1));
     dir.Add(new Tuple <int, int>(0, 1));
     dir.Add(new Tuple <int, int>(-1, 1));
     direction          = Direction.RightTop;
     this.Location      = new Point(519, 315);
     this.TopMost       = true;
     StartTimer.Enabled = true;
     StartTimer.Start();
 }
示例#6
0
        public GameForm()
        {
            InitializeComponent();

            Deck deck = new Deck();

            boxes = new PictureBox[] { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8, pictureBox9, pictureBox10, pictureBox11, pictureBox12, pictureBox13, pictureBox14, pictureBox15, pictureBox16 };
            StartTimer.Start();
            totalCards = boxes.Count();
            NameBox.Hide();
            AskName.Hide();
            DisplayVictory.Hide();
            SubmitButton.Hide();

            foreach (PictureBox pictureBox in boxes)
            {
                Card card = deck.Deal();
                pictureBox.Image = card.CurrentImage;
                pictureBox.Tag   = card;
            }
        }
示例#7
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SupportActionBar.Elevation = 0;
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SetContentView(Resource.Layout.exercise_question);
            WebView            = FindViewById <WebView>(Resource.Id.webView1);
            group              = FindViewById <RadioGroup>(Resource.Id.radio_group);
            NextBtn            = FindViewById <ImageButton>(Resource.Id.btn_floating_action);
            pb                 = FindViewById <ProgressBar>(Resource.Id.pb);
            TimerText          = FindViewById <TextView>(Resource.Id.text_timer);
            TextQuestionNumber = FindViewById <TextView>(Resource.Id.question_number);

            tv        = FindViewById <TextView>(Resource.Id.tv);
            CourseID  = Intent.GetIntExtra(nameof(CourseID), 0);
            CurCourse = await Data.Course.DB.RowsAsync.FirstOrDefaultAsync(c => c.ID == CourseID);

            await CurCourse.LoadExaminations();

            Questions = new List <Question>();
            foreach (var exam in CurCourse.Examinations)
            {
                await exam.LoadQuestions();

                Questions.AddRange(exam.Questions);
            }
            var guid = Guid.NewGuid();

            CurExamination = new Examination
            {
                LocalID           = guid,
                CourseID          = CourseID,
                CreationDate      = DateTime.UtcNow,
                CreatorID         = SessionManager.User.ID,
                Topic             = CurCourse.Name,
                Year              = DateTime.Now.Year,
                StartDate         = DateTime.UtcNow,
                EndDate           = DateTime.UtcNow,
                TypeID            = (int)ExaminationType.EXAMINATION,
                Duration          = 500,
                PaperFormatID     = (int)QuestionPaperFormat.ONE_QESTION_PER_PAGE,
                FlagsID           = (int)ExaminationFlags.PREMIUM_EXAMINATION,
                TargetAudienceID  = (int)ExaminationAudience.EXTENSION_OFFICERS,
                NumberOfQuestions = CurCourse.FinalExamQuestions ?? 25
            };

            UserExamination = new UserExamination {
                CreationDate = DateTime.Now, UserID = SessionManager.User.ID, StartTime = DateTime.Now
            };
            UserExamination.ID          = guid;
            UserExamination.LocalExamID = CurExamination.LocalID;
            Questions = Questions.Shuffled().ToList().Take(CurCourse.FinalExamQuestions ?? 25).ToList().Shuffled().ToList();
            Count     = Questions.Count;
            pb.Max    = Count;
            if (Questions.Count > 0)
            {
                Question = Questions.FirstOrDefault();
            }
            Examination.DB.Insert(CurExamination);
            UserExamination.DB.Insert(UserExamination);
            var answers = Answer.DB.Rows.Where(c => c.QuestionID == Question.ID).ToList().Shuffled().ToList();

            StartExercise(Question, answers, group);
            StartTimer = new StartTimer(this, TimerText)
            {
                StartDate = DateTime.Now,
            };
            StartTimer.Start();
            tv.Text = $"Question {Counter} of {Count}";
            TextQuestionNumber.Text = $"Question number {Counter}";
            pb.Progress             = Counter;// SetProgress(Counter, true);
        }
示例#8
0
        public override void StartGame(Mobile gm)
        {
            base.StartGame(gm);

            m_GameItems = new List<Item>();

            Rectangle2D playerarea = new Rectangle2D(GameAreaStartPoint.X, GameAreaStartPoint.Y,
                                                     GameAreaEndPoint.X - GameAreaStartPoint.X + 1,
                                                     GameAreaEndPoint.Y - GameAreaStartPoint.Y + 1);
            IPooledEnumerable players = Map.GetMobilesInBounds(playerarea);
            foreach (Mobile player in players)
            {
                if (player.AccessLevel == AccessLevel.Player)
                    AddPlayer(player);
            }

            #region Create stones for gamearea
            int startx = m_GameArea.Start.X;
            int starty = m_GameArea.Start.Y;
            int endx = m_GameArea.End.X;
            int endy = m_GameArea.End.Y;

            BombermanStone stone;
            for (int x = 0; x <= endx - startx; ++x)
            {
                for (int y = 0; y <= endy - starty; ++y)
                {
                    if(x != 0 && x != endx - startx && y != 0 && y != endy - starty)
                    {
                        if (x % 2 == 1 && y % 2 == 1)
                        {
                            stone = new BombermanStone(false, this);
                        }
                        else
                        {
                            stone = new BombermanStone(true, this);
                        }
                        stone.MoveToWorld(new Point3D(startx + x, starty + y, Map.Tiles.GetLandTile(startx + x, starty + y).Z), Map);
                        m_GameItems.Add(stone);
                    }
                    else if ((x == 0 || x == endx - startx) && y > 1 && y < endy - starty - 1)
                    {
                        stone = new BombermanStone(true, this);
                        stone.MoveToWorld(new Point3D(startx + x, starty + y, Map.Tiles.GetLandTile(startx + x, starty + y).Z), Map);
                        m_GameItems.Add(stone);
                    }
                    else if ((y == 0 || y == endy - starty) && x > 1 && x < endx - startx - 1)
                    {
                        stone = new BombermanStone(true, this);
                        stone.MoveToWorld(new Point3D(startx + x, starty + y, Map.Tiles.GetLandTile(startx + x, starty + y).Z), Map);
                        m_GameItems.Add(stone);
                    }
                }
            }
            #endregion

            #region Handle players: location, items, etc
            Point2D upleft = m_GameArea.Start;
            Point2D downright = m_GameArea.End;
            Point2D upright = new Point2D(downright.X, upleft.Y);
            Point2D downleft = new Point2D(upleft.X, downright.Y);

            byte index = 0;
            List<Mobile> toRemove = new List<Mobile>();
            foreach (Mobile m in Players)
            {
                switch (index++)
                {
                    case 0:
                        m.Location = new Point3D(upleft, Map.Tiles.GetLandTile(upleft.X, upleft.Y).Z);
                        break;
                    case 1:
                        m.Location = new Point3D(downright, Map.Tiles.GetLandTile(upright.X, upright.Y).Z);
                        break;
                    case 2:
                        m.Location = new Point3D(downleft, Map.Tiles.GetLandTile(downleft.X, downleft.Y).Z);
                        break;
                    case 3:
                        m.Location = new Point3D(upright, Map.Tiles.GetLandTile(downright.X, downright.Y).Z);
                        break;
                    default:
                        toRemove.Add(m);
                        PublicOverheadMessage(MessageType.Regular, 906, true, "There are more than 4 mobiles in the game area.");
                        break;
                }
            }

            foreach (Mobile mob in toRemove)
            {
                RemovePlayer(mob);
            }
            #endregion

            StartTimer timer = new StartTimer(this);
            timer.Start();

            gm.SendMessage("The game has been started.");
        }
示例#9
0
        public override void StartGame(Mobile gm)
        {
            base.StartGame(gm);

            m_GameItems = new List <Item>();

            Rectangle2D playerarea = new Rectangle2D(GameAreaStartPoint.X, GameAreaStartPoint.Y,
                                                     GameAreaEndPoint.X - GameAreaStartPoint.X + 1,
                                                     GameAreaEndPoint.Y - GameAreaStartPoint.Y + 1);
            IPooledEnumerable players = Map.GetMobilesInBounds(playerarea);

            foreach (Mobile player in players)
            {
                if (player.AccessLevel == AccessLevel.Player)
                {
                    AddPlayer(player);
                }
            }

            #region Create stones for gamearea
            int startx = m_GameArea.Start.X;
            int starty = m_GameArea.Start.Y;
            int endx   = m_GameArea.End.X;
            int endy   = m_GameArea.End.Y;

            BombermanStone stone;
            for (int x = 0; x <= endx - startx; ++x)
            {
                for (int y = 0; y <= endy - starty; ++y)
                {
                    if (x != 0 && x != endx - startx && y != 0 && y != endy - starty)
                    {
                        if (x % 2 == 1 && y % 2 == 1)
                        {
                            stone = new BombermanStone(false, this);
                        }
                        else
                        {
                            stone = new BombermanStone(true, this);
                        }
                        stone.MoveToWorld(new Point3D(startx + x, starty + y, Map.Tiles.GetLandTile(startx + x, starty + y).Z), Map);
                        m_GameItems.Add(stone);
                    }
                    else if ((x == 0 || x == endx - startx) && y > 1 && y < endy - starty - 1)
                    {
                        stone = new BombermanStone(true, this);
                        stone.MoveToWorld(new Point3D(startx + x, starty + y, Map.Tiles.GetLandTile(startx + x, starty + y).Z), Map);
                        m_GameItems.Add(stone);
                    }
                    else if ((y == 0 || y == endy - starty) && x > 1 && x < endx - startx - 1)
                    {
                        stone = new BombermanStone(true, this);
                        stone.MoveToWorld(new Point3D(startx + x, starty + y, Map.Tiles.GetLandTile(startx + x, starty + y).Z), Map);
                        m_GameItems.Add(stone);
                    }
                }
            }
            #endregion

            #region Handle players: location, items, etc
            Point2D upleft    = m_GameArea.Start;
            Point2D downright = m_GameArea.End;
            Point2D upright   = new Point2D(downright.X, upleft.Y);
            Point2D downleft  = new Point2D(upleft.X, downright.Y);

            byte          index    = 0;
            List <Mobile> toRemove = new List <Mobile>();
            foreach (Mobile m in Players)
            {
                switch (index++)
                {
                case 0:
                    m.Location = new Point3D(upleft, Map.Tiles.GetLandTile(upleft.X, upleft.Y).Z);
                    break;

                case 1:
                    m.Location = new Point3D(downright, Map.Tiles.GetLandTile(upright.X, upright.Y).Z);
                    break;

                case 2:
                    m.Location = new Point3D(downleft, Map.Tiles.GetLandTile(downleft.X, downleft.Y).Z);
                    break;

                case 3:
                    m.Location = new Point3D(upright, Map.Tiles.GetLandTile(downright.X, downright.Y).Z);
                    break;

                default:
                    toRemove.Add(m);
                    PublicOverheadMessage(MessageType.Regular, 906, true, "There are more than 4 mobiles in the game area.");
                    break;
                }
            }

            foreach (Mobile mob in toRemove)
            {
                RemovePlayer(mob);
            }
            #endregion

            StartTimer timer = new StartTimer(this);
            timer.Start();

            gm.SendMessage("The game has been started.");
        }