Ejemplo n.º 1
0
        private void AccionNotificacion(List <string> CustomData)
        {
            Xamarin.Essentials.MainThread.BeginInvokeOnMainThread(async() =>
            {
                int id_user, id_comment, id_post;
                id_user         = 1;
                id_comment      = 1;
                id_post         = 1;
                string gotoPage = String.Empty;
                Dictionary <string, string> dic = new Dictionary <string, string>();
                foreach (var item in CustomData)
                {
                    var data = item.Split(",");
                    dic.Add(data[0], data[1]);
                }
                try
                {
                    gotoPage = dic[PushConstantes.gotoPage];
                }
                catch (Exception) { }
                try
                {
                    id_comment = Convert.ToInt32(dic[PushConstantes.id_comentario]);
                }
                catch (Exception) { }
                try
                {
                    id_user = Convert.ToInt32(dic[PushConstantes.id_user]);
                }
                catch (Exception) { }
                try
                {
                    id_post = Convert.ToInt32(dic[PushConstantes.id_post]);
                }
                catch (Exception) { }

                if (gotoPage == PushConstantes.goto_post)
                {
                    await App.Current.MainPage.Navigation.PushAsync(new Views.Post(new ViewModels.PostViewModel(id_post), id_user));
                }
                else if (gotoPage == PushConstantes.goto_profile)
                {
                    var perfil             = await RestAPI.GetOtherUserrofile(id_user, Singleton.Instance.User.id_user).ConfigureAwait(false);
                    perfil.UserProfile.img = String.IsNullOrEmpty(perfil.UserProfile.img)
                                            ? DLL.constantes.ProfileImageError
                                            : DLL.constantes.urlImages + perfil.UserProfile.img;
                    await App.Current.MainPage.Navigation.PushAsync(new Views.SellerProfile(perfil.UserProfile)).ConfigureAwait(false);
                }
            });
        }