Exemplo n.º 1
0
        async Task <bool> ProccessAction(JObject data)
        {
            try
            {
                var type  = data.GetValue("type");
                var _type = type.ToString();
                switch (_type)
                {
                //case "storage":
                //    var key1 = data.GetValue("key").ToString();
                //    var value1 = data.GetValue("value").ToString();
                //    if (key1 == "loadStatus")
                //    {
                //        homeNotLoaded = value1 != "1";
                //        if (value1=="1")
                //            Device.BeginInvokeOnMainThread(() =>
                //            {
                //                indicator.IsRunning = false;
                //                indicator.IsVisible = false;
                //                gridContainer2.IsVisible = false;
                //                webViewX.IsVisible = true;
                //            });
                //    }
                //    break;
                case "load":
                case "load2":
                    //await DisplayAlert("Question?", "Would you like to play a game", "Yes", "No");
                    break;

                case "currentUrl":

                    var value = data.GetValue("value").ToString();
                    await App.Database.SaveHistoryAsync(new Model.UrlHistory()
                    {
                        date = DateTime.Now,
                        url  = value,
                    });

                    break;

                case "loginData":
                    //                  public int ID { get; set; }
                    //public string userName { get; set; }
                    //public string userTitle { get; set; }
                    //public string userId { get; set; }
                    //public string employeeId { get; set; }
                    //public string roles { get; set; }
                    //public string claims { get; set; }

                    //public string jobGroup { get; set; }
                    var user = new Model.LoggedUser();
                    user.userName   = data.GetValue("userName").ToString();
                    user.userTitle  = data.GetValue("userTitle").ToString();
                    user.userId     = data.GetValue("userId").ToString();
                    user.employeeId = data.GetValue("employeeId").ToString();
                    user.roles      = data.GetValue("roles").ToString();
                    user.claims     = data.GetValue("claims").ToString();
                    user.jobGroup   = data.GetValue("jobGroup").ToString();
                    var id = await App.Database.SaveLoggedUserAsync(user);

                    break;

                case "report":
                    var reportUrl = data.GetValue("value").ToString();
                    var uri       = new Uri(reportUrl);

                    Device.OpenUri(uri);
                    break;

                default:
                    break;
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemplo n.º 2
0
 public Task <int> SaveLoggedUserAsync(Model.LoggedUser loggedUser)
 {
     return(_database.InsertAsync(loggedUser));
 }