Esempio n. 1
0
        private void AddSkill(string skill)
        {
            Control c = null;

            if (skill == "PowerRunStyle")
            {
                StringSelectionControl ssc = new StringSelectionControl();
                ssc.RepresentedValue = typeof(PowerRunStyle);
                ssc.Name             = ssc.Text = skill;
                ssc.ValueChanged    += new EventHandler(ValueChanged);
                c = ssc;
            }
            else
            {
                IntAttrControl iac = new IntAttrControl();
                iac.Name          = iac.Text = skill;
                iac.ValueChanged += new EventHandler(ValueChanged);
                c = iac;
            }
            int row = mSkillsTab.Controls.Count / 5;
            int col = mSkillsTab.Controls.Count % 5;

            c.Location = new Point(col * c.Width, row * c.Height);
            mSkillsTab.Controls.Add(c);
        }
Esempio n. 2
0
        private void SetControlValue(string controlName, string val)
        {
            //if ("coach".Equals(controlName, StringComparison.InvariantCultureIgnoreCase) )
            //    return;

            Control                c   = FindControl(this, controlName);
            IntAttrControl         iac = c as IntAttrControl;
            TextBox                box = c as TextBox;
            StringSelectionControl ssc = c as StringSelectionControl;

            if (controlName == "Photo")
            {
                this.Photo.Image = StaticUtils.GetImageFromPath(String.Format("PlayerData\\PlayerPhotos\\{0}.jpg", val));
                this.Photo.Tag   = val;
                photoTip.SetToolTip(this.Photo, val);
                //ValueChanged(this.Photo, EventArgs.Empty);
            }
            else if (iac != null)
            {
                iac.Value = Int32.Parse(val);
            }
            else if (box != null)
            {
                box.Text = val;
            }
            else if (ssc != null)
            {
                ssc.Value = val;
            }
        }
Esempio n. 3
0
        private void AddStat(string stat)
        {
            Control        c   = null;
            IntAttrControl iac = new IntAttrControl();

            iac.Name          = iac.Text = stat;
            iac.ValueChanged += new EventHandler(ValueChanged);
            c = iac;
            int row = mStatsTab.Controls.Count / 5;
            int col = mStatsTab.Controls.Count % 5;

            c.Location = new Point(col * c.Width, row * c.Height);
            mStatsTab.Controls.Add(c);
        }
Esempio n. 4
0
        /// <summary>
        /// returns null when control is not found, control value otherwise
        /// </summary>
        private string GetControlValue(string controlName)
        {
            if (controlName == "Photo")
            {
                return(this.Photo.Tag.ToString());
            }

            Control c = FindControl(this, controlName);

            if (c != null)
            {
                TextBox                tb  = c as TextBox;
                IntAttrControl         iac = c as IntAttrControl;
                StringSelectionControl ssc = c as StringSelectionControl;
                DateValueControl       dvc = c as DateValueControl;
                if (iac != null)
                {
                    return(iac.Value.ToString());
                }
                else if (dvc != null)
                {
                    return(dvc.Value);
                }
                else if (ssc != null)
                {
                    if (controlName == "PBP" && PBPs.ContainsKey(ssc.Value))
                    {
                        return(PBPs[ssc.Value]);
                    }
                    else if (controlName == "Photo" && Photos.ContainsKey(ssc.Value))
                    {
                        return(Photos[ssc.Value]);
                    }
                    else if (controlName == "College" && ssc.Value.IndexOf(',') > -1)
                    {
                        return(string.Concat("\"", ssc.Value, "\""));
                    }
                    return(ssc.Value);
                }
                else if (tb != null)
                {
                    return(tb.Text);
                }
            }
            return(null);
        }
Esempio n. 5
0
        /// <summary>
        /// Clears and disposed of the child controls on parentControl.
        /// </summary>
        private void ClearControls(Control parentControl)
        {
            Control                c   = null;
            IntAttrControl         iac = null;
            StringSelectionControl ssc = null;

            for (int i = parentControl.Controls.Count - 1; i > -1; i--)
            {
                c = parentControl.Controls[i];
                parentControl.Controls.Remove(c);
                ssc = c as StringSelectionControl;
                iac = c as IntAttrControl;
                if (ssc != null)
                {
                    ssc.ValueChanged -= new EventHandler(ValueChanged);
                }
                else if (iac != null)
                {
                    iac.ValueChanged -= new EventHandler(ValueChanged);
                }
                c.Dispose();
            }
        }
