Пример #1
0
        //Initialize '_proxy'. Requires the users id.
        public EditRole(EngServRef.EngServiceClient tmp, int id) : this()
        {
            _proxy  = tmp;
            this.id = id;
            int roleId = Convert.ToInt32(_proxy.GetItemProperty(id, EngServRef.ServerData.User, EngServRef.PropertyData.Role));

            role = _proxy.GetItemProperty(roleId, EngServRef.ServerData.Role, EngServRef.PropertyData.Name);
            lUsername.Content = _proxy.GetItemProperty(id, EngServRef.ServerData.User, EngServRef.PropertyData.Name);

            List <int> lst = new List <int>(_proxy.GetItems(EngServRef.ServerData.Role));
            int        i   = 0;

            foreach (int item in lst)
            {
                cmbRole.Items.Add(new TextBlock {
                    Text = _proxy.GetItemProperty(item, EngServRef.ServerData.Role, EngServRef.PropertyData.Name), FontSize = 12, Foreground = Brushes.Black
                });
                if (item == roleId)
                {
                    cmbRole.SelectedIndex = i;
                }
                i++;
            }
        }