private void buttonSetTag_Click(object sender, EventArgs e) { if (_map_scene.GetSelectedObject() == null) return; String objID = _map_scene.GetSelectedObject().ObjectID; if (objID == "") return; TextboxDialog dlg = new TextboxDialog("Change Asset Tag", "Enter the new Tag for this asset", textBoxUnitTag.Text); String newTag = dlg.ShowDialog(this); if (newTag != textBoxUnitTag.Text) { //send tag _Controller.ChangeTagRequest(DDD_Global.Instance.PlayerID, objID, newTag); } /* string prevTag = string.Empty; ((TextBox)sender).Parent.Focus(); bool encounteredError = false; if (_map_scene == null) { Console.WriteLine("In buttonTagObject_Click: Current Scene is null"); encounteredError = true; } if (!encounteredError) { DDDObjects obj = _map_scene.GetSelectedObject(); if (obj == null) { Console.WriteLine("In buttonTagObject_Click: Selected object is null"); encounteredError = true; } if (!encounteredError) { string selectedObjectID = obj.ObjectID; prevTag = obj.Tag; string newTag = ((TextBox)sender).Text; if (newTag == prevTag) { encounteredError = true; } else { _map_scene.ChangeTagRequest(DDD_Global.Instance.PlayerID, selectedObjectID, newTag); } } } if (encounteredError) { ((TextBox)sender).Text = prevTag; } */ }
private void buttonTagObject_Click(object sender, EventArgs e) { if (_map_scene == null) { Console.WriteLine("In buttonTagObject_Click: Current Scene is null"); return; } DDDObjects obj = _map_scene.GetSelectedObject(); if (obj == null) { Console.WriteLine("In buttonTagObject_Click: Selected object is null"); return; } string selectedObjectID = obj.ObjectID; string prevTag = obj.Tag; string newTag; TextboxDialog tbDlg = new TextboxDialog("Edit unit tag information", "Enter the unit's new tag information below. This will be displayed to your team mates.", prevTag); newTag = tbDlg.ShowDialog(this); if (newTag == prevTag) { return; } _map_scene.ChangeTagRequest(DDD_Global.Instance.PlayerID, selectedObjectID, newTag); }