예제 #1
0
        public async void SetSpeakerDetail(ServerSpeaker speaker, SpeakerTemplate parentSpeaker)
        {
            await((HomeLayout)App.Current.MainPage).SetLoading(true, "loading speaker...");
            currentSpeaker = speaker;
            speakerTemp    = parentSpeaker;
            VcardContact c_user = new VcardContact();

            c_user.FirstName   = currentSpeaker.speakerFirstName;
            c_user.LastName    = currentSpeaker.speakerLastName;
            c_user.company     = currentSpeaker.speakerCompany;
            c_user.phoneNumber = currentSpeaker.speakerPhone;
            c_user.email       = currentSpeaker.speakerEmail;
            App.contactuser    = c_user;
            if (speaker != null)
            {
                CheckSocialVisiblilty();
                if (!string.IsNullOrEmpty(speaker.speakerFirstName) || !string.IsNullOrEmpty(speaker.speakerLastName))
                {
                    speakerFullNameText.Text = speaker.speakerFirstName + " " + speaker.speakerLastName;
                }
                else
                {
                    speakerFullNameText.Text = "";
                }
                if (!string.IsNullOrEmpty(speaker.speakerPosition))
                {
                    positionText.Text = speaker.speakerPosition;
                }
                else
                {
                    positionText.Text = "";
                }
                if (!string.IsNullOrEmpty(speaker.speakerCompany))
                {
                    companyText.Text = speaker.speakerCompany;
                }
                else
                {
                    companyText.Text = "";
                }
                if (!string.IsNullOrEmpty(speaker.speakerImage))
                {
                    speakerIcon.Source = speaker.speakerImage;
                    Regex  initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?");
                    string init     = initials.Replace(speaker.speakerFirstName + " " + speaker.speakerLastName, "$1");
                    if (init.Length > 3)
                    {
                        init = init.Substring(0, 3);
                    }
                    logoText.Text = init.ToUpper();
                }
                else
                {
                    speakerIcon.Source = "";
                    Regex  initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?");
                    string init     = initials.Replace(speaker.speakerFirstName + " " + speaker.speakerLastName, "$1");
                    if (init.Length > 3)
                    {
                        init = init.Substring(0, 3);
                    }
                    logoText.Text = init.ToUpper();
                }
            }
            if (((HomeLayout)App.Current.MainPage).bookmarksPage != null)
            {
                if (!((HomeLayout)App.Current.MainPage).bookmarksPage.IsVisible)
                {
                    CreateSessionList(await BaseFunctions.GetSpeakerCurrentEventSessions(((HomeLayout)App.Current.MainPage).GetCurrentDomainEvent().sessionList, speaker.speakerID));
                }
                else
                {
                    CreateSessionList(await App.serverData.GetSpeakerAllEventsSessions(speaker.speakerID));
                }
            }
            else
            {
                CreateSessionList(await BaseFunctions.GetSpeakerCurrentEventSessions(((HomeLayout)App.Current.MainPage).GetCurrentDomainEvent().sessionList, speaker.speakerID));
            }
            CheckBookmark(App.serverData.mei_user.currentUser.userBookmarks.isBookmarked(currentSpeaker));
            await Task.Delay(1000);

            await((HomeLayout)App.Current.MainPage).SetLoading(false, "");
        }