Example #1
0
        /// <summary>
        /// Sets up all windows of the application, showing the match
        /// information window on the secondary screen, if possible.
        /// </summary>
        private void SetupForms()
        {
            // maximize main form
            mainForm             = new MainForm(this);
            mainForm.WindowState = FormWindowState.Maximized;

            // create new match form
            matchForm = new MatchForm();

            // move match form to secondary screen, if possible
            if (Screen.AllScreens.Length > 1)
            {
                foreach (Screen screen in Screen.AllScreens)
                {
                    if (!screen.Primary)
                    {
                        matchForm.StartPosition = FormStartPosition.Manual;
                        matchForm.Location      = screen.WorkingArea.Location;
                        break;
                    }
                }
            }

            // maximize and show match form
            matchForm.WindowState = FormWindowState.Maximized;
            matchForm.Show();
        }
        public void LogoIsDisplay()
        {
            HomeForm home = new HomeForm();

            Assert.AreEqual("2018 FIFA World Cup Russia™".ToLower(), home.Header.GetTitleText.ToLower());
            home.GoToPlayersForm();

            PlayersForm players = new PlayersForm();

            players.WaitForLoadingPage();
            Assert.IsTrue(players.IsFormTitleDisplay);

            PlayerBrowserSearchByPositionForm playerBrowser = players.SelectPlayer();

            playerBrowser.WaitForLoadingPage();
            Assert.IsTrue(playerBrowser.IsFormTitleDisplay);

            PlayerForm player = playerBrowser.GetInfo(new Random().Next(NUMBER_All_PLAYERS));

            player.WaitForLoadingPage();
            Assert.IsTrue(player.IsFormTitleDisplay);
            MatchSummaryForm matchSummary = player.SelectMatch(new Random().Next(NUMBER_OF_MATCHES));

            Assert.IsTrue(matchSummary.IsFormTitleDisplay);

            MatchForm match = matchSummary.GoToMatchForm();

            match.WaitForLoadingPage();
            Assert.IsTrue(match.IsFormTitleDisplay);
            Assert.IsTrue(match.IsLogoPresented);
        }
Example #3
0
        public JsonResult GetNewMatchInfo(int page, int limit)
        {
            //实例化一个能够序列化数据的类
            JavaScriptSerializer js = new JavaScriptSerializer();
            var start = 0;
            var end   = 30;

            for (var i = 1; i < page; i++)
            {
                start = +30;
                end   = +30;
            }

            var            Url     = "https://api.maxjia.com/api/bets/get_all_category/3/?&offset=" + start + "&limit=" + end + "&bet_type=all&max_id=8789444&game_type=dota2&imei=356156077945624&os_type=Android&os_version=7.0&version=4.2.1&lang=zh-cn";
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);

            request.Method    = "GET";
            request.Referer   = " http://api.maxjia.com/";
            request.UserAgent = " Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36 ApiMaxJia/1.0";
            request.Headers.Add("Cookie: phone_num=0006070300040101040800;pkey=MTUyMTkwOTU4My43MTE3NjIxNTAwNTkxXzFhbWhzZXp1Z2RwY3lybG93;maxid=8789444; Connection: Keep - Alive  Accept - Encoding: gzip");
            request.Host = "api.maxjia.com";



            HttpWebResponse response         = (HttpWebResponse)request.GetResponse();
            Stream          myResponseStream = response.GetResponseStream();
            StreamReader    myStreamReader   = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
            string          retString        = myStreamReader.ReadToEnd();

            myStreamReader.Close();
            myResponseStream.Close();
            List <MatchForm> list = new List <MatchForm>();
            var ifno = js.Deserialize <MatchList>(retString);

            ifno.Result.ForEach(p => {
                MatchForm form = new MatchForm()
                {
                    Name    = p.team1_info.tag + " VS " + p.team2_info.tag + "【" + p.title + "】",
                    Status  = p.progress_desc,
                    Player1 = p.team1_info.tag,
                    Player2 = p.team2_info.tag
                };
                long jsTimeStamp          = Convert.ToInt64(p.end_bid_time);
                System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区
                form.OffTime = startTime.AddMilliseconds(jsTimeStamp * 1000);

                list.Add(form);
            });
            GridData <MatchForm> r = new GridData <MatchForm>();

            r.count = list.Count();
            r.data  = list;
            //var result= JsonConvert.SerializeObject(ifno.Result);

            return(Json(r, JsonRequestBehavior.AllowGet));
        }
