protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && !IsCallback) { service = new BJServiceRef.ServiceClient(new InstanceContext(new emptyCallback()),"HttpBinding"); } if (Session["user"] == null) Server.Transfer("~/Default.aspx"); currentUser = (UserWcf)Session["user"]; if (!Page.IsCallback && !Page.IsPostBack) { selectedUser = currentUser; if (currentUser.isAdmin) { users = service.getUsers(); rbl_users.DataSource = users; rbl_users.DataTextField = "Username"; rbl_users.DataValueField = "Username"; rbl_users.DataBind(); Session["userlist"] = users; } populateFields(); } if (Page.IsPostBack) { txt_username.Text = selectedUser.Username; selectedUser.money = int.Parse(txt_money.Text); selectedUser.numOfGames = int.Parse(txt_num_of_games.Text); selectedUser.isAdmin = chk_admin.Checked; } }
public GameScreen(UserWcf me, String IP) { InitializeComponent(); this.me = me; Connect(IP); myCards = new List<Card>(); dealerCards = new List<Card>(); service = new ServiceClient(new InstanceContext(new emptyCallback()), "HttpBinding"); }
/// <summary> /// Function for using in a delegate for the Threaded login function with the callback /// required since the thread of the service cannot directly update the UI thread /// </summary> /// <param name="user"></param> public void loginCallback(UserWcf user) { me = user; if (me == null) { this.Invoke(rejectDelegate); } else { this.Invoke(continueDelegate); } }
public GameChooser(UserWcf user) { InitializeComponent(); service = new ServiceClient(new InstanceContext(this),"HttpBinding"); me = user; GameWcf[] list = service.GetGames(); if (list.Count<GameWcf>() != 0) { games.AddRange(list); } lstb_games.DataSource = games; lstb_games.DisplayMember = "IP"; }
/// <summary> /// Starting Login with The wcf service using the data from the user /// </summary> private void login() { string username = txt_username.Text; string password = txt_password.Text; //new Thread( () => service.login(username,password)).Start(); // seems there is some problem with the message being lost between the threads btn_login.Enabled = false; me = service.loginWeb(username, password); if (me == null) rejected(); else accepted(); }
protected void Submit_Click(object sender, EventArgs e) { UserWcf u = service.getUser(txt_username.Text); if (u == null) { u = new UserWcf(); u.Username = txt_username.Text; service.addUser(u, txt_password.Attributes["value"]); Response.Redirect("~/Default.aspx"); } else { lbl_warning.Text = "User already exsits"; } }
public void loginCallback(UserWcf user) { }
protected void submit_Click(object sender, EventArgs e) { //basicly there is no real check here i simply send an update request to the webservice UserWcf u = new UserWcf(); u = new UserWcf(); u.Username = txt_username.Text; u.isAdmin = chk_admin.Checked; // again not testing of values i can put here a regex but too tired or use tryparse; u.money = int.Parse(txt_money.Text); u.numOfGames = int.Parse(txt_num_of_games.Text); u.ID = selectedUser.ID; if (service.updateUser(u)) notification.Text = "Updated user " + u.Username; users = service.getUsers(); Session["userlist"] = users; rbl_users.DataBind(); }
protected void rbl_users_SelectedIndexChanged(object sender, EventArgs e) { if (((RadioButtonList)sender).SelectedValue != selectedUser.Username) { notification.Text = ""; if (Session["userlist"] != null) { users = (UserWcf[])Session["userlist"]; selectedUser = users.Single<UserWcf>(x => x.Username == rbl_users.SelectedValue); populateFields(); } } }