Esempio n. 6
0
 private void AddSkill(string skill)
 {
     Control c = null;
     if (skill == "PowerRunStyle")
     {
         StringSelectionControl ssc = new StringSelectionControl();
         ssc.RepresentedValue = typeof(PowerRunStyle);
         ssc.Name = ssc.Text = skill;
         ssc.ValueChanged += new EventHandler(ValueChanged);
         c = ssc;
     }
     else
     {
         IntAttrControl iac = new IntAttrControl();
         iac.Name = iac.Text = skill;
         iac.ValueChanged += new EventHandler(ValueChanged);
         c = iac;
     }
     int row = mSkillsTab.Controls.Count / 5;
     int col = mSkillsTab.Controls.Count % 5;
     c.Location = new Point(col * c.Width, row * c.Height);
     mSkillsTab.Controls.Add(c);
 }
Esempio n. 7
0
        private void AddAppearance(string appearance)
        {
            Control c = null;
            IntAttrControl intAttrCtrl = null;
            StringSelectionControl ctrl = null;
            if( "Weight,DOB,YearsPro,JerseyNumber,".IndexOf(appearance+",") > -1)
            {
                switch( appearance)
                {
                    case "JerseyNumber":
                        intAttrCtrl = new IntAttrControl();
                        intAttrCtrl.Name = intAttrCtrl.Text = appearance;
                        intAttrCtrl.Max = 99;
                        intAttrCtrl.ValueChanged += new EventHandler(jersey_ValueChanged);
                        break;
                    case "YearsPro":
                        intAttrCtrl = new IntAttrControl();
                        intAttrCtrl.Name = intAttrCtrl.Text = appearance;
                        intAttrCtrl.Max = 99;
                        break;
                    case "Weight":
                        intAttrCtrl = new IntAttrControl();
                        intAttrCtrl.Name = intAttrCtrl.Text = appearance;
                        intAttrCtrl.Min = 150;
                        intAttrCtrl.Max = intAttrCtrl.Min + 255;
                        intAttrCtrl.ValueChanged += new EventHandler(weight_ValueChanged);

                        break;
                    case "DOB":
                        DateValueControl dvc = new DateValueControl();
                        dvc.Name = dvc.Text = appearance;
                        dvc.ValueChanged += new EventHandler(ValueChanged);
                        c = dvc;
                        break;
                }
            }
            else if( "Hand,BodyType,Skin,Face,MouthPiece,EyeBlack,Dreads,Helmet,Sleeves,Visor,Turtleneck,Height,College,PBP,".IndexOf(appearance+",") > -1) {
                ctrl = new StringSelectionControl();
                ctrl.Name = ctrl.Text = appearance;
                switch (appearance)
                {
                    case "Hand": ctrl.RepresentedValue = typeof(Hand); break;
                    case "BodyType":
                        ctrl.RepresentedValue = typeof(Body);
                        ctrl.ValueChanged += new EventHandler(bodyType_ValueChanged);
                        break;
                    case "Skin":
                        ctrl.RepresentedValue = typeof(Skin);
                        ctrl.ValueChanged += new EventHandler(skin_ValueChanged);
                        break;
                    case "Face": ctrl.RepresentedValue = typeof(Face); break;
                    case "MouthPiece":
                    case "EyeBlack":
                    case "Dreads":  ctrl.RepresentedValue = typeof(YesNo);  break;
                    case "Helmet": ctrl.RepresentedValue = typeof(Helmet); break;
                    case "Sleeves": ctrl.RepresentedValue = typeof(Sleeves); break;
                    case "Visor": ctrl.RepresentedValue = typeof(Visor); break;
                    case "Turtleneck": ctrl.RepresentedValue = typeof(Turtleneck); break;
                    case "Height": //5'6"-7'0"
                        ctrl.SetItems(new string[] {
                            "5'6\"", "5'7\"", "5'8\"", "5'9\"", "5'10\"", "5'11\"",
                            "6'0\"", "6'1\"", "6'2\"", "6'3\"", "6'4\"",  "6'5\"",
                            "6'6\"", "6'7\"", "6'8\"", "6'9\"", "6'10\"", "6'11\"",
                            "7'0\"" });
                        ctrl.ValueChanged += new EventHandler(height_ValueChanged);
                        break;
                    case "College":
                        ctrl.DropDownStyle = ComboBoxStyle.DropDown;
                        ctrl.SetItems(Colleges);
                        break;
                    case "PBP":
                        string[] values = new string[this.ReversePBPs.Count];
                        this.ReversePBPs.Values.CopyTo(values, 0);
                        ctrl.SetItems(values);
                        ctrl.DropDownStyle = ComboBoxStyle.DropDown;
                        break;
                }
            }
            else
            {
                ctrl = new PictureChooser();
                ctrl.Name = ctrl.Text = appearance;
                ctrl.ValueChanged += new EventHandler(PictureChooser_ValueChanged);

                switch(appearance)
                {
                    // need to special case the setting of these items.
                    case "FaceMask": ctrl.RepresentedValue = typeof(FaceMask); break;
                    case "LeftElbow":
                    case "RightElbow": ctrl.RepresentedValue = typeof(Elbow); break;
                    case "LeftGlove":
                    case "RightGlove": ctrl.RepresentedValue = typeof(Glove); break;
                    case "LeftWrist":
                    case "RightWrist": ctrl.RepresentedValue = typeof(Wrist); break;
                    case "LeftShoe":
                    case "RightShoe": ctrl.RepresentedValue = typeof(Shoe); break;
                    case "NeckRoll": ctrl.RepresentedValue = typeof(NeckRoll); break;
                    case "Photo":
                        ctrl.DropDownStyle = ComboBoxStyle.DropDown;
                        ctrl.ValueChanged += new EventHandler(PictureChooser_ValueChanged);
                        string[] vals = new string[this.ReversePhotos.Count];
                        this.ReversePhotos.Values.CopyTo(vals, 0);
                        ctrl.SetItems(vals);
                        break;
                }
            }
            if (intAttrCtrl != null)
            {
                intAttrCtrl.ValueChanged += new EventHandler(ValueChanged);
                c = intAttrCtrl;
            }
            else if (ctrl != null)
            {
                ctrl.ValueChanged += new EventHandler(ValueChanged);
                c = ctrl;
            }

            if (c != null)
            {
                int row = mAppearanceTab.Controls.Count / 5;
                int col = mAppearanceTab.Controls.Count % 5;
                c.Location = new Point(col * c.Width, row * c.Height);
                mAppearanceTab.Controls.Add(c);
            }
        }
