void PictureChooser_ValueChanged(object sender, EventArgs e) { string path = ""; PictureChooser chooser = sender as PictureChooser; if (chooser == null) { return; } switch (chooser.Name) { case "Photo": string dude = DataMap.PhotoMap[chooser.Value]; path = String.Format("PlayerData\\PlayerPhotos\\{0}.jpg", dude); string noPhoto = "PlayerData\\PlayerPhotos\\0004.jpg"; if (System.IO.File.Exists(path)) { chooser.PictureBox.ImageLocation = path; } else if (System.IO.File.Exists(noPhoto)) { chooser.PictureBox.ImageLocation = noPhoto; } mFacePictureBox.ImageLocation = chooser.PictureBox.ImageLocation; UpdateGenericFacePictureBox(); break; case "FaceMask": path = String.Format("PlayerData\\EquipmentImages\\{0}.jpg", chooser.Value); if (System.IO.File.Exists(path)) { chooser.PictureBox.ImageLocation = path; } else { chooser.PictureBox.ImageLocation = null; } mFaceMaskPictureBox.ImageLocation = chooser.PictureBox.ImageLocation; break; case "RightShoe": case "LeftShoe": path = String.Format("PlayerData\\EquipmentImages\\{0}.jpg", chooser.Value); if (System.IO.File.Exists(path)) { chooser.PictureBox.ImageLocation = path; } else { chooser.PictureBox.ImageLocation = null; } break; // elbow == incomplete case "RightElbow": case "LeftElbow": case "RightWrist": case "LeftWrist": case "NeckRoll": case "LeftGlove": case "RightGlove": path = String.Format("PlayerData\\EquipmentImages\\{0}{1}.jpg", chooser.RepresentedValue.Name, chooser.Value); if (System.IO.File.Exists(path)) { chooser.PictureBox.ImageLocation = path; } else { chooser.PictureBox.ImageLocation = null; } break; } }
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); } }
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); } }