Exemplo n.º 1
0
        public void Redirect(Controls.PlayTypeButton btn)
        {
            if (XuanHaoPanel.Children.Count > 0)
            {
                XuanHaoPanel.Children.Clear();
            }
            Controls.TouZhuCtrl touzhu = new Controls.TouZhuCtrl();
            MainPage.TouzhuControl = touzhu;
            MainPage.playType = Convert.ToInt32(btn.Tag);
            DockPanel dockPanel = new DockPanel();
            dockPanel.LastChildFill = true;
            dockPanel.Width = 658;

            Grid grid = new Grid();
            grid.RowDefinitions.Insert(0, new RowDefinition() { Height = new GridLength() });
            grid.RowDefinitions.Insert(1, new RowDefinition() { Height = new GridLength(25) });

            Controls.NumPanel numPanel = new Controls.NumPanel();
            Controls.RadioButtonPanel rbPanel = new Controls.RadioButtonPanel();
            grid.Children.Add(numPanel);
            grid.Children.Add(rbPanel);
            numPanel.SetValue(Grid.RowProperty, 0);
            rbPanel.SetValue(Grid.RowProperty, 1);

            //Controls.TouZhuCtrl touzhu = new Controls.TouZhuCtrl();
            touzhu.lotteryType = LotteryType.SSC;
            touzhu.PlayType = Convert.ToInt32(btn.Tag);
            touzhu.numPanel = numPanel;
            touzhu.rbPanel = rbPanel;
            touzhu.PlayTypeName = btn.Text ;
            //添加按钮
            touzhu.btnAdd.Click  +=  (s, e) =>
                {
                   string num= numPanel.GetChoosedNum((SSCPlayType)btn.Tag);
                   if (num.Length == 0)
                   {
                       Messager.Show("号码不完整,无法添加");
                       return;
                   }
                   if(num.StartsWith("@"))
                   {
                       Messager.Show(num.Replace("@",""));
                       return;
                   }
                   string[] nums=num.Split(' ');
                   foreach (string n in nums)
                   {
                       touzhu.NumBasket.Items.Add(n);
                       ListBoxItem item = (ListBoxItem)(touzhu.NumBasket.ItemContainerGenerator.ContainerFromItem(
                           touzhu.NumBasket.Items[touzhu.NumBasket.Items.Count - 1]));
                       switch ((PlayType)btn.Tag)
                       {
                           case PlayType._3xZhix:
                               item.Width = 280;
                               break;
                           case PlayType._3xZux:
                               item.Width = 100;
                               break;
                           case PlayType._2xZhix:
                               item.Width = 185;
                               break;
                           case PlayType._2xZux:
                               item.Width = 100;
                               break;
                           case PlayType._H1Zhix:
                               item.Width = 95;
                               break;
                           case PlayType._Bddw:
                               item.Width = 95;
                               break;
                           case PlayType._Ddw:
                               item.Width = 455;
                               break;
                       }
                       if (numPanel.isWriten)
                           item.Width = 60;
                   }
                   numPanel.ClearAllNums();
                   touzhu.lbBetCount.Text = BetCountCalc.GetBetCount
                       (touzhu.NumBasket,(PlayType)btn.Tag, numPanel.isWriten,
                        ((PlayTypeRadio)Convert.ToInt32(rbPanel.GetChoosedRadioButton().Tag.ToString())).ToString()
                       ).ToString();
                };

            DockPanel.SetDock(grid, Dock.Top);
            dockPanel.Children.Add(grid);
            DockPanel.SetDock(touzhu, Dock.Top);
            dockPanel.Children.Add(touzhu);
            XuanHaoPanel.Children.Add(dockPanel);
            #region drop
            //switch ((PlayType)btn.Tag)
            //{
            //    case PlayType._3xZhix:
            //        numPanel.Text = "百位,十位,个位";
            //        rbPanel.Text = "后三直选复式,后三直选单式,前三直选复式,前三直选单式";
            //        break;
            //    case PlayType._3xZux:
            //        numPanel.Text = "组选";
            //        rbPanel.Text = "后三组选组六,后三组选组三,后三组选混合,前三组选组六,前三组选组三,前三组选混合";
            //        break;
            //    case PlayType._2xZhix:
            //        numPanel.Text = "十位,个位";
            //        rbPanel.Text = "后二直选复式,后二直选单式,前二直选复式,前二直选单式";
            //        break;
            //    case PlayType._2xZux:
            //        numPanel.Text = "组选";
            //        rbPanel.Text = "后二组选组二,后二组选混合,前二组选组二,前二组选混合";
            //        break;
            //    case PlayType._H1Zhix:
            //        numPanel.Text = "个位";
            //        rbPanel.Text = "后一直选复式";
            //        break;
            //    case PlayType._Bddw:
            //        numPanel.Text = "不定位";
            //        rbPanel.Text = "后三不定位胆,前三不定位胆,五星不定位胆";
            //        break;
            //    case PlayType._Ddw:
            //        numPanel.Text = "万位,千位,百位,十位,个位";
            //        rbPanel.Text = "五星定位胆";
            //        break;
            //}
            #endregion
            List<PlayTypeRadioInfo> list_radio = App.Session[Constant.PLAYTYPERADIO_SESSION] as List<PlayTypeRadioInfo>;
            list_radio = (from l in list_radio where l.PlayTypeID1 == (int)((PlayType)btn.Tag) select l).ToList();
            List<PlayTypeNumInfo> list_num = App.Session[Constant.PLAYTYPENUM_SESSION] as List<PlayTypeNumInfo>;
            list_num = (from l in list_num where l.PlayTypeID1 == (int)((PlayType)btn.Tag) select l).ToList();
            string numPanelText = string.Empty;
            string rbPanelText = string.Empty;
            string rbPanelValue = string.Empty;
            foreach (PlayTypeRadioInfo p in list_radio)
            {
                if (p == list_radio.First())
                    MainPage.playTypeRadio = Convert.ToInt32(p.PlayTypeRadioID);
                rbPanelText += p.PlayTypeRadioName;
                rbPanelValue += p.PlayTypeRadioID.ToString();
                if (p != list_radio.Last())
                {
                    rbPanelValue += ",";
                    rbPanelText += ",";
                }
            }
            foreach (PlayTypeNumInfo p in list_num)
            {
                numPanelText += p.PlayTypeNumName;
                if (p != list_num.Last())
                    numPanelText += ",";
            }
            numPanel.Text = numPanelText;
            rbPanel.Text = rbPanelText;
            rbPanel.Value = rbPanelValue;
            rbPanel.CreateElement();
            numPanel.CreateElement();
            foreach (RadioButton rb in rbPanel.PlayTypePanel.Children)
            {
                rb.Checked += (s, er) =>
                {
                    touzhu.NumBasket.Items.Clear();
                    numPanel.ClearChild();
                    RadioButton radioButton = (RadioButton)s;
                    string rbValue = ((PlayTypeRadio)Convert.ToInt32(radioButton.Tag.ToString())).ToString();
                    if (rbValue.IndexOf("单式") > -1
                        || rbValue.IndexOf("混合") > -1)
                    {
                        numPanel.isWriten = true;
                    }
                    else
                        numPanel.isWriten = false;
                    numPanel.isCreated = false;
                    numPanel.CreateElement();
                };
            }
        }
