public FlightSafetyReportView(FlightSafetyReportModel obj)
        {
            InitializeComponent();

            if (App.peoplePickerDataSource == null)
            {
                var uss = SPUtility.GetUsersForPicker().Result;
                if (uss == null)
                {
                    return;
                }

                App.peoplePickerDataSource = new List <PeoplePicker>(uss);
            }

            peoplePickerCommander.DataSource = App.peoplePickerDataSource;
            PeoplePickerCommander            = null;

            var selectedItem = App.peoplePickerDataSource.Find(x => { return(Convert.ToString(x.Id) == obj.CommandersEmail); });

            if (selectedItem != null)
            {
                peoplePickerCommander.Text = selectedItem.Name;
                PeoplePickerCommander      = selectedItem;
            }

            peoplePickercrew1email.DataSource = App.peoplePickerDataSource;
            PeoplePickercrew1email            = null;

            var selectedItem1 = App.peoplePickerDataSource.Find(x => { return(Convert.ToString(x.Id) == obj.FlightCrew1); });

            if (selectedItem1 != null)
            {
                peoplePickercrew1email.Text = selectedItem1.Name;
                PeoplePickercrew1email      = selectedItem1;
            }

            peoplePickercrew2email.DataSource = App.peoplePickerDataSource;
            PeoplePickercrew2email            = null;

            var selectedItem2 = App.peoplePickerDataSource.Find(x => { return(Convert.ToString(x.Id) == obj.FlightCrew2); });

            if (selectedItem2 != null)
            {
                peoplePickercrew2email.Text = selectedItem2.Name;
                PeoplePickercrew2email      = selectedItem2;
            }
        }
Exemple #2
0
        public async Task SyncLocalData()
        {
            try
            {
                await OAuthHelper.SyncOfflineItems();

                var users = await SPUtility.GetUsersForPicker();

                if (users != null)
                {
                    App.peoplePickerDataSource = new List <PeoplePicker>(users);
                }
            }
            catch (Exception ex)
            {
                ShowError(string.Format("Unable to sync local info: {0}", ex.Message));
            }
        }