Exemplo n.º 1
0
        private void NewRoomOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
        {
            var room = (BuildingRoom)sender;

            if (m_Rooms.Count(r => r.Name == room.Name) > 1)
            {
                room.Name = room.Name + " (duplicate)";
            }
        }
Exemplo n.º 2
0
        public void addPublicRoom(Room room)
        {
            BindableCollection <SelectableRoom> roomAlreadyExists = new BindableCollection <SelectableRoom>(this.selectablePublicRooms.Where(x => x.id == room.id));

            if (roomAlreadyExists.Count() == 0)
            {
                selectablePublicRooms.Add(new SelectableRoom(room));
            }
        }
Exemplo n.º 3
0
        public Dictionary <string, string> theMap()
        {
            IEnumerable <SelectableRoom>        enumSR = _selectableJoinedRooms.Where(x => x.room.id == "General");
            BindableCollection <SelectableRoom> sRs    = new BindableCollection <SelectableRoom>(enumSR);

            if (sRs.Count() != 1)
            {
                Console.WriteLine("il exite un doublon de general dans les rooms jointes");
            }
            return(sRs[0].room.avatars);
        }
        //public async Task LoadItemsAsync()
        //{
        //    Departments = new BindableCollection<DepartmentModel>(await _companyAccess.Departments(CurrentCompany));
        //    //Departments.CollectionChanged += HandleItemChange;

        //    NotifyOfPropertyChange(() => Departments);
        //}

        public async Task LoadWorkPeriods()
        {
            Debug.WriteLine("Loading departments...");
            //WorkPeriods = new BindableCollection<WorkPeriodModel>(await _companyAccess.FetchWorkPeriodsAsync(SelectedDepartment));
            var workPeriods = await _companyAccess.FetchWorkPeriodsAsync(SelectedDepartment);

            var users = workPeriods.SelectMany(wp => wp.AssignedUsers);

            WorkPeriods = new BindableCollection <UserModel>(users);
            Debug.WriteLine($"Loaded {WorkPeriods.Count()} departments.");
            NotifyOfPropertyChange(() => Departments);
            NotifyOfPropertyChange(() => WorkPeriods);
        }
Exemplo n.º 5
0
 public profileViewModel(IUserData userdata, IEventAggregator events, ISocketHandler socketHandler)
 {
     _userData = userdata;
     _events   = events;
     _events.Subscribe(this);
     _socketHandler   = socketHandler;
     this.statsClient = JsonConvert.DeserializeObject <StatsClient>(this._socketHandler.TestGETWebRequest("/profile/stats/" + this._userData.userName).ToString());
     _avatars         = new BindableCollection <Avatar>();
     fillAvatars();
     nbAvatars            = _avatars.Count();
     _selectedAvatarIndex = 0;
     _initialPP           = JsonConvert.DeserializeObject <PrivateProfile>(socketHandler.TestGETWebRequest("/profile/private/" + userdata.userName).ToString());
     _newlPP = new PrivateProfile(_initialPP.firstname, _initialPP.firstname,
                                  _initialPP.lastname, _initialPP.password, _initialPP.avatar);
 }
Exemplo n.º 6
0
        public void addModifiedProfile(PublicProfile profile)
        {
            if (profile.username == _userName)
            {
                _avatarName = profile.avatar;
            }

            IEnumerable <SelectableRoom>        enumSR = _selectableJoinedRooms.Where(x => x.id == "General");
            BindableCollection <SelectableRoom> sRs    = new BindableCollection <SelectableRoom>(enumSR);

            if (sRs.Count() != 1)
            {
                Console.WriteLine("il exite un doublon de general dans les rooms jointes");
            }

            _selectableJoinedRooms[_selectableJoinedRooms.IndexOf(sRs[0])].room.avatars[profile.username] = profile.avatar;
            _selectableJoinedRooms.Refresh();
        }
Exemplo n.º 7
0
        public void addJoinedRoom(Room room, Boolean isPrivate)
        {
            BindableCollection <SelectableRoom> roomAlreadyExists = new BindableCollection <SelectableRoom>(this.selectableJoinedRooms.Where(x => x.id == room.id));

            if (roomAlreadyExists.Count() == 0)
            {
                SelectableRoom sR = new SelectableRoom(room);
                foreach (Message m in sR.room.messages)
                {
                    string MessageAvatarName = "";
                    try { MessageAvatarName = theMap()[m.senderName]; }
                    catch { }
                    if (m.senderName == "Admin")
                    {
                        MessageAvatarName = "ADMIN";
                    }
                    m.avatarSource = getAvatarSource(MessageAvatarName);
                }
                sR.isPrivate = isPrivate;
                selectableJoinedRooms.Add(sR);
            }
        }
Exemplo n.º 8
0
 int GetActiveTaskCount()
 {
     return(_archivedTasks.Count(x => x.Status == PhotoUploadStatus.Uploading || x.Status == PhotoUploadStatus.Completing));
 }