public static async Task <bool> show_activity(string categId, string auth_token)
        {
            try
            {
                if (search_recyclerView.Visibility == ViewStates.Visible)
                {
                    activityIndicatorSearch.Visibility = ViewStates.Visible;
                }
                if (recyclerView.Visibility == ViewStates.Visible)
                {
                    activityIndicator.Visibility = ViewStates.Visible;
                }
                recyclerView.Visibility        = ViewStates.Gone;
                search_recyclerView.Visibility = ViewStates.Gone;
            }
            catch { }

            var res = await ProfileAndExpertMethods.EditSpecializationStatic(auth_token, categId);

            return(true);
        }
Пример #2
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            try
            {
                SetContentView(Resource.Layout.ThreeLevelUserProfile);

                dialogsTV           = FindViewById <TextView>(Resource.Id.dialogsTV);
                message_indicatorIV = FindViewById <ImageView>(Resource.Id.message_indicatorIV);
                loginRegFragment    = new LoginRegFragment();
                fragmentManager     = this.FragmentManager;
                loc_pref            = Application.Context.GetSharedPreferences("coordinates", FileCreationMode.Private);
                activityIndicator   = FindViewById <ProgressBar>(Resource.Id.activityIndicator);
                activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                ProfileAndExpertMethods profileAndExpertMethods = new ProfileAndExpertMethods();
                PCL.HttpMethods.ProfileAndExpertMethods profileAndExpertMethodsPCL = new PCL.HttpMethods.ProfileAndExpertMethods();
                expert_data = Application.Context.GetSharedPreferences("experts", FileCreationMode.Private);
                edit_expert = expert_data.Edit();

                profileLL        = FindViewById <LinearLayout>(Resource.Id.profileLL);
                dialogsLL        = FindViewById <LinearLayout>(Resource.Id.dialogsLL);
                profileLL.Click += (s, e) =>
                {
                    if (userMethods.UserExists())
                    {
                        StartActivity(typeof(UserProfileActivity));
                    }
                    else
                    {
                        try { loginRegFragment.Show(fragmentManager, "fragmentManager"); }
                        catch { Toast.MakeText(this, GetString(Resource.String.you_not_logined), ToastLength.Short).Show(); StartActivity(typeof(MainActivity)); }
                    }
                };
                dialogsLL.Click += (s, e) =>
                {
                    if (userMethods.UserExists())
                    {
                        edit_dialog = dialog_data.Edit();
                        edit_dialog.PutString("come_from", "Came directly from bottom");
                        edit_dialog.Apply();
                        StartActivity(typeof(ChatListActivity));
                    }
                    else
                    {
                        try { loginRegFragment.Show(fragmentManager, "fragmentManager"); }
                        catch { Toast.MakeText(this, GetString(Resource.String.you_not_logined), ToastLength.Short).Show(); StartActivity(typeof(MainActivity)); }
                    }
                };
                initWidget();
                activityIndicator.Visibility = ViewStates.Visible;
                recyclerView.Visibility      = ViewStates.Gone;
                var expert_json = await profileAndExpertMethodsPCL.ExpertProfile(expert_data.GetString("expert_id", String.Empty), loc_pref.GetString("latitude", String.Empty), loc_pref.GetString("longitude", String.Empty));

                activityIndicator.Visibility = Android.Views.ViewStates.Gone;
                recyclerView.Visibility      = ViewStates.Visible;
                deserialized_expert_profile  = JsonConvert.DeserializeObject <ExpertProfile>(expert_json);
                edit_expert_feedback         = expert_feedback_pref.Edit();
                edit_expert_feedback.PutString("expert_id", deserialized_expert_profile.id);
                edit_expert_feedback.PutString("expert_name", deserialized_expert_profile.fullName);
                edit_expert_feedback.PutString("expert_phone", deserialized_expert_profile.phone);
                edit_expert_feedback.PutBoolean("expert_online", deserialized_expert_profile.online);
                edit_expert_feedback.PutString("expert_avatar", deserialized_expert_profile.avatarUrl);
                try
                {
                    edit_expert_feedback.PutString("expert_category_id", deserialized_expert_profile.serviceCategories[0].categoryId);
                }
                catch { }
                edit_expert_feedback.Apply();
                initData();
            }
            catch (Exception ex)
            {
                StartActivity(typeof(MainActivity));
            }
        }