public void AddCallbackToCallbacksDictionary(IUserCallback callback, IUserName request, Dictionary <IUserCallback, string> callbacksByUserName)
 {
     if (!callbacksByUserName.ContainsKey(callback))
     {//from now on, this user will know each time other user is loged in
         callbacksByUserName.Add(callback, request.UserName);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     iUserNamelGV = new MUserName();
     if (!IsPostBack)
     {
         this.lblError.Visible = false;
     }
 }
 internal Message(IUserName userName, IDate date, int time1 = 9, int time2 = 13, int time3 = 18)
 {
     this._userName = userName;
     this._date     = date;
     this._time1    = time1;
     this._time2    = time2;
     this._time3    = time3;
 }
        protected void LoadDataGridView()
        {
            this.IUNGV = new MUserName();

            List <UserLogin> UT = IUNGV.UserNameList();

            this.dgvUsers.DataSource = UT;
            this.dgvUsers.DataBind();
        }
 //ctor:
 public ChatWindowViewModel(IUserName chosenContact)
 {
     ChosenContact = chosenContact;
     //init proxies:
     ChatServiceProxy = ChatServiceProxy.Instance;
     ChatServiceProxy.OnMessageSentEvent += ChatServiceProxy_OnMessageSentEvent;
     //init commands:
     SendMessageCommand = new MyCommand(SendMessage); //sendMessageRequest
 }
        public static bool CheckIfUserIsPlaying(string userName)
        {
            IUserName user = UsersStateInfo.Instance.AlreadyPlaying
                             .Where(u => u.UserName == userName).FirstOrDefault();

            if (user == null)
            {
                return(false);
            }
            return(true);
        }
        protected void dgvProducts_SelectedIndexChanged(object sender, EventArgs e)
        {
            String userName = this.dgvUsers.SelectedDataKey.Value.ToString();

            this.IUNGV = new MUserName();

            UserLogin auxUser = IUNGV.GetUserName(userName);

            this.txtUserName.Text          = auxUser.Username;
            this.txtName.Text              = auxUser.Name;
            this.sltUserType.SelectedIndex = auxUser.UserType - 1;
            this.txtLastName.Text          = auxUser.LastName;
        }
        private static bool IsUsernameValid(IUserName userNameContact, string text)
        {
            if (text.Length >= Constants.UsernameMinLength)
            {
                if (userNameContact != null)
                {
                    var userName = userNameContact.UserName != null?userNameContact.UserName.ToString() : string.Empty;

                    if (userName.StartsWith(text.TrimStart('@'), StringComparison.OrdinalIgnoreCase))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.txtPassword.Text != "" && this.txtConfirmPassword.Text != "")
            {
                if (this.txtPassword.Text == this.txtConfirmPassword.Text)
                {
                    this.IUNGV = new MUserName();
                    UserLogin auxUser = new UserLogin();

                    auxUser.Username = this.txtUserName.Text;
                    auxUser.Name     = this.txtName.Text;
                    auxUser.LastName = this.txtLastName.Text;
                    auxUser.UserType = this.sltUserType.SelectedIndex + 1;
                    auxUser.Pass     = this.txtPassword.Text;

                    IUNGV.AddUserName(auxUser);
                    this.LoadDataGridView();
                }
            }
        }
Beispiel #10
0
 public GameWindowViewModel(IUserName chosenContact)
 {
     //get opponent:
     ChosenContact = chosenContact;
     //init Game:
     gameManager                  = new GameManager("hen", "simon");
     gameManager.GameChanged     += GameManager_OnGameChanged;
     gameManager.Game.StepsEnded += Game_OnStepsEnded;
     //init proxies:
     GameServiceProxy = GameServiceProxy.Instance;
     GameServiceProxy.OnInGameEvent += GameServiceProxy_OnInGame;
     //init UI Slots:
     RefreshGameUI();
     cubesSteps = new ObservableCollection <Step>(gameManager.Game.Steps);
     ConsoleLog = new ConsoleLog();
     //chosenSlotInit:
     onChosenSlotChanged += slotClicked;
     //init Commands:
     RollCubesCommand = new MyCommand(RollCubes);
 }