Ejemplo n.º 1
0
        public string InsertUser(string user, string macAndUser, string picture, string vertification, string code, string userID, string info)
        {
            try
            {
                StoredUserEntity User = new StoredUserEntity
                {
                    PartitionKey = user,
                    storedMac    = macAndUser,
                    Picture      = picture,
                    Verification = vertification,
                    SecretCode   = code,
                    UserID       = userID,
                    Info         = info
                };

                HttpContent content = new StringContent(JsonConvert.SerializeObject(User));
                content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                HttpResponseMessage response = _client.PostAsync($"Users/Insert", content).Result;
                if (response.IsSuccessStatusCode)
                {
                    var Data = response.Content.ReadAsStringAsync();
                    var res  = Data.Result;
                    return(res);
                }
                else
                {
                    return("ErrorStatusCode: " + response.StatusCode);
                }
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }
Ejemplo n.º 2
0
        public List <StoredUserEntity> GetSpecificUserName(string macAndUser, string code)
        {
            List <StoredUserEntity> _records = new List <StoredUserEntity>();

            HttpResponseMessage response = _client.GetAsync("Users/SpecificUser?macAndUser="******"&secretCode=" + code).Result;

            if (response.IsSuccessStatusCode)
            {
                var Data = response.Content.ReadAsStringAsync();
                List <StoredUserEntity> categories = JsonConvert.DeserializeObject <List <StoredUserEntity> >(Data.Result);
                if (categories != null)
                {
                    foreach (var entity in categories)
                    {
                        var ItemData = new StoredUserEntity
                        {
                            PartitionKey = entity.PartitionKey,
                            storedMac    = entity.storedMac,
                            Picture      = entity.Picture,
                            Verification = entity.Verification,
                            Blocked      = entity.Blocked,
                            UserID       = entity.UserID
                                           //Timestamp = entity.Timestamp.ToLocalTime(),
                        };
                        _records.Add(ItemData);
                    }
                }
                else
                {
                    return(null);
                }
            }
            return(_records);
        }
Ejemplo n.º 3
0
 private void SetPicture(StoredUserEntity storedUser)
 {
     if (File.Exists(path + "\\SecretChat\\ProfilePictures\\" + storedUser.UserID + ".png"))
     {
         BitmapImage image = new BitmapImage(new Uri(path + "\\SecretChat\\ProfilePictures\\" + storedUser.UserID + ".png"));
         ProfilePicture.ImageSource = image;
     }
     else
     {
         BitmapImage image = new BitmapImage(new Uri(path + "\\SecretChat\\ProfilePictures\\default.png"));
         ProfilePicture.ImageSource = image;
     }
 }
Ejemplo n.º 4
0
 public UserProfileWindow(StoredUserEntity storedUser, Window darkwindow, MainWindow mainWindow)
 {
     DarkWindow = darkwindow;
     MainWindow = mainWindow;
     InitializeComponent();
     ShowInTaskbar  = false;
     NameBlock.Text = storedUser.PartitionKey;
     SetPicture(storedUser);
     Info.Text = storedUser.Info;
     if (Info.Text.Length < 1)
     {
         Info.Text = "Keine Info angegeben.";
     }
     CenterWindowOnScreen();
 }