示例#1
0
        private async Task ExecuteApiAction(bool debug, SampleDataItem item)
        {
            Model.ApiResponse = null;

            string requiredSelectedId = null;

            if (item.RequiresInputComboBox1)
            {
                var selectedItem = (ApiBaseResponse)InputComboBox1.SelectedItem;
                if (selectedItem != null)
                {
                    requiredSelectedId = selectedItem.Id;
                }
                else
                {
                    FlyoutBase.ShowAttachedFlyout(InputComboBox1);
                    return;
                }
            }
            if (item.RequiresInputComboBox2)
            {
                var selectedItem = (ApiBaseResponse)InputComboBox2.SelectedItem;
                if (selectedItem != null)
                {
                    requiredSelectedId = selectedItem.Id;
                }
                else
                {
                    FlyoutBase.ShowAttachedFlyout(InputComboBox2);
                    return;
                }
            }

            string requiredInputText = null;

            if (item.RequiresInputTextBox)
            {
                requiredInputText = InputTextBox.Text;
                if (String.IsNullOrWhiteSpace(requiredInputText) || requiredInputText.Equals("Enter required text here"))
                {
                    FlyoutBase.ShowAttachedFlyout(InputTextBox);
                    return;
                }
            }
            UserData.TimeStamp = DateTime.UtcNow;
            Model.UserData     = UserData;
            Model.ApiResponse  = await SampleDataSource.ExecuteApi(item.UniqueId, debug, requiredSelectedId, requiredInputText, UserData.Provider, UserData.UseBeta);

            Model.AuthUserName = await Auth.GetUserName(UserData.Provider);
        }
        private async Task ExecuteApiAction(bool debug, SampleDataItem item)
        {
            Model.ApiResponse = null;

            string requiredSelectedId = null;

            if (item.RequiresInputComboBox1)
            {
                var selectedItem = (ApiBaseResponse)InputComboBox1.SelectedItem;
                if (selectedItem != null)
                {
                    requiredSelectedId = selectedItem.Id;
                }
                else
                {
                    FlyoutBase.ShowAttachedFlyout(InputComboBox1);
                    return;
                }
            }
            if (item.RequiresInputComboBox2)
            {
                var selectedItem = (ApiBaseResponse)InputComboBox2.SelectedItem;
                if (selectedItem != null)
                {
                    requiredSelectedId = selectedItem.Id;
                }
                else
                {
                    FlyoutBase.ShowAttachedFlyout(InputComboBox2);
                    return;
                }
            }

            string requiredInputText = null;

            if (item.RequiresInputTextBox)
            {
                requiredInputText = InputTextBox.Text;
                if (String.IsNullOrWhiteSpace(requiredInputText) || requiredInputText.Equals("Enter required text here"))
                {
                    FlyoutBase.ShowAttachedFlyout(InputTextBox);
                    return;
                }
            }

            Model.ApiResponse = await SampleDataSource.ExecuteApi(item.UniqueId, debug, requiredSelectedId, requiredInputText);
        }