public MyRatingControl(HitbaseRating ctl) : base() { hitbaseControl = ctl; }
public bool ReadDialogFromDialogData(HitbaseControl parent, HitbaseControlData hitbaseControlData) { //int controlIndex = 0; foreach (HitbaseControlData ctl in hitbaseControlData.Controls) { Object newControl = null; if (ctl.ControlName != "MainWindowCDUserControl") { switch (ctl.ControlName) { case "HitbaseTextBox": newControl = new HitbaseTextBox(this); break; case "HitbaseLabel": newControl = new HitbaseLabel(this); break; case "HitbaseButton": newControl = new HitbaseButton(this); break; case "HitbaseComboBox": newControl = new HitbaseComboBox(this); break; case "HitbaseCheckBox": newControl = new HitbaseCheckBox(this); break; case "HitbaseRating": newControl = new HitbaseRating(this); break; //TODO_WPF!!!!!!!!!!!!!!!!case "HitbaseTrackList": newControl = new HitbaseTrackList(this); break; //TODO_WPF!!!!!!!!!!!!!!!!case "HitbaseParticipants": newControl = new HitbaseParticipants(this); break; case "HitbaseSeperator": newControl = new HitbaseSeperator(this); break; //TODO_WPF!!!!!!!!!!!!!!!!case "HitbaseCover": newControl = new HitbaseCover(this); break; default: //MessageBox.Show("unknown hitbase Control " + ctl.ControlName, System.Windows.Forms.Application.ProductName, MessageBoxButton.OK, MessageBoxImage.Error); break; } } else { newControl = this; } if (newControl != null) { foreach (HitbaseControlData.Property prop in ctl.Properties) { PropertyInfo property = newControl.GetType().GetProperty(prop.Name); if (property != null) { if (property.PropertyType == typeof(System.Drawing.Color)) { string colorString = prop.Value.ToString(); if (colorString.StartsWith("#")) { int R, G, B; R = Convert.ToInt32(colorString.Substring(1, 2), 16); G = Convert.ToInt32(colorString.Substring(3, 2), 16); B = Convert.ToInt32(colorString.Substring(5, 2), 16); //TODO_WPF!!!!!!!!!!!!!!!!!property.SetValue(newControl, Color.FromArgb(R, G, B), null); } else { //TODO_WPF!!!!!!!!!!!!!!!!!property.SetValue(newControl, Color.FromName(colorString), null); } } else { if (property.PropertyType == typeof(System.Drawing.Font) && prop.Value != null) { property.SetValue(newControl, GetFontFromString(prop.Value.ToString()), null); } else { property.SetValue(newControl, prop.Value, null); } } } } if (newControl is HitbaseControl) { AddHitbaseControl(parent, 0, (HitbaseControl)newControl); ReadDialogFromDialogData((HitbaseControl)newControl, ctl); } } } return(true); }