Beispiel #1
0
        private void Btn_Clicked(object sender, EventArgs e)
        {
            long now = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;

            if (now - lastRefreshed < 1000)
            {
                return;
            }
            persistantUserData mee      = App.Database.getCurrentNotificationID();
            string             userName = mee.UserName;
            bool   newuse = false;
            Random rnd    = new Random();

            mee.UserName = "******" + rnd.NextDouble().ToString();
            string OsString = Device.RuntimePlatform;

            switch (Device.RuntimePlatform)
            {
            case (Device.iOS): { OsString = "iOS"; break; }

            case (Device.Android): { OsString = "Android"; break; }
            }
            object obj = new {
                login = new {
                    userName = mee.UserName,
                    pwd      = "passw04d1",
                },
                //uuid = mee.userID,
                devices = new object[] { new {
                                             DeviceID = mee.DeviceID,
                                             notificationHubRegistration = mee.DeviceID,
                                             Platform = OsString
                                         } },
            };


            App.Https.Post(App.backend + "/api/Users/create", obj).ContinueWith(async(returned) => {
                dynamic ret = JsonConvert.DeserializeObject(await returned);
                Debug.WriteLine((object)ret);
                Guid thing = new Guid((string)ret.uuid);

                await App.Database.remoteAlerted(thing);
            });
            _ = App.Database.updateUserName(mee.UserName);



            i++;
            //InitializeComponent();
            SetEntriesLayout();
        }
Beispiel #2
0
        private void Btn3_Clicked(object sender, EventArgs e)
        {
            long now = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;

            if (now - lastRefreshed < 1000)
            {
                return;
            }
            persistantUserData mee = App.Database.getCurrentNotificationID();

            App.msger.registerForTagsAsync(new List <string>()
            {
                "HI"
            }, mee.token);
        }
Beispiel #3
0
        private void Btn4_Clicked(object sender, EventArgs e)
        {
            persistantUserData mee = App.Database.getCurrentNotificationID();
            object             obj = new {
                login = new {
                    userName = mee.UserName,
                    pwd      = "passw04d1",
                },
                //uuid = mee.userID,
                devices = new object[] { new {
                                             DeviceID = mee.DeviceID,
                                             notificationHubRegistration = mee.DeviceID,
                                         } },
            };

            App.Https.Post(App.backend + "/api/Users/loin", obj).ContinueWith(async(returned) => {
                dynamic ret = JsonConvert.DeserializeObject(await returned);
                Debug.WriteLine((object)ret);
            });
        }
Beispiel #4
0
        public async void updateCurrrentNotificationID(string id, string token, Guid Deviceid)
        {
            persistantUserData notie = new persistantUserData {
                registeredID = id, token = token, DeviceID = Deviceid, RemoteNeedsUpdated = true
            };

            try {
                var current = getCurrentNotificationID();
                notie.userID   = current.userID;
                notie.UserName = current.UserName;
            }
            catch {
                Debug.WriteLine("no prior user found in db");
            }

            try {
                await database.Table <persistantUserData>().DeleteAsync(x => x != null);
            }
            catch (Exception e) {
                Debug.WriteLine(e);
            }
            await database.InsertAsync(notie);
        }