Example #4
0
 private void tsLayout_Click(object sender, EventArgs e)
 {
     Utility.Save("FORM", "LOCATION", $"{ Location.X},{ Location.Y},{Width},{Height}");
     dockPanel1.SaveAsXml(m_DockLayoutFile);
     OrderForm.SaveLayout();
     MatchForm.SaveLayout();
     ErrForm.SaveLayout();
     CancelForm.SaveLayout();
     SummaryForm.SaveLayout();
     PositionForm.SaveLayout();
     AlertBox.AlertWithoutReply(this, AlertBoxButton.Msg_OK, "版面儲存", "儲存完成!");
 }
Example #5
0
        private void tsOrder_Click(object sender, EventArgs e)
        {
            switch ((sender as ToolStripMenuItem).Name)
            {
            case "tsOrder":
                if (!OrderForm.Created)
                {
                    OrderForm.Show(dockPanel1, DockState.Document);
                }
                OrderForm.Activate();
                break;

            case "tsCancel":
                if (!CancelForm.Created)
                {
                    CancelForm.Show(dockPanel1, DockState.Document);
                }
                CancelForm.Activate();
                break;

            case "tsMatch":
                if (!MatchForm.Created)
                {
                    MatchForm.Show(dockPanel1, DockState.Document);
                }
                MatchForm.Activate();
                break;

            case "tsError":
                if (!ErrForm.Created)
                {
                    ErrForm.Show(dockPanel1, DockState.Document);
                }
                ErrForm.Activate();
                break;

            case "tsSummary":
                if (!SummaryForm.Created)
                {
                    SummaryForm.Show(dockPanel1, DockState.Document);
                }
                SummaryForm.Activate();
                break;

            case "tsPosition":
                if (!PositionForm.Created)
                {
                    PositionForm.Show(dockPanel1, DockState.Document);
                }
                PositionForm.Activate();
                break;
            }
        }
Example #6
0
        private void tsReloadLayout_Click(object sender, EventArgs e)
        {
            if (File.Exists(m_DockLayoutFile))
            {
                File.Delete(m_DockLayoutFile);
            }
            LoadLayout();

            OrderForm.ResetLayout();
            MatchForm.ResetLayout();
            ErrForm.ResetLayout();
            CancelForm.ResetLayout();
            SummaryForm.ResetLayout();
            PositionForm.ResetLayout();
        }
Example #7
0
 public void OnMatchBattle(object sender, MatchForm match)
 {
     if (match != null)
     {
         Invoke(() =>
         {
             PageParameterDispatcher.Instance().SetPageParameter(new WaitingPageParameter
             {
                 MatchForm = match
             });
             NextPage("WaitingPage");
         });
     }
     else
     {
         ErrorMessage = "";
     }
 }