Exemplo n.º 2
0
        public void Redirect(Controls.PlayTypeButton btn)
        {
            playtype = (int)((PlayType)btn.Tag);
            MainPage.playType = Convert.ToInt32(btn.Tag);
            this.gridPanel.Children.Clear();
            Controls.RateGrid rateGrid = new Controls.RateGrid(0, 10);
            this.gridPanel.Children.Add(rateGrid);
            if (XuanHaoPanel.Children.Count > 0)
            {
                XuanHaoPanel.Children.Clear();
            }

            Controls.TouZhuCtrl touzhu = new Controls.TouZhuCtrl();
            MainPage.TouzhuControl = touzhu;

            DockPanel dockPanel = new DockPanel();
            dockPanel.LastChildFill = true;
            dockPanel.Width = 658;

            Grid grid = new Grid();
            grid.RowDefinitions.Insert(0, new RowDefinition() { Height = new GridLength() });
            grid.RowDefinitions.Insert(1, new RowDefinition() { Height = new GridLength(25) });

            Controls.NumPanel numPanel = new Controls.NumPanel();
            Controls.RadioButtonPanel rbPanel = new Controls.RadioButtonPanel();
            grid.Children.Add(numPanel);
            grid.Children.Add(rbPanel);
            numPanel.SetValue(Grid.RowProperty, 0);
            rbPanel.SetValue(Grid.RowProperty, 1);

            //Controls.TouZhuCtrl touzhu = new Controls.TouZhuCtrl();
            //TouzhuControl = touzhu;
            touzhu.isShow = false;
            touzhu.PlayType = Convert.ToInt32(btn.Tag);
            touzhu.numPanel = numPanel;
            touzhu.rbPanel = rbPanel;
            touzhu.PlayTypeName = btn.Text;
            touzhu.lotteryType = LotteryType.N3D;
            DockPanel.SetDock(grid, Dock.Top);
            dockPanel.Children.Add(grid);
            DockPanel.SetDock(touzhu, Dock.Top);
            dockPanel.Children.Add(touzhu);
            XuanHaoPanel.Children.Add(dockPanel);

            List<PlayTypeRadioInfo> list_radio = App.Session[Constant.PLAYTYPERADIO_SESSION] as List<PlayTypeRadioInfo>;
            list_radio = (from l in list_radio where l.PlayTypeID1 == (int)((PlayType)btn.Tag) select l).ToList();
            List<PlayTypeNumInfo> list_num = App.Session[Constant.PLAYTYPENUM_SESSION] as List<PlayTypeNumInfo>;
            list_num = (from l in list_num where l.PlayTypeID1 == (int)((PlayType)btn.Tag) select l).ToList();
            string numPanelText = string.Empty;
            string rbPanelText = string.Empty;
            string rbPanelValue = string.Empty;
            foreach (PlayTypeRadioInfo p in list_radio)
            {
                if (p == list_radio.First())
                    MainPage.playTypeRadio = Convert.ToInt32(p.PlayTypeRadioID);
                rbPanelText += p.PlayTypeRadioName;
                rbPanelValue += p.PlayTypeRadioID.ToString();
                if (p != list_radio.Last())
                {
                    rbPanelValue += ",";
                    rbPanelText += ",";
                }
            }
            foreach (PlayTypeNumInfo p in list_num)
            {
                numPanelText += p.PlayTypeNumName;
                if (p != list_num.Last())
                    numPanelText += ",";
            }
            numPanel.Text = numPanelText;
            rbPanel.Text = rbPanelText;
            rbPanel.Value = rbPanelValue;
            rbPanel.CreateElement();
            numPanel.CreateElement();
            foreach (RadioButton rbtn in rbPanel.PlayTypePanel.Children)
            {
                rbtn.Checked += (s, e) =>
                {
                    RadioButton rb = s as RadioButton;
                    if (rb.IsChecked == false)
                        return;
                    playTypeRadioId = Convert.ToInt32(rb.Tag);
                    MainPage.playType = playtype;
                    MainPage.playTypeRadio = playTypeRadioId;
                    srv.GetCurrenIssuNoAsync((int)LotteryType._3D);
                };
            }
            //选择号码时改变号码个数===========
            List<Controls.NumButton> listNumButton=numPanel.GetNumButton();
            List<Button> listCmdButton = numPanel.GetCmdButton();
            foreach (Controls.NumButton nb in listNumButton)
            {
                nb.MouseLeftButtonDown += (s, e) =>
                    {
                        string num = numPanel.GetChoosedNum();
                        touzhu.lbBetCount.Text = num.Length.ToString();
                    };
            }
            foreach (Button nb in listCmdButton)
            {
                nb.Click += (s, e) =>
                {
                    string num = numPanel.GetChoosedNum();
                    touzhu.lbBetCount.Text = num.Length.ToString();
                };
            }
            //-===============
            foreach (RadioButton rb in rbPanel.PlayTypePanel.Children)
            {
                rb.Checked += (s, er) =>
                {
                    touzhu.NumBasket.Items.Clear();
                    touzhu.lbBetCount.Text = "0";
                    numPanel.ClearChild();
                    numPanel.isWriten = false;
                    numPanel.isCreated = false;
                    numPanel.CreateElement();
                    listNumButton = numPanel.GetNumButton();
                    listCmdButton = numPanel.GetCmdButton();
                    foreach (Controls.NumButton nb in listNumButton)
                    {
                        nb.MouseLeftButtonDown += (sr, e) =>
                        {
                            string num = numPanel.GetChoosedNum();
                            touzhu.lbBetCount.Text = num.Length.ToString();
                        };
                    }
                    foreach (Button nb in listCmdButton)
                    {
                        nb.Click += (sr, e) =>
                        {
                            string num = numPanel.GetChoosedNum();
                            touzhu.lbBetCount.Text = num.Length.ToString();
                        };
                    }
                };
            }
            rateGrid.numPanel = numPanel;
            rateGrid.touzhu = touzhu;
            MainPage.rateGrids = new List<Controls.RateGrid> { rateGrid };
            playTypeRadioId = Convert.ToInt32(((RadioButton)rbPanel.GetChoosedRadioButton()).Tag);
            srv.GetCurrenIssuNoAsync((int)LotteryType._3D);
        }
