public void ControClick(object sender, EventArgs e) { if (sender is ICogEngineWinControl) { ICogEngineWinControl winControl = (ICogEngineWinControl)sender; CarregarDetalhe(winControl); CboUpdate.SelectedValue = winControl.IDScript; } else { MessageBox.Show("O tipo do objeto para a operação não era o esperado", "CogEngine - Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CboUpdate_SelectedIndexChanged(object sender, EventArgs e) { if (PropertyControl.SelectedObject is ICogEngineWinControl) { ICogEngineWinControl control = (ICogEngineWinControl)PropertyControl.SelectedObject; if (CboUpdate.SelectedItem is Script) { control.IDScript = ((Script)CboUpdate.SelectedItem).ID; } else { control.IDScript = null; } } }
private void AtrelarScript(ICogEngineWinControl control, XmlNode node) { if (control.IDScript != null) { Script s = _Jogo.ListaScripts.FirstOrDefault(scpt => scpt.ID == control.IDScript); if (s != null) { string dll = GerarDll(s); XmlNode nodeScript = node.OwnerDocument.CreateNode(XmlNodeType.Element, "Script", ""); XmlAttribute attribute = node.OwnerDocument.CreateAttribute("Assembly"); attribute.Value = dll; nodeScript.Attributes.Append(attribute); attribute = node.OwnerDocument.CreateAttribute("Namespace"); nodeScript.Attributes.Append(attribute); node.AppendChild(nodeScript); } } }
public void CarregarDetalhe(object objeto) { PropertyControl.SelectedObject = objeto; PropertyControl.BrowsableAttributes = new AttributeCollection( new Attribute[] { new CategoryAttribute("Misc"), new BrowsableAttribute(true) } ); if (objeto is ICogEngineWinControl) { ICogEngineWinControl winControl = (ICogEngineWinControl)objeto; if (winControl.IDScript == null) { CboUpdate.SelectedItem = VAZIO; } else { CboUpdate.SelectedItem = RetornarScript(winControl.IDScript); } } }