protected override void OnShowObject(object Object) { this.Obj = Object as StructureTypeObj; Debug.Assert(this.Obj != null); if (Obj.Parent != null) this.linkParent.SourceObject = Obj.Parent as IUIObject; for (int iChild = 0; iChild < Obj.Children.Length; iChild++) this.listChildren.AddObject(Obj.Children[iChild] as IUIObject); }
private void HandlePurchase(StructureTypeObj theObj) { System.Console.WriteLine("Purchased item " + theObj.structurename); StructureObj newStruct = StructureObj.Instantiate(theObj); if (parent.pop.curSector != null) { parent.pop.curSector.structures.Add(newStruct); newStruct.sectorId = parent.pop.curSector.Id; newStruct.ownerId = PhabrikServer.CurrentUser.Id; PhabrikServer.SaveNewStructure(newStruct, (newId) => { View newView = AddStructureToView(newStruct, true); if (newView != null) { isDirty = true; } }); } }
private void OnNewStructureType(object sender, EventArgs e) { StructureTypeObj newTypeObj = new StructureTypeObj(); StructureType newType = new StructureType(newTypeObj); if (newType.ShowPropertiesDialog(this.ParentForm) == DialogResult.OK) { newTypeObj = Store.StructureTypes.Create(newTypeObj); Store.StructureTypes.Save(); Viking.UI.State.SelectedObject = new StructureType(newTypeObj); } }
protected virtual void InitNewData(StructureTypeObj type) { this.Data.DBAction = DBACTION.INSERT; this.Data.ID = StructureStore.GetTempID(); this.Data.TypeID = type.ID; Debug.Assert(type.ID >= 0); this.Data.Notes = ""; this.Data.Tags = new String[0]; this.Data.Confidence = 0.5; }
public StructureType(StructureTypeObj data) { this.modelObj = data; }
protected void ContextMenu_OnNewStructureType(object sender, EventArgs e) { StructureTypeObj newType = new StructureTypeObj(this.modelObj); StructureType newTypeView = new StructureType(newType); DialogResult result = Viking.UI.Forms.PropertySheetForm.ShowDialog(newTypeView, null); if (result != DialogResult.Cancel) { newType = Store.StructureTypes.Create(newType); Store.StructureTypes.Save(); } }