Exemplo n.º 3
0
        void Redirect(Controls.PlayTypeButton btn)
        {
            if (XuanHaoPanel.Children.Count > 0)
            {
                XuanHaoPanel.Children.Clear();
            }
            Controls.TouZhuCtrl touzhu = new Controls.TouZhuCtrl();
            MainPage.TouzhuControl = touzhu;
            MainPage.playType = Convert.ToInt32(btn.Tag);
            DockPanel dockPanel = new DockPanel();
            dockPanel.LastChildFill = true;
            dockPanel.Width = 658;

            Grid grid = new Grid();
            grid.RowDefinitions.Insert(0, new RowDefinition() { Height = new GridLength() });
            grid.RowDefinitions.Insert(1, new RowDefinition() { Height = new GridLength(25) });

            Controls.NumPanel numPanel = new Controls.NumPanel(8, 2);
            Controls.RadioButtonPanel rbPanel = new Controls.RadioButtonPanel();
            grid.Children.Add(numPanel);
            grid.Children.Add(rbPanel);
            numPanel.SetValue(Grid.RowProperty, 0);
            rbPanel.SetValue(Grid.RowProperty, 1);

            //Controls.TouZhuCtrl touzhu = new Controls.TouZhuCtrl();
            //TouzhuControl = touzhu;
            touzhu.lotteryType = LotteryType.SSQ;
            touzhu.PlayType = (int)btn.Tag;
            touzhu.numPanel = numPanel;
            touzhu.rbPanel = rbPanel;
            touzhu.btBonus.IsEnabled = false;
            touzhu.PlayTypeName = btn.Text;
            //添加按钮
            touzhu.btnAdd.Click += (s, e) =>
            {
                string num = numPanel.GetChoosedNum((SSQPlayType)btn.Tag);
                if (num.Length == 0)
                {
                    Messager.Show("号码不完整,无法添加");
                    return;
                }
                if (num.StartsWith("@"))
                {
                    Messager.Show(num.Replace("@", ""));
                    return;
                }
                string[] nums = num.Split(' ');
                foreach (string n in nums)
                {
                    touzhu.NumBasket.Items.Add(n);
                    ListBoxItem item = (ListBoxItem)(touzhu.NumBasket.ItemContainerGenerator.ContainerFromItem(
                        touzhu.NumBasket.Items[touzhu.NumBasket.Items.Count - 1]));
                    switch ((PlayType)btn.Tag)
                    {
                        case PlayType._SSQBlue:
                            item.Width = 300;
                            break;
                        case PlayType._SSQRed:
                            item.Width = 560;
                            break;
                    }
                }
                numPanel.ClearAllNums();
                touzhu.lbBetCount.Text = BetCountCalc.GetBetCount
                    (touzhu.NumBasket, (PlayType)btn.Tag, numPanel.isWriten,
                     ((PlayTypeRadio)Convert.ToInt32(rbPanel.GetChoosedRadioButton().Tag.ToString())).ToString()
                    ).ToString();
            };
            DockPanel.SetDock(grid, Dock.Top);
            dockPanel.Children.Add(grid);
            DockPanel.SetDock(touzhu, Dock.Top);
            dockPanel.Children.Add(touzhu);
            XuanHaoPanel.Children.Add(dockPanel);
            List<PlayTypeRadioInfo> list_radio = App.Session[Constant.PLAYTYPERADIO_SESSION] as List<PlayTypeRadioInfo>;
            list_radio = (from l in list_radio where l.PlayTypeID1 == (int)((PlayType)btn.Tag) select l).ToList();
            List<PlayTypeNumInfo> list_num = App.Session[Constant.PLAYTYPENUM_SESSION] as List<PlayTypeNumInfo>;
            list_num = (from l in list_num where l.PlayTypeID1 == (int)((PlayType)btn.Tag) select l).ToList();
            string numPanelText = string.Empty;
            string rbPanelText = string.Empty;
            string rbPanelValue = string.Empty;
            foreach (PlayTypeRadioInfo p in list_radio)
            {
                if (p == list_radio.First())
                    MainPage.playTypeRadio = Convert.ToInt32(p.PlayTypeRadioID);
                rbPanelText += p.PlayTypeRadioName;
                rbPanelValue += p.PlayTypeRadioID.ToString();
                if (p != list_radio.Last())
                {
                    rbPanelValue += ",";
                    rbPanelText += ",";
                }
            }
            foreach (PlayTypeNumInfo p in list_num)
            {
                numPanelText += p.PlayTypeNumName;
                if (p != list_num.Last())
                    numPanelText += ",";
            }
            numPanel.Text = numPanelText;
            rbPanel.Text = rbPanelText;
            rbPanel.Value = rbPanelValue;
            if ((PlayType)btn.Tag == PlayType._SSQRed)
            {
                numPanel.ColNum = 11;
                numPanel.RowNum = 3;
            }
            rbPanel.CreateElement();
            numPanel.CreateElement();
            foreach (RadioButton rb in rbPanel.PlayTypePanel.Children)
            {
                rb.Checked += (s, er) =>
                {
                    touzhu.NumBasket.Items.Clear();
                    numPanel.ClearChild();
                    numPanel.isCreated = false;
                    numPanel.CreateElement();
                };
            }
        }