Example #8
0
        public void StatisticsOfTheMatchPresented()
        {
            HomeForm homeForm = new HomeForm();

            Assert.IsTrue(homeForm.IsHomeFormTitleDisplayed);

            MatchesForm matchesForm = homeForm.GoToMatchesForm();

            Assert.IsTrue(matchesForm.IsMatchesPresented);

            const int countOfMatches = 16;
            MatchForm matchForm      = matchesForm.OpenRandomMatch(new Random().Next(countOfMatches));

            Assert.IsTrue(matchForm.IsScorePresented);
            Assert.IsTrue(matchForm.IsLocationPresented);
            Assert.IsTrue(matchForm.IsDatePresented);
            Assert.IsTrue(matchForm.IsTeamsPresented);

            MatchStatisticsForm matchStatisticsForm = matchForm.GoToMatchStatistics();

            Assert.IsTrue(matchStatisticsForm.IsStatisticsPresented);
        }
 public void ManOfTheMatch()
 {
     try
     {
         HomeForm home = new HomeForm();
         Assert.AreEqual("2018 FIFA World Cup Russia™".ToLower(), home.Header.GetTitleText.ToLower());
         home.Header.GoToSection("teams");
         TeamsForm teams = new TeamsForm();
         Assert.AreEqual(32, teams.TeamsNumber);
         Assert.AreEqual("Teams".ToLower(), teams.Title.ToLower());
         TeamForm  selectedTeam = teams.GoToTeam((new Random()).Next(teams.TeamsNumber - 1));
         MatchForm match        = selectedTeam.GoToMatch((new Random()).Next(selectedTeam.Matches.Count - 1));
         match.GoToManOfTheMatchPage();
         Assert.IsTrue(match.ManOfTheMatch.Displayed);
     }
     catch
     {
         ScreenshotTaker screenshotmaker = new ScreenshotTaker();
         screenshotmaker.MakeScreen();
         screenshotmaker.PrintScreenshotsTo();
     }
 }
Example #10
0
        private void btn_createMatch_Click(object sender, EventArgs e)
        {
            MatchForm matchForm = new MatchForm();

            matchForm.ShowDialog();
        }
Example #11
0
        /// <summary>
        ///     Constructor that sets our reference to the View
        /// </summary>
        /// <param name="matchForm"></param>
        public GameController(MatchForm matchForm)
        {
            MatchForm = matchForm;

            InitializeComponent();
        }
Example #12
0
        public ActionResult RegisterMatches(int id)
        {
            MatchForm form = new MatchForm(id);

            return(PartialView(form));
        }
Example #13
0
 public void OnMatchBattle(object sender, MatchForm other)
 {
 }
Example #14
0
        /// <summary>
        /// 載入視窗設定
        /// </summary>
        private void LoadLayout()
        {
            int[] bounds = Array.ConvertAll(Utility.Load <string>("FORM", "LOCATION").Split(','), (input) =>
            {
                int re = default(int);
                int.TryParse(input, out re);
                return(re);
            });
            if (!File.Exists(m_DockLayoutFile))
            {
                SettingForm.Show(dockPanel1, DockState.DockRight);
                OrderSettingForm.Show(SettingForm.Pane, SettingForm);
                LogForm.Show(dockPanel1, DockState.DockBottomAutoHide);

                frmTick tick = Core.Instance.CreateTickForm(string.Empty);
                if (tick != null)
                {
                    tick.Show(dockPanel1);
                }
                OrderForm.Show(tick.Pane, DockAlignment.Right, 0.6);
                MatchForm.Show(OrderForm.Pane, DockAlignment.Bottom, 0.5);
            }
            else
            {
                dockPanel1.LoadFromXml(m_DockLayoutFile, delegate(string persistString)
                {
                    if (persistString == typeof(frmSetting).ToString())
                    {
                        return(SettingForm);
                    }
                    if (persistString == typeof(frmLog).ToString())
                    {
                        return(LogForm);
                    }
                    if (persistString == typeof(frmOrder).ToString())
                    {
                        return(OrderForm);
                    }
                    if (persistString == typeof(frmSummary).ToString())
                    {
                        return(SummaryForm);
                    }
                    if (persistString == typeof(frmMatch).ToString())
                    {
                        return(MatchForm);
                    }
                    if (persistString == typeof(frmErr).ToString())
                    {
                        return(ErrForm);
                    }
                    if (persistString == typeof(frmCancel).ToString())
                    {
                        return(CancelForm);
                    }
                    if (persistString == typeof(frmPosition).ToString())
                    {
                        return(PositionForm);
                    }
                    if (persistString == typeof(frmOrderSetting).ToString())
                    {
                        return(OrderSettingForm);
                    }
                    if (persistString == typeof(frmTick).ToString())
                    {
                        return(Core.Instance.CreateTickForm(string.Empty));
                    }
                    return(null);
                });
            }
            if (bounds.Length == 4)
            {
                SetBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
            }
        }