private void Fooabr(Control sender) { ((Button)sender.GetControlByID(Sender)).label = ((Variable)sender.GetControlByID("WhosTurn")).Value; if (((Variable)sender.GetControlByID("WhosTurn")).Value == "X") { ((Variable)sender.GetControlByID("WhosTurn")).Value = "O"; } else ((Variable)sender.GetControlByID("WhosTurn")).Value = "X"; }
public void RandomClick(Control sender) { string[] str1 = new[] { "top", "middle", "bottom" }; string[] str2 = new[] { "left", "middle", "right" }; int i1 = myHelper.RANDOM(0, 3); int i2 = myHelper.RANDOM(0, 3); if (!((Button)sender.GetControlByID(str1[i1] + str2[i2])).Enabled) { RandomClick(sender); return; } ((Button)sender.GetControlByID(str1[i1] + str2[i2])).Click(); }
public static string GetIDFromid(Control p, string where) { Control n = p.GetControlByID(where); if (n != null) { if (n.id == where) { return n.ID; } } return where; }
void InformationToSend_Load(Control sender) { if (!Page.IsPostBack) { ((Variable)sender.GetControlByID("WhosTurn")).Value = "X"; } else { if (!string.IsNullOrEmpty(Sender)) { if (Sender.Contains("clicktimer")) { string[] str1 = new[] { "top", "middle", "bottom" }; string[] str2 = new[] { "left", "middle", "right" }; int i1 = myHelper.RANDOM(0, 3); int i2 = myHelper.RANDOM(0, 3); ((Button)sender.GetControlByID(str1[i1] + str2[i2])).label = ((Variable)sender.GetControlByID("WhosTurn")).Value; } else ((Button)sender.GetControlByID(Sender)).label = ((Variable)sender.GetControlByID("WhosTurn")).Value; if (((Variable)sender.GetControlByID("WhosTurn")).Value == "X") { ((Variable)sender.GetControlByID("WhosTurn")).Value = "O"; } else ((Variable)sender.GetControlByID("WhosTurn")).Value = "X"; } } }