Esempio n. 8
0
        private bool SetControlValue(Control parentControl, string controlName, string val)
        {
            foreach (Control c in parentControl.Controls)
            {
                if (c.Name == controlName)
                {
                    IntAttrControl         iac = c as IntAttrControl;
                    StringSelectionControl ssc = c as StringSelectionControl;
                    DateValueControl       dvc = c as DateValueControl;

                    if (iac != null)
                    {
                        iac.Value = Int32.Parse(val);
                        return(true);
                    }
                    else if (dvc != null)
                    {
                        dvc.Value = val;
                        return(true);
                    }
                    else if (ssc != null)
                    {
                        if (controlName == "PBP")
                        {
                            if (ReversePBPs.ContainsKey(val))
                            {
                                ssc.Value = ReversePBPs[val];
                                return(true);
                            }
                        }
                        else if (controlName == "Photo")
                        {
                            if (ReversePhotos.ContainsKey(val))
                            {
                                ssc.Value = ReversePhotos[val];
                            }
                            else
                            {
                                ssc.Value = "NoPhoto";
                            }
                            return(true);
                        }
                        else if (controlName == "College")
                        {
                            if (val[0] == '"')
                            {
                                val = val.Replace("\"", "");
                            }
                            ssc.Value = val;
                            return(true);
                        }
                        else
                        {
                            ssc.Value = val;
                            return(true);
                        }
                    }
                    else
                    {
                        c.Text = val;
                        return(true);
                    }
                }
            }
            return(false);
        }
Esempio n. 9
0
        void weight_ValueChanged(object sender, EventArgs e)
        {
            IntAttrControl ctrl = sender as IntAttrControl;

            mWeightLabel.Text = ctrl.Value + " lbs";
        }
Esempio n. 10
0
        void jersey_ValueChanged(object sender, EventArgs e)
        {
            IntAttrControl ctrl = sender as IntAttrControl;

            mJerseyNumberLabel.Text = "#" + ctrl.Value;
        }
Esempio n. 11
0
        private void AddAppearance(string appearance)
        {
            Control                c           = null;
            IntAttrControl         intAttrCtrl = null;
            StringSelectionControl ctrl        = null;

            if ("Weight,DOB,YearsPro,JerseyNumber,".IndexOf(appearance + ",") > -1)
            {
                switch (appearance)
                {
                case "JerseyNumber":
                    intAttrCtrl               = new IntAttrControl();
                    intAttrCtrl.Name          = intAttrCtrl.Text = appearance;
                    intAttrCtrl.Max           = 99;
                    intAttrCtrl.ValueChanged += new EventHandler(jersey_ValueChanged);
                    break;

                case "YearsPro":
                    intAttrCtrl      = new IntAttrControl();
                    intAttrCtrl.Name = intAttrCtrl.Text = appearance;
                    intAttrCtrl.Max  = 99;
                    break;

                case "Weight":
                    intAttrCtrl               = new IntAttrControl();
                    intAttrCtrl.Name          = intAttrCtrl.Text = appearance;
                    intAttrCtrl.Min           = 150;
                    intAttrCtrl.Max           = intAttrCtrl.Min + 255;
                    intAttrCtrl.ValueChanged += new EventHandler(weight_ValueChanged);

                    break;

                case "DOB":
                    DateValueControl dvc = new DateValueControl();
                    dvc.Name          = dvc.Text = appearance;
                    dvc.ValueChanged += new EventHandler(ValueChanged);
                    c = dvc;
                    break;
                }
            }
            else if ("Hand,BodyType,Skin,Face,MouthPiece,EyeBlack,Dreads,Helmet,Sleeves,Visor,Turtleneck,Height,College,PBP,".IndexOf(appearance + ",") > -1)
            {
                ctrl      = new StringSelectionControl();
                ctrl.Name = ctrl.Text = appearance;
                switch (appearance)
                {
                case "Hand": ctrl.RepresentedValue = typeof(Hand); break;

                case "BodyType":
                    ctrl.RepresentedValue = typeof(Body);
                    ctrl.ValueChanged    += new EventHandler(bodyType_ValueChanged);
                    break;

                case "Skin":
                    ctrl.RepresentedValue = typeof(Skin);
                    ctrl.ValueChanged    += new EventHandler(skin_ValueChanged);
                    break;

                case "Face":
                    ctrl.RepresentedValue = typeof(Face);
                    ctrl.ValueChanged    += new EventHandler(face_ValueChanged);
                    break;

                case "MouthPiece":
                case "EyeBlack":
                case "Dreads":  ctrl.RepresentedValue = typeof(YesNo);  break;

                case "Helmet": ctrl.RepresentedValue = typeof(Helmet); break;

                case "Sleeves": ctrl.RepresentedValue = typeof(Sleeves); break;

                case "Visor": ctrl.RepresentedValue = typeof(Visor); break;

                case "Turtleneck": ctrl.RepresentedValue = typeof(Turtleneck); break;

                case "Height":     //5'6"-7'0"
                    ctrl.SetItems(new string[] {
                        "5'6\"", "5'7\"", "5'8\"", "5'9\"", "5'10\"", "5'11\"",
                        "6'0\"", "6'1\"", "6'2\"", "6'3\"", "6'4\"", "6'5\"",
                        "6'6\"", "6'7\"", "6'8\"", "6'9\"", "6'10\"", "6'11\"",
                        "7'0\""
                    });
                    ctrl.ValueChanged += new EventHandler(height_ValueChanged);
                    break;

                case "College":
                    ctrl.DropDownStyle = ComboBoxStyle.DropDown;
                    ctrl.SetItems(Colleges);
                    break;

                case "PBP":
                    string[] values = new string[this.ReversePBPs.Count];
                    this.ReversePBPs.Values.CopyTo(values, 0);
                    ctrl.SetItems(values);
                    ctrl.DropDownStyle = ComboBoxStyle.DropDown;
                    break;
                }
            }
            else
            {
                ctrl               = new PictureChooser();
                ctrl.Name          = ctrl.Text = appearance;
                ctrl.ValueChanged += new EventHandler(PictureChooser_ValueChanged);

                switch (appearance)
                {
                // need to special case the setting of these items.
                case "FaceMask": ctrl.RepresentedValue = typeof(FaceMask); break;

                case "LeftElbow":
                case "RightElbow": ctrl.RepresentedValue = typeof(Elbow); break;

                case "LeftGlove":
                case "RightGlove": ctrl.RepresentedValue = typeof(Glove); break;

                case "LeftWrist":
                case "RightWrist": ctrl.RepresentedValue = typeof(Wrist); break;

                case "LeftShoe":
                case "RightShoe": ctrl.RepresentedValue = typeof(Shoe); break;

                case "NeckRoll": ctrl.RepresentedValue = typeof(NeckRoll); break;

                case "Photo":
                    ctrl.DropDownStyle = ComboBoxStyle.DropDown;
                    ctrl.ValueChanged += new EventHandler(PictureChooser_ValueChanged);
                    string[] vals = new string[this.ReversePhotos.Count];
                    this.ReversePhotos.Values.CopyTo(vals, 0);
                    ctrl.SetItems(vals);
                    break;
                }
            }
            if (intAttrCtrl != null)
            {
                intAttrCtrl.ValueChanged += new EventHandler(ValueChanged);
                c = intAttrCtrl;
            }
            else if (ctrl != null)
            {
                ctrl.ValueChanged += new EventHandler(ValueChanged);
                c = ctrl;
            }

            if (c != null)
            {
                int row = mAppearanceTab.Controls.Count / 5;
                int col = mAppearanceTab.Controls.Count % 5;
                c.Location = new Point(col * c.Width, row * c.Height);
                mAppearanceTab.Controls.Add(c);
            }
        }