private void ChatBox_Load(Control sender) { GameID = int.Parse(this.UserQuery["GameRoomID"]); if (((Variable)GetControlByID("theUsername")).Value == "") { if (Session.ContainsKey("LoggedInUser")) ((Variable)GetControlByID("theUsername")).Value = ((myUser)Session["LoggedInUser"]).UserName; else ((Variable)GetControlByID("theUsername")).Value = "Foobar" + DSTDControls.myHelper.RANDOM(0, 200); } if (!IsPostBack) { int lines = myChatLine.GetChatLinesByGameRoomID__Count(GameID); if (Session.ContainsKey("LineNumber")) Session["LineNumber"] = lines; else Session.Add("LineNumber",lines); getMessage(GetControlByID("theChat")); } }
public void buttonClick(Control sender) { ((Button)sender).label = ((Variable)GetControlByID("WhosTurn")).Value; Color color = Color.FromArgb(myHelper.RANDOM(0, 255), myHelper.RANDOM(0, 255), myHelper.RANDOM(0, 255)); sender.GetPanel.Style = "float:left;background-color:#" + color.Name.Substring(0, 6) + ";"; ((Button)sender).Enabled = false; handleSwitch(); if (checkHandle()) { Button[][] b = new Button[3][]; string[] str1 = new[] { "top", "middle", "bottom" }; string[] str2 = new[] { "left", "middle", "right" }; int i = 0; foreach (string s1 in str1) { int a = 0; b[i] = new Button[3]; foreach (string s2 in str2) { b[i][a] = (Button)GetControlByID(s1 + s2); a++; } i++; } for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { b[j][k].label = "_"; b[j][k].Enabled = true; } } } }
void LoginUser(Control sender) { string username = ((TextBox) this.GetControlByID("theUsername")).text; string password = ((TextBox) this.GetControlByID("thePassword")).text; myUser u = new myUser(); if (u.GetUserByUserName(username)) { if (u.Password != password) { ((Label) this.GetControlByID("theError")).text = "The password was incorrect"; return; } } else { u.UserName = username; u.Password = password; u.InsertData(); } setUsername(u); myGameRoom g = new myGameRoom(); if (!g.GetGameRoomByGameRoomName("Home")) { g.GameRoomName = "Home"; g.InsertData(); } g.AddUser_(u); this.Page.Request.TransferToPage("Chat*GameRoomID="+g.GameRoomID); }
void t_OnFire(Control sender) { Children.Clear(); foreach (GrabVariable foobar in foobars) { GrabVariableReturn v = foobar(this); Children.Add(new Label(v.Name + " ")); Children.Add(new Label(v.Value.ToString())); Children.Add(new BR()); } Children.Add(new BR()); Children.Add(new BR()); Children.Add(new BR()); foreach (GrabVariableReturn v in vars) { Children.Add(new Label(v.Name + " ")); Children.Add(new Label(v.Value.ToString())); Children.Add(new BR()); } Timer t = new Timer(); t.Time = 900; t.Where = "theDebugger"; t.id = "debuggerTimer"; t.OnFire += new TriggeredEvent(t_OnFire); this.Children.Add(t); }
public void getUsers(Control sender) { myGameRoom room = new myGameRoom(GameID); foreach (myUser s in room.Users) { sender.GetPanel.Children.Add(new Label(s.UserName)); sender.GetPanel.Children.Add(new BR()); } }
void b_OnClick(Control sender) { if (((Button)sender).label == "New") { ((Panel)GetControlByID("theNewGame")).Visible = true; return; } string s = ((Button)sender).label; myGameRoom g = moveGames(s); this.Page.Request.TransferToPage("Chat*GameRoomID=" + g.GameRoomID); }
public void SendMessage(Control sender) { myChatLine c = new myChatLine(); c.GameRoomID=GameID; c.TimePosted = DateTime.Now; c.ChatLineContent = ((Variable) GetControlByID("theUsername")).Value + ": " +((TextBox) GetControlByID("theChatText")).text + "\r\n"; c.UserID = ((myUser) Session["LoggedInUser"]).UserID; c.InsertData(); getMessage(this); ((TextBox) GetControlByID("theChatText")).text = ""; SelectedControl = "theChatText"; }
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 void getMessage(Control sender) { int c = myChatLine.GetChatLinesByGameRoomID__Count(GameID); if (c != (int) Session["LineNumber"]) { // ((TextBox) GetControlByID("theChatContent")).text = ""; int i = 0; foreach (myChatLine line in myChatLine.GetChatLineByGameRoomID(GameID)) { if (i >= (int)Session["LineNumber"]) { ((TextBox) GetControlByID("theChatContent")).text += line.ChatLineContent; } i++; } Session["LineNumber"] = c; } }
void getGames(Control sender) { Panel that = ((Panel)GetControlByID("theGameList")); that.Children.Clear(); Timer t = new Timer(); t.Time = 1200; t.OnFire += getGames; t.Where = "theGameList"; t.id = "time_2"; that.Children.Add(t); if (isHome) { Button b = new Button(); b.label = "New"; b.Where = ID; b.id = "theGameClick0"; int i = 1; b.OnClick += new TriggeredEvent(b_OnClick); that.Children.Add(b); that.Children.Add(new BR()); foreach (myGameRoom gm in myGameRoom.GetAllGameRoom()) { b = new Button(); if (gm.GameRoomName == "Home") continue; b.label = gm.GameRoomName; b.id = "theGameClick" + i; b.Where = ID; b.OnClick += new TriggeredEvent(b_OnClick); that.Children.Add(b); that.Children.Add(new BR()); i++; } } else { Button b = new Button(); b.label = "Leave"; b.Where = ID; b.id = "theGameClick0"; int i = 1; b.OnClick += new TriggeredEvent(b_OnClick); that.Children.Add(b); } }
void aTicTac_Init(Control sender) { Button[][] b = new Button[3][]; string[] str1 = new[] { "top", "middle", "bottom" }; string[] str2 = new[] { "left", "middle", "right" }; int i = 0; foreach (string s1 in str1) { int a = 0; b[i] = new Button[3]; foreach (string s2 in str2) { b[i][a] = (Button)GetControlByID(s1 + s2); b[i][a].Where = this.ID; a++; } i++; } ((Timer)GetControlByID("someTimer")).Where = this.ID; ((Timer) GetControlByID("someTimer")).Time = myHelper.RANDOM(5,50); }
void Game_Load(Control sender) { myUser u; if (Session.ContainsKey("LoggedInUser")) u = ((myUser)Session["LoggedInUser"]); else return; int roomID = 0; if (this.UserQuery.ContainsKey("GameRoomID")) { roomID = int.Parse(this.UserQuery["GameRoomID"]); } myGameRoom r = new myGameRoom(roomID); foreach (myUser user in r.Users) { this.Children.Add(new Label(user.UserName)); this.Children.Add(new BR()); } }
private void Users_Load(Control sender) { GameID = int.Parse(this.UserQuery["GameRoomID"]); if (!IsPostBack || sender.PanelToUpdate.Split('_')[sender.PanelToUpdate.Split('_').Length-1] == "theChat") { getUsers(GetControlByID("theUsers")); } }
private void Chat_UnLoad(Control sender) { myGameRoom g = new myGameRoom(GameID); ((myUser)Session["LoggedInUser"]).DeleteGameRoom(g.GameRoomID); }
void Chat_Load(Control sender) { }
public void Compute(Control sender) { Session["CurrentClick"] = int.Parse(int.Parse(((Button)sender).label)+(((int)Session["CurrentClick"]) == 0 ? "" : Session["CurrentClick"].ToString())); ((TextBox)GetControlByID("result")).text = Session["CurrentClick"].ToString(); }
private void theGameList_Init(Control sender) { GameID = int.Parse(this.Page.UserQuery["GameRoomID"]); myGameRoom g = new myGameRoom(); g.GetGameRoomByGameRoomName("Home"); if (g.GameRoomID == GameID) isHome = true; //if (!Page.IsPostBack) getGames(sender); }
private GrabVariableReturn getUserName(Control sender) { return new GrabVariableReturn("Username", ((TextBox)this.GetControlByID("theUsername")).text); }
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 Game_Init(Control sender) { }
public void Calc(Control sender) { int val = (int)Session["CurrentValue"]; int val2 = (int)Session["CurrentClick"]; sign s; if (((Button)sender).label == "+") s = sign.plus; else if (((Button)sender).label == "-") s = sign.minus; else if (((Button)sender).label == "*") s = sign.multipy; else if (((Button)sender).label == "=") s = sign.equal; else return; if (s!=sign.equal) Session["LastSign"] = s; switch (s) { case sign.plus: val += val2; break; case sign.minus: val -= val2; break; case sign.multipy: if (((int)Session["CurrentValue"])==0) val2 = 1; val *= val2; break; case sign.equal: val2 = int.Parse(((TextBox)GetControlByID("result")).text); if (Session["LastSign"]==null) return; switch ((sign)Session["LastSign"]) { case sign.plus: val += val2; break; case sign.minus: val -= val2; break; case sign.multipy: val *= val2; break; default: throw new ArgumentOutOfRangeException(); } Session["CurrentClick"] = val; Session["LastSign"] = null; break; default: throw new ArgumentOutOfRangeException(); } Session["CurrentValue"] = val; Session["CurrentClick"] = 0; ((TextBox)GetControlByID("result")).text = val.ToString(); if (val==5) { Request.TransferToPage("Home2"); } }
void Calculator_Load(Control sender) { if (!Session.ContainsKey("CurrentValue")) Session.Add("CurrentValue", 0); if (!Session.ContainsKey("CurrentClick")) Session.Add("CurrentClick", 0); if (!Session.ContainsKey("LastSign")) Session.Add("LastSign", null); }
void Calculator_Init(Control sender) { }
void GamesOpen_Load(Control sender) { }
void GamesOpen_Init(Control sender) { }
void Home_Load(Control sender) { bugger.PushVariable(new GrabVariableReturn("Something", "Init")); }
void Chat_Init(Control sender) { ((TextBox)GetControlByID("theChatContent")).Enabled = false; }
public void Clear(Control sender) { Session["CurrentClick"] = 0; Session["CurrentValue"] = 0; ((TextBox)GetControlByID("result")).text = Session["CurrentClick"].ToString(); }
void aTicTac_Load(Control sender) { }
private GrabVariableReturn getPassword(Control sender) { return new GrabVariableReturn("Password", ((TextBox)this.GetControlByID("thePassword")).text); }