public void SetIcon(string iconName) { BaseIconFileName = iconName; BaseIcon = new IconClass(iconName); BaseIcon.SetLocation(this.Width, this.Height, IconLocation); Invalidate(); }
public IEnumerator BoardChanged_Int() { for (int i = 0; i <= 6; i += 3) { IconClass a = circles[0].GetIcon(i); IconClass b = circles[1].GetIcon(i); IconClass c = circles[2].GetIcon(i); if (a.Active && b.Active && c.Active) { if (IconAssetData.IconData.Set(a.Icon, b.Icon, c.Icon)) { Score += setScoreValue; a.Active = b.Active = c.Active = false; bool aDone, bDone, cDone = false; a.Disintegrate(out aDone); b.Disintegrate(out bDone); c.Disintegrate(out cDone); yield return(new WaitUntil(() => aDone && bDone && cDone)); IconAssetData.Instance.RemoveIcon(a.Icon); IconAssetData.Instance.RemoveIcon(b.Icon); IconAssetData.Instance.RemoveIcon(c.Icon); a.Icon = IconAssetData.Instance.GetRandomIcon(); b.Icon = IconAssetData.Instance.GetRandomIcon(); c.Icon = IconAssetData.Instance.GetRandomIcon(); } } } }
// To replace a used up icon. public void ReplaceIcon(int index) { index = IndexWithOffset(index); IconClass iconClass = icons[index]; iconClass.Icon = IconAssetData.Instance.GetRandomIcon(); }
/// <summary> /// Here on Icon Name change /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnIconNameInputBoxChange(object sender, EventArgs e) { if (AllowChangeEvents == true) { StringInputChange(sender, InputType.IconName); } //reload the icon ClassIcon = new IconClass(Model.ImageFilename); ClassIcon.SetLocation(this.Width, this.Height, IconLocation); }
/// <summary> /// Подпрограмма задания иконки окна /// </summary> /// <param name="path"></param> private void set_icon(string path = "pack://application:,,,/models/icon/icon.ico") { // Осуществление потокобезопасного вызова элементов if (!Dispatcher.CheckAccess()) { var add = new DelgImage(set_icon); Dispatcher.Invoke(add, path); } else { // Настройка иконки Icon = new IconClass(path).get_icon(); } }
private void SetDefaultGraphics() { BaseIcon = new IconClass("Interface\\IconEmptyPassive"); BaseIcon.SetLocation(this.Width, this.Height, IconLocation); IconBorderActive = new IconClass("Interface\\IconBorderActive"); IconBorderActive.SetLocation(this.Width, this.Height, IconBorderLocation); IconBorderPassive = new IconClass("Interface\\IconBorderPassive"); IconBorderPassive.SetLocation(this.Width, this.Height, IconBorderLocation); IconSelectedActive = new IconClass("Interface\\IconSelectedActive"); IconSelectedActive.SetLocation(this.Width, this.Height, IconSelectedLocation); IconSelectedPassive = new IconClass("Interface\\IconSelectedPassive"); IconSelectedPassive.SetLocation(this.Width, this.Height, IconSelectedLocation); IconNotSelectableActive = new IconClass("Interface\\IconNotSelectableActive"); IconNotSelectableActive.SetLocation(this.Width, this.Height, IconNotSelectableLocation); IconNotSelectablePassive = new IconClass("Interface\\IconNotSelectablePassive"); IconNotSelectablePassive.SetLocation(this.Width, this.Height, IconNotSelectableLocation); }
public SlotControl() { InitializeComponent(); SetDefaults(); //Set up the graphics. SlotBorderWhiteActive = new IconClass("Interface\\SlotBorderWhiteActive"); SlotBorderWhiteActive.SetLocation(this.Width, this.Height, WhiteBorderLocation); SlotBorderWhitePassive = new IconClass("Interface\\SlotBorderWhitePassive"); SlotBorderWhitePassive.SetLocation(this.Width, this.Height, WhiteBorderLocation); SlotBorderRedActive = new IconClass("Interface\\SlotBorderRedActive"); SlotBorderRedActive.SetLocation(this.Width, this.Height, BorderLocation); SlotBorderRedPassive = new IconClass("InterFace\\SlotBorderRedPassive"); SlotBorderRedPassive.SetLocation(this.Width, this.Height, BorderLocation); SlotBorderLockedActive = new IconClass("Interface\\SlotBorderLockedActive"); SlotBorderLockedActive.SetLocation(this.Width, this.Height, BorderLocation); SlotBorderLockedPassive = new IconClass("Interface\\SlotBorderLockedPassive"); SlotBorderLockedPassive.SetLocation(this.Width, this.Height, BorderLocation); SlotCoreBackgroundActive = new IconClass("Interface\\SlotCoreBackgroundActive"); SlotCoreBackgroundActive.SetLocation(this.Width, this.Height, CoreBackgroundLocation); SlotCoreBackgroundPassive = new IconClass("Interface\\SlotCoreBackgroundPassive"); SlotCoreBackgroundPassive.SetLocation(this.Width, this.Height, CoreBackgroundLocation); SlotBackgroundActive = new IconClass("Interface\\SlotBackgroundActive"); SlotBackgroundActive.SetLocation(this.Width, this.Height, SlotLocation); SlotBackgroundPassive = new IconClass("Interface\\SlotBackgroundPassive"); SlotBackgroundPassive.SetLocation(this.Width, this.Height, SlotLocation); BaseIcon = new IconClass("Interface\\Test"); BaseIcon.SetLocation(this.Width, this.Height, IconLocation); IconEmptyActive = new IconClass("Interface\\IconEmptyActive"); IconEmptyActive.SetLocation(this.Width, this.Height, IconLocation); IconEmptyPassive = new IconClass("Interface\\IconEmptyPassive"); IconEmptyPassive.SetLocation(this.Width, this.Height, IconLocation); IconBorderActive = new IconClass("Interface\\IconBorderActive"); IconBorderActive.SetLocation(this.Width, this.Height, IconBorderLocation); IconBorderPassive = new IconClass("Interface\\IconBorderPassive"); IconBorderPassive.SetLocation(this.Width, this.Height, IconBorderLocation); }
public MvcHtmlString ToHtml(HtmlHelper helper) { HtmlStringBuilder sb = new HtmlStringBuilder(); using (sb.SurroundLine("li")) { using (sb.SurroundLine(new HtmlTag("a", Id) .Class("badge").Class(Class).Class(Active? "sf-widget-active" : null) .Attr("title", Title) .Attr("role", "button") .Attr("href", "#") .Attr("data-toggle", "dropdown"))) { if (IconClass.HasText()) { sb.AddLine(new HtmlTag("span").Class(IconClass)); } if (Text.HasText()) { sb.AddLine(new HtmlTag("span").SetInnerText(Text)); } if (Html != null) { sb.AddLine(Html); } } using (sb.SurroundLine(new HtmlTag("ul") .Class("dropdown-menu dropdown-menu-right") .Attr("role", "menu") .Attr("aria-labelledby", Id))) { foreach (var mi in Items) { sb.AddLine(mi.ToHtml()); } } } return(sb.ToHtml()); }
/// <inheritdoc /> /// <summary> /// /// </summary> /// <param name="exc"></param> /// <param name="text"></param> public WindowException(Exception exc, string text = "") { InitializeComponent(); Title += " " + exc.GetType(); // Настройка изображений Icon = new IconClass().get_icon(); Image1.Source = new IconClass().get_image(); // Заполнение данных LabelType.Text = exc.GetType().ToString(); LabelText.Text = text; LabelSource.Text = exc.Source; LabelTargetSite.Text = exc.TargetSite != null?exc.TargetSite.ToString() : string.Empty; LabelStackTrace.Text = exc.StackTrace; LabelMessage.Text = exc.Message; // Выход по кнопкам ECS и Enter PreviewKeyDown += HandleKey; }
// Setup icons on this circle public void GenerateIcons() { icons = new IconClass[iconsInCircle]; for (int i = 0; i < iconsInCircle; i++) { GameObject iconContainer = Instantiate(IconAssetData.Instance.IconPrefab, Vector3.zero, Quaternion.identity, transform); iconContainer.name = "Icon " + i; IconClass iconClass = iconContainer.GetComponent <IconClass>(); iconClass.Icon = IconAssetData.Instance.GetRandomIcon(); RectTransform iconRect = iconContainer.GetComponent <RectTransform>(); iconRect.position = itemPivot.position; iconRect.sizeDelta = itemPivot.sizeDelta; // + new Vector2(itemPivot.sizeDelta.x, 0); iconRect.RotateAround(transform.position, Vector3.forward, rotationAngle * i); icons[i] = iconClass; } }
public WindowInfo() { InitializeComponent(); // Настройка изображений //var path = App.MyGmainTest.ConfigProgram.ImageUri; Icon = new IconClass().get_icon(); Image1.Source = new IconClass().get_image(); // Задание текстовой информации LabelTitle.Text = AssemblyClass.get_title_file_exe(); LabelDescription.Text = AssemblyClass.get_description_file_exe(); LabelCompany.Text = AssemblyClass.get_company_file_exe(); LabelName.Text = AssemblyClass.get_product_file_exe(); LabelCopyright.Text = AssemblyClass.get_сopyright_file_exe(); LabelVersion.Text = AssemblyClass.get_version_exe(); LabelGuid.Text = AssemblyClass.get_guid_file_exe(); LabelData.Text = $"{AssemblyClass.get_data_exe():dd MMMM yyyy HH:mm:ss}"; LabelDeveloper.Text = "Волков В.А., отдел 312"; LabelVersionNet.Text = Environment.Version.ToString(); LabelVersionOs.Text = $"{Environment.OSVersion} ( {Environment.OSVersion.Version} )"; LabelPathExe.Text = Environment.CurrentDirectory; }
/// <summary> /// /// </summary> /// <param name="title"></param> /// <param name="text"></param> public WindowInit(string title, string text) { InitializeComponent(); // Настройка изображений //var path = App.MyGmainTest.ConfigProgram.ImageUri; Icon = new IconClass().get_icon(); Image1.Source = new IconClass().get_image(); ComboBoxOperatop.Items.Clear(); ComboBoxPredOtk.Items.Clear(); ComboBoxPredVp.Items.Clear(); ComboBoxTemp.Items.Clear(); var xml = new XmlClass("users.xml"); if (xml.Exist) { // Список операторов var users = xml.Read(XmlClass.ElementOperator); foreach (var i in users) { ComboBoxOperatop.Items.Add(i); } // Список представителей ОТК users = xml.Read(XmlClass.ElementOtk); foreach (var i in users) { ComboBoxPredOtk.Items.Add(i); } // Список представителей ВП МО users = xml.Read(XmlClass.ElementVp); foreach (var i in users) { ComboBoxPredVp.Items.Add(i); } } // Список температур ComboBoxTemp.Items.Add("+70.0"); ComboBoxTemp.Items.Add("+20.0"); ComboBoxTemp.Items.Add("-55.0"); // Задание значений TextBoxNomer.Text = $"{App.TaskManager.ConfigProgram.Nomer}"; ComboBoxTemp.Text = $"{App.TaskManager.ConfigProgram.Temp:F1}"; if (string.IsNullOrWhiteSpace(App.TaskManager.ConfigProgram.UserOperator)) { //ComboBoxOperatop.SelectedIndex = 0; } else { ComboBoxOperatop.Text = App.TaskManager.ConfigProgram.UserOperator; } if (string.IsNullOrWhiteSpace(App.TaskManager.ConfigProgram.UserOtk)) { //ComboBoxPredOtk.SelectedIndex = 0; } else { ComboBoxPredOtk.Text = App.TaskManager.ConfigProgram.UserOtk; } if (string.IsNullOrWhiteSpace(App.TaskManager.ConfigProgram.UserVp)) { // ComboBoxPredVp.SelectedIndex = 0; } else { ComboBoxPredVp.Text = App.TaskManager.ConfigProgram.UserVp; } TextBox.Text = text; Title = title; Button.Focus(); //var scope = FocusManager.GetFocusScope( Button ); //FocusManager.SetFocusedElement( scope, null ); //Keyboard.ClearFocus(); }
/// <summary> /// Подпрограмма инициализации формы /// </summary> private void Init() { // Настройка изображений //var path = App.MyGmainTest.ConfigProgram.ImageUri; Icon = new IconClass().get_icon(); Image1.Source = new IconClass().get_image(); // Get a list of serial port names var list = SerialPort.GetPortNames(); // Формирования коллекции ComboBox ComboBoxCom1.Items.Clear(); foreach (var str in list) { ComboBoxCom1.Items.Add(str); } // Получение списка плат работающих с разовыми командами var base_dio_ctrl = new DioCtrlBase(); // Список плат PCI-1716, PCI-1721, PCI-1753 var device_list = base_dio_ctrl.SupportedDevices; foreach (var str in device_list) { //if ( string.Equals( "PCI-1716", str.Description.Substring( 0, "PCI-1716".Length ) ) ) { // comboBoxPci1716.Items.Add( str ); //} if (string.Equals("PCI-1721", str.Description.Substring(0, "PCI-1721".Length))) { ComboBoxPci1721.Items.Add(str); } // ReSharper disable once InvertIf if (string.Equals("PCI-1753", str.Description.Substring(0, "PCI-1753".Length))) { ComboBoxPci1753N1.Items.Add(str); ComboBoxPci1753N2.Items.Add(str); } } // Получение списка плат раб отающихс аналоговыми сигналами var instant_ao_contrl = new InstantAoCtrl(); // Список плат PCI-1716, PCI-1721, PCI-1724 device_list = instant_ao_contrl.SupportedDevices; foreach (var str in device_list) { if (string.Equals("PCI-1724", str.Description.Substring(0, "PCI-1724".Length))) { ComboBoxPci1724U.Items.Add(str); } } var instant_ai_contrl = new InstantAiCtrl(); // Получение списка плат работающих с разовыми командами device_list = instant_ai_contrl.SupportedDevices; foreach (var str in device_list) { if (string.Equals("PCI-1747", str.Description.Substring(0, "PCI-1747".Length))) { ComboBoxPci1747U.Items.Add(str); } } // Получение списка плат Arinc429 var devices = new List <ushort>(); App.TaskManager.PortArinc.GetDevice(devices); TextBoxPci429N1.Items.Clear(); TextBoxPci429N2.Items.Clear(); foreach (var item in devices) { TextBoxPci429N1.Items.Add(item.ToString()); TextBoxPci429N2.Items.Add(item.ToString()); } // Установка настроек var xml = new XmlClass(); if (xml.Exist) { fill_form_file(); } else { fill_form_default(); } }
internal static TagBuilder GetIconTagBuilder(IconClass iconClass) { var icon = new TagBuilder("i"); icon.AddCssClass(iconClass.GetClass()); icon.AddCssClass(iconClass.LeftIcon() ? "left" : "right"); return icon; }
public static MvcHtmlString IconLink(this HtmlHelper htmlHelper, IconClass iconClass, string url, IDictionary<string, object> htmlAttributes) { var linkBuilder = new TagBuilder("a"); linkBuilder.AddCssClass("grid-icon"); linkBuilder.MergeAttribute("href", url); if (htmlAttributes == null) { htmlAttributes = new Dictionary<string, object>(); } if (!htmlAttributes.ContainsKey("tooltip")) { object title; if (htmlAttributes.TryGetValue("title", out title)) { htmlAttributes.Remove("title"); linkBuilder.MergeAttribute("tooltip", title.ToString()); } else { linkBuilder.MergeAttribute("tooltip", IconTitles[iconClass]); } } object classes; if (htmlAttributes.TryGetValue("class", out classes)) { linkBuilder.AddCssClass((string)classes); } linkBuilder.MergeAttributes(htmlAttributes); var icon = GetIconTagBuilder(iconClass); linkBuilder.InnerHtml = icon.ToString(TagRenderMode.Normal); return MvcHtmlString.Create(linkBuilder.ToString(TagRenderMode.Normal)); }
public static MvcHtmlString IconLink(this HtmlHelper htmlHelper, IconClass iconClass, string url) { return IconLink(htmlHelper, iconClass, url, null); }
public static MvcHtmlString Icon(this HtmlHelper htmlHelper, IconClass iconClass, IDictionary<string, object> htmlAttribures = null) { var icon = GetIconTagBuilder(iconClass); if (htmlAttribures != null) { icon.MergeAttributes(htmlAttribures); object classes; if (htmlAttribures.TryGetValue("class", out classes)) { icon.AddCssClass((string) classes); } } return MvcHtmlString.Create(icon.ToString(TagRenderMode.Normal)); }
private void TextBoxChange(object sender, InputType type) { string newStringValue; switch (type) { case InputType.Name: { newStringValue = NameInputBox.Text; if (newStringValue != Model.Name) { if (newStringValue == DatabaseName) { Model.Name = newStringValue; NameInputBox.BackColor = Color.White; NameErrorLabel.Text = ""; break; } if (CheckForUniqueness(newStringValue, InputType.Name) == true) { Model.Name = newStringValue; RecordChanged = true; NameInputBox.BackColor = Color.FromArgb(99, 99, 99); NameErrorLabel.Text = ""; } else { //Let the user know he need to choose a new name. AllowChangeEvents = false; NameInputBox.Text = Model.Name; NameInputBox.BackColor = Color.OrangeRed; NameErrorLabel.Text = "Error: Name is already taken, please choose another"; AllowChangeEvents = true; NameInputBox.Focus(); } } else { NameInputBox.BackColor = Color.FromArgb(99, 99, 99); NameErrorLabel.Text = ""; } break; } case InputType.ImageFileName: { newStringValue = IconFileNameInputBox.Text; if (newStringValue != Model.ImageFileName) { Model.ImageFileName = newStringValue; RecordChanged = true; FeatIcon = new IconClass("Feats\\" + newStringValue); FeatIcon.SetLocation(this.Width, this.Height, FeatIconLocation); Invalidate(); } break; } case InputType.Duration: { newStringValue = DurationTextBox.Text; if (newStringValue != Model.Duration) { Model.Duration = newStringValue; RecordChanged = true; } break; } case InputType.Description: { newStringValue = DescriptionHtmlEditor.Text; if (newStringValue != Model.Description) { Model.Description = newStringValue; RecordChanged = true; } break; } } }
private void PopulateFields(string featName) { List <FeatFeatTypeModel> featTypeModels; List <FeatTargetModel> featTargetModels; Model = new FeatModel(); Model.Initialize(featName); featTypeModels = FeatFeatTypeModel.GetAllByFeatId(Model.Id); featTargetModels = FeatTargetModel.GetAllByFeatId(Model.Id); //set our Database values for Error checkign unique values. DatabaseName = Model.Name; //set the main control values NameInputBox.Text = Model.Name; CategoryFeatComboBox.SelectedItem = FeatCategoryModel.GetNameFromId(Model.FeatCategoryId); ParentFeatCheckBox.Checked = Model.IsParentFeat; MultiplesCheckBox.Checked = Model.Multiple; ParentFeatComboBox.SelectedItem = FeatModel.GetNameFromId(Model.ParentFeat); StanceComboBox.SelectedItem = StanceModel.GetStanceNameFromId(Model.StanceId); IconFileNameInputBox.Text = Model.ImageFileName; FeatIcon = new IconClass("Feats\\" + Model.ImageFileName); FeatIcon.SetLocation(this.Width, this.Height, FeatIconLocation); DurationTextBox.Text = Model.Duration; //System tracking labels RecordGUIDLabel.Text = Model.Id.ToString(); ModDateLabel.Text = Model.LastUpdatedDate.ToString(); ModVersionLabel.Text = Model.LastUpdatedVersion; //DescriptionWebBrowser control DescriptionHtmlEditor.Text = Model.Description; //Set the FeatTypes //clear previous values if any. FeatTypesSelected = new List <FeatTypeSelection>(); foreach (int i in FeatTypesCheckedListBox.CheckedIndices) { FeatTypesCheckedListBox.SetItemChecked(i, false); } if (featTypeModels != null) { foreach (FeatFeatTypeModel ftmodel in featTypeModels) { FeatTypesSelected.Add(new FeatTypeSelection()); FeatTypesSelected[FeatTypesSelected.Count - 1].Model = ftmodel; FeatTypesSelected[FeatTypesSelected.Count - 1].DeleteRecord = false; FeatTypesCheckedListBox.SetItemChecked(FeatTypesCheckedListBox.FindStringExact(FeatTypeModel.GetNameFromId(ftmodel.FeatTypeId)), true); } } //Set the FeatTargets, clear previous values if any. FeatTargetsSelected = new List <FeatTargetSelection>(); foreach (int i in FeatTargetsCheckedListBox.CheckedIndices) { FeatTargetsCheckedListBox.SetItemChecked(i, false); } if (featTargetModels != null) { foreach (FeatTargetModel ftmodel in featTargetModels) { FeatTargetsSelected.Add(new FeatTargetSelection()); FeatTargetsSelected[FeatTargetsSelected.Count - 1].Model = ftmodel; FeatTargetsSelected[FeatTargetsSelected.Count - 1].DeleteRecord = false; FeatTargetsCheckedListBox.SetItemChecked(FeatTargetsCheckedListBox.FindStringExact(TargetModel.GetNameFromId(ftmodel.TargetId)), true); } } //Set the the requirements panel FeatRequirementsRP2.Clear(); FeatRequirementsRP2.RecordId = Model.Id; FeatRequirementsRP2.Initialize(); //Set the modifiers panel MP2Modifiers.Clear(); MP2Modifiers.RecordId = Model.Id; MP2Modifiers.Initialize(); //Invalidate the screen to update graphics Invalidate(); }
private void TextBoxChange(object sender, InputType type) { string newStringValue; switch (type) { case InputType.SpellName: { newStringValue = SpellNameInputBox.Text; if (newStringValue != Model.SpellName) { if (newStringValue == DatabaseName) { Model.SpellName = newStringValue; SpellNameInputBox.BackColor = Color.White; SaveFeedbackLabel.Text = ""; break; } if (CheckForUniqueness(newStringValue, InputType.SpellName) == true) { Model.SpellName = newStringValue; DataHasChanged = true; SpellNameInputBox.BackColor = Color.White; SaveFeedbackLabel.Text = ""; } else { //Let the user know he needs to choose a new name. AllowChangeEvents = false; SpellNameInputBox.Text = Model.SpellName; SpellNameInputBox.BackColor = Color.OrangeRed; SaveFeedbackLabel.Text = "Error: Name is already in use, please choose another"; AllowChangeEvents = true; SpellNameInputBox.Focus(); } } else { SpellNameInputBox.BackColor = Color.White; SaveFeedbackLabel.Text = ""; } break; } case InputType.IconName: { Model.IconFilename = SpellIconInputBox.Text; SpellIcon = new IconClass("Spells\\" + Model.IconFilename); SpellIcon.SetLocation(this.Width, this.Height, IconLocation); //redraw the icon Invalidate(); DataHasChanged = true; break; } case InputType.Duration: { Model.Duration = DurationInputTextBox.Text; DataHasChanged = true; break; } default: { Debug.WriteLine("Error: Unknown Type in Text Box Change"); break; } } }
/// <summary> /// for a given selected record, show its data in the appropriate fields /// </summary> /// <param name="recordName">The name of the record to show</param> private void PopulateFields(string recordName) { string controlName; ComboBox bonusFeatComboBox; FeatTypeModel featType; List <string> destinyName; DestinySphereModel currentDestiny; Model.Initialize(recordName); //cache the name and abbreviation strings for later comparisons DatabaseName = Model.Name; DatabaseAbbreviation = Model.Abbreviation; ClassNameInputBox.Text = Model.Name; DescriptionPreview.Navigate("about:blank"); DescriptionPreview.Document.OpenNew(false); DescriptionPreview.Document.Write(Model.Description); DescriptionPreview.Refresh(); HitDieInputBox.Text = Model.HitDie.ToString(); ClassNameAbbreviationInputBox.Text = Model.Abbreviation; SkillPointsInputBox.Text = Model.SkillPoints.ToString(); IconNameInputBox.Text = Model.ImageFilename; ClassIcon = new IconClass(Model.ImageFilename); ClassIcon.SetLocation(this.Width, this.Height, IconLocation); for (int i = 1; i <= Constant.NumHeroicLevels; i++) { controlName = "FortSaveInputBox" + i; Controls[controlName].Text = Model.LevelDetails[i - 1].FortitudeSave.ToString(); controlName = "ReflexSaveInputBox" + i; Controls[controlName].Text = Model.LevelDetails[i - 1].ReflexSave.ToString(); controlName = "WillSaveInputBox" + i; Controls[controlName].Text = Model.LevelDetails[i - 1].WillSave.ToString(); controlName = "BABInputBox" + i; Controls[controlName].Text = Model.LevelDetails[i - 1].BaseAttackBonus.ToString(); controlName = "BonusFeatComboBox" + i; bonusFeatComboBox = Controls[controlName] as ComboBox; if (Model.LevelDetails[i - 1].FeatTypeId == Guid.Empty) { bonusFeatComboBox.SelectedIndex = 0; } else { featType = new FeatTypeModel(); featType.Initialize(Model.LevelDetails[i - 1].FeatTypeId); bonusFeatComboBox.SelectedIndex = bonusFeatComboBox.FindStringExact(featType.Name); } } AlignmentsAllowedListBox.Items.Clear(); if (Model.AllowedAlignments != null) { foreach (AlignmentModel alignment in Model.AllowedAlignments) { AlignmentsAllowedListBox.Items.Add(alignment.Name); } } ClassSkillsListBox.Items.Clear(); if (Model.ClassSkills != null) { foreach (SkillModel skill in Model.ClassSkills) { ClassSkillsListBox.Items.Add(skill.Name); } } RecordGUIDLabel.Text = Model.Id.ToString(); ModDateLabel.Text = Model.LastUpdatedDate.ToString(); ModVersionLabel.Text = Model.LastUpdatedVersion; destinyName = DestinySphereModel.GetNames(); StartingDestinySphereComboBox.Items.Clear(); foreach (string name in destinyName) { StartingDestinySphereComboBox.Items.Add(name); } MaxSpellLevelComboBox.Items.Clear(); for (int i = 0; i <= 9; i++) { MaxSpellLevelComboBox.Items.Add(i.ToString()); } MaxSpellLevelComboBox.SelectedIndex = Model.MaxSpellLevel; currentDestiny = new DestinySphereModel(); currentDestiny.Initialize(Model.StartingDestinySphereId); StartingDestinySphereComboBox.SelectedIndex = StartingDestinySphereComboBox.FindStringExact(currentDestiny.Name); //make sure we haven't changed the data (Populating data from the database doesn't count as a change!) DataHasChanged = false; }
private void TextBoxChange(object sender, InputType type) { string newStringValue; TextBox changedBox; string boxIndexString; int boxIndex; int newIntValue; switch (type) { case InputType.Name: { newStringValue = NameInputBox.Text; if (newStringValue != ModelofRace.Name) { if (newStringValue == DatabaseName) { ModelofRace.Name = newStringValue; NameInputBox.BackColor = Color.White; NameErrorLabel.Text = ""; break; } if (CheckForUniqueness(newStringValue, InputType.Name) == true) { ModelofRace.Name = newStringValue; HasRaceDataChanged = true; NameInputBox.BackColor = Color.White; NameErrorLabel.Text = ""; } else { //Let the user know he needs to choose a new name. //MessageBox.Show("Error: The Name '" + newStringValue + "' already exist, you need to choose a different name", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); AllowChangeEvents = false; NameInputBox.Text = ModelofRace.Name; NameInputBox.BackColor = Color.OrangeRed; NameErrorLabel.Text = "Error: Name is already taken, please choose another"; AllowChangeEvents = true; NameInputBox.Focus(); } } else { NameInputBox.BackColor = Color.White; NameErrorLabel.Text = ""; } break; } case InputType.MaleIconName: { newStringValue = MaleIconNameInputBox.Text; if (newStringValue != ModelofRace.MaleImageFileName) { ModelofRace.MaleImageFileName = newStringValue; HasRaceDataChanged = true; MaleIcon = new IconClass(newStringValue); MaleIcon.SetLocation(this.Width, this.Height, MaleIconLocation); } break; } case InputType.FemaleIconName: { newStringValue = FemaleIconNameInputBox.Text; if (newStringValue != ModelofRace.FemaleImageFileName) { ModelofRace.FemaleImageFileName = newStringValue; HasRaceDataChanged = true; FemaleIcon = new IconClass(newStringValue); FemaleIcon.SetLocation(this.Width, this.Height, FemaleIconLocation); } break; } case InputType.Abbreviation: { newStringValue = AbbreviationInputBox.Text; if (newStringValue != ModelofRace.Abbreviation) { if (newStringValue == DatabaseAbbreviation) { ModelofRace.Abbreviation = newStringValue; AbbreviationInputBox.BackColor = Color.White; NameErrorLabel.Text = ""; break; } if (CheckForUniqueness(newStringValue, InputType.Abbreviation) == true) { ModelofRace.Abbreviation = newStringValue; HasRaceDataChanged = true; AbbreviationInputBox.BackColor = Color.White; NameErrorLabel.Text = ""; } else { //Let the user know he needs to choose a new name. //MessageBox.Show("Error: The Abbreviation '" + newStringValue + "' already exist, you need to choose a different abbreviation", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); AllowChangeEvents = false; AbbreviationInputBox.Text = ModelofRace.Abbreviation; AbbreviationInputBox.BackColor = Color.OrangeRed; NameErrorLabel.Text = "Error: Abbreviation is already taken, please choose another"; AllowChangeEvents = true; AbbreviationInputBox.Focus(); } } else { AbbreviationInputBox.BackColor = Color.White; NameErrorLabel.Text = ""; } break; } case InputType.SkillPoints: { //extract the index value of the control sending this message changedBox = new TextBox(); changedBox = (TextBox)sender; boxIndexString = Regex.Match(changedBox.Name, @"\d+").Value; boxIndex = Int32.Parse(boxIndexString) - 1; //grab the new value (make sure its a valid int and not some wierd string!) newStringValue = Regex.Match(changedBox.Text, @"\d+").Value; if (newStringValue.Length == 0) { newIntValue = 0; } else { newIntValue = Int32.Parse(newStringValue); } if (newIntValue != ModelofRaceDetail[boxIndex].BonusSkillPoints) { ModelofRaceDetail[boxIndex].BonusSkillPoints = newIntValue; HasRaceDetailsChanged[boxIndex] = true; } break; } } }
private void PopulateFields(string raceName) { string controlName; TextBox skillPointsBox; ComboBox bonusFeatChoiceBox; ModelofRace = new RaceModel(); ModelofRace.Initialize(raceName); //set our Original values for error checking unique values. DatabaseName = ModelofRace.Name; DatabaseAbbreviation = ModelofRace.Abbreviation; //Set the Main Control Values NameInputBox.Text = ModelofRace.Name; AbbreviationInputBox.Text = ModelofRace.Abbreviation; PastLifeFeatCombo.SelectedItem = FeatModel.GetNameFromId(ModelofRace.PastLifeFeatId); StartingClassComboBox.SelectedItem = ClassModel.GetNameFromId(ModelofRace.StartingClassId); IconicCheckBox.Checked = ModelofRace.Iconic; DescriptionWebBrowser.Navigate("about:blank"); DescriptionWebBrowser.Document.OpenNew(false); DescriptionWebBrowser.Document.Write(ModelofRace.Description); DescriptionWebBrowser.Refresh(); MaleIconNameInputBox.Text = ModelofRace.MaleImageFileName; FemaleIconNameInputBox.Text = ModelofRace.FemaleImageFileName; MaleIcon = new IconClass(ModelofRace.MaleImageFileName); MaleIcon.SetLocation(this.Width, this.Height, MaleIconLocation); FemaleIcon = new IconClass(ModelofRace.FemaleImageFileName); FemaleIcon.SetLocation(this.Width, this.Height, FemaleIconLocation); //Starting Stat Boxes StrengthMinimumBox.SelectedItem = ModelofRace.StrengthMinimum.ToString(); StrengthMaximumBox.SelectedItem = ModelofRace.StrengthMaximum.ToString(); DexterityMinimumBox.SelectedItem = ModelofRace.DexterityMinimum.ToString(); DexterityMaximumBox.SelectedItem = ModelofRace.DexterityMaximum.ToString(); ConstitutionMinimumBox.SelectedItem = ModelofRace.ConstitutionMinimum.ToString(); ConstitutionMaximumBox.SelectedItem = ModelofRace.ConstitutionMaximum.ToString(); IntelligenceMinimumBox.SelectedItem = ModelofRace.IntelligenceMinimum.ToString(); IntelligenceMaximumBox.SelectedItem = ModelofRace.IntelligenceMaximum.ToString(); WisdomMinimumBox.SelectedItem = ModelofRace.WisdomMinimum.ToString(); WisdomMaximumBox.SelectedItem = ModelofRace.WisdomMaximum.ToString(); CharismaMinimumBox.SelectedItem = ModelofRace.CharismaMinimum.ToString(); CharismaMaximumBox.SelectedItem = ModelofRace.CharismaMaximum.ToString(); //System Boxes GuidLabel.Text = ModelofRace.Id.ToString(); LastUpdatedDateLabel.Text = ModelofRace.LastUpdatedDate.ToString(); LastUpdatedVersionLabel.Text = ModelofRace.LastUpdatedVersion; //LevelDetails Information ModelofRaceDetail = RaceLevelDetailModel.GetAll(ModelofRace.Id); if (ModelofRaceDetail == null) { //no detail records exist for this race, so we need to create them ModelofRaceDetail = new List <RaceLevelDetailModel>(); for (int i = 0; i < Constant.NumHeroicLevels; i++) { ModelofRaceDetail.Add(new RaceLevelDetailModel()); ModelofRaceDetail[i].Level = i + 1; } NewRecord = true; } //now lets fill in our Level Detail Controls for (int i = 0; i < Constant.NumHeroicLevels; i++) { controlName = "SkillPointsInputBox" + (i + 1); skillPointsBox = (TextBox)this.LevelDetailsPanel.Controls[controlName]; skillPointsBox.Text = ModelofRaceDetail[i].BonusSkillPoints.ToString(); controlName = "BonusFeatChoiceCombo" + (i + 1); bonusFeatChoiceBox = (ComboBox)this.LevelDetailsPanel.Controls[controlName]; bonusFeatChoiceBox.SelectedItem = FeatTypeModel.GetNameFromId(ModelofRaceDetail[i].FeatTypeId); } }
private void PopulateFields(string recordName) { bool bitFlag; Model = new SpellModel(); DetailModel = new List <SpellDetailsModel>(); if (recordName != string.Empty) { Model.Initialize(recordName); DetailModel = SpellDetailsModel.GetAll(Model.Id); } //basic fields SpellNameInputBox.Text = Model.SpellName; SpellSchoolComboBox.SelectedItem = SpellSchoolModel.GetNameFromId(Model.SpellSchoolId); SpellIconInputBox.Text = Model.IconFilename; DescriptionPreview.Navigate("about:blank"); DescriptionPreview.Document.OpenNew(false); DescriptionPreview.Document.Write(Model.Description); DescriptionPreview.Refresh(); RangeInputComboBox.SelectedItem = Model.SpellRange; for (int i = 0; i < ComponentCheckListBox.Items.Count; i++) { bitFlag = ((Model.SpellComponents & (1 << i)) > 0); ComponentCheckListBox.SetItemChecked(i, bitFlag); } for (int i = 0; i < MetamagicFeatCheckListBox.Items.Count; i++) { bitFlag = ((Model.MetamagicFeats & (1 << i)) > 0); MetamagicFeatCheckListBox.SetItemChecked(i, bitFlag); } for (int i = 0; i < TargetCheckListBox.Items.Count; i++) { bitFlag = ((Model.Targets & (1 << i)) > 0); TargetCheckListBox.SetItemChecked(i, bitFlag); } DurationInputTextBox.Text = Model.Duration; SavingThrowComboBox.SelectedItem = Model.SavingThrow; if (Model.SpellResistance == true) { SpellResistanceComboBox.SelectedItem = "Yes"; } else { SpellResistanceComboBox.SelectedItem = "No"; } ModDateLabel.Text = Model.LastUpdatedDate.ToString(); ModVersionLabel.Text = Model.LastUpdatedVersion; RecordGUIDLabel.Text = Model.Id.ToString(); //the icon SpellIcon = new IconClass("Spells\\" + Model.IconFilename); SpellIcon.SetLocation(this.Width, this.Height, IconLocation); //the spell detail panel //Delete/Remove Current Controls for (int i = 0; i < SpellDetailSubPanel.Controls.Count; i++) { SpellDetailSubPanel.Controls[i].Dispose(); } SpellDetailSubPanel.Controls.Clear(); SpellDetailClassComboBox.Clear(); SpellDetailLevelComboBox.Clear(); SpellDetailCoolDownTextBox.Clear(); SpellDetailSPCostUpDownBox.Clear(); SpellDetailDeleteButton.Clear(); //reload the panel SpellDetailRecordCount = 0; foreach (SpellDetailsModel detail in DetailModel) { AddSpellDetailRecordUI(detail); } DatabaseName = Model.SpellName; //invalidate the screen to make sure everything gets updated (icon, etc). Invalidate(); }