Пример #1
0
        public async Task SeedDataAsync()
        {
            ITrackHandle handle = null;

            try
            {
                //Insights tracking
                handle = Insights.TrackTime("TimeToSyncDB");
                handle.Start();

                await Init();

                await _OrderTable.PullAsync(null, _OrderTable.CreateQuery());

                await _AccountTable.PullAsync(null, _AccountTable.CreateQuery());
            }
            catch (Exception exc)
            {
                Insights.Report(exc, Insights.Severity.Error);
                Debug.WriteLine("ERROR AzureService.SeedData(): " + exc.Message);
            }
            finally
            {
                //Insights
                if (handle != null)
                {
                    handle.Stop();
                }
            }
        }
Пример #2
0
 public override void ViewDidDisappear(bool animated)
 {
     base.ViewDidDisappear(animated);
     if (trackerHandle != null)
     {
         trackerHandle.Stop();
         trackerHandle = null;
     }
 }
        public ExtendedSessionFeedback()
        {
            //if (!Xamarin.Insights.IsInitialized)
            //{
            //    Xamarin.Insights.Initialize("cb9dddf47d18b81b88181a4f106fcb7565048148");
            //    Insights.ForceDataTransmission = true;
            //    if (!string.IsNullOrEmpty(App.uuid))
            //    {

            //        var manyInfos = new Dictionary<string, string> {
            //        { Xamarin.Insights.Traits.GuestIdentifier, App.uuid },
            //        { "CurrentCulture", CultureInfo.CurrentCulture.Name }
            //    };

            //        Xamarin.Insights.Identify(App.uuid, manyInfos);
            //    }
            //}
            IDictionary <string, string> info = new Dictionary <string, string>();

            if (App.CurrentSession != null)
            {
                info = new Dictionary <string, string> {
                    { "SessionId", App.CurrentSession.Id }
                }
            }
            ;
            handle = Insights.TrackTime("ExtendedFeedbackTime", info);

            var titleLabel = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Session"
            };

            var title = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = Color.White,
                Text          = App.CurrentSession.Title
            };

            var registrationIdLabel = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Registration Id *"
            };

            registrationEntry = new Entry
            {
                Placeholder = "XXXXXXXX",
                TextColor   = Device.OnPlatform(Color.Black, Color.White, Color.White),
                Keyboard    = Keyboard.Numeric,
            };

            registrationEntry.Unfocused += async(sender, args) =>
            {
                if (!String.IsNullOrEmpty(registrationEntry.Text) && !long.TryParse(registrationEntry.Text, out uuid))
                {
                    registrationEntry.Text = "";
                    await DisplayAlert("Invalid Registration Id!", "Please check your Tag for Registration Id.", "OK");

                    registrationEntry.Focus();
                }
            };

            var changeLink = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Micro),
                                         Font.SystemFontOfSize(14), Font.SystemFontOfSize(22)),
                FontAttributes  = FontAttributes.Italic,
                FontLabelType   = FontLabelType.Light,
                LineBreakMode   = LineBreakMode.WordWrap,
                VerticalOptions = LayoutOptions.End,
                TextColor       = App.XamDarkBlue,
                Text            = "Edit"
            };

            var tap = new TapGestureRecognizer((view, obj) =>
            {
                registrationEntry.IsEnabled = true;
                registrationEntry.Focus();
                changeLink.IsVisible = false;
            });

            changeLink.GestureRecognizers.Add(tap);

            var registrationStack = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
            };

            if (!String.IsNullOrEmpty(App.uuid))
            {
                registrationEntry.Text      = App.uuid;
                registrationEntry.IsEnabled = false;
                registrationStack.Children.Add(registrationEntry);
                registrationStack.Children.Add(changeLink);
            }
            else
            {
                registrationStack.Children.Add(registrationEntry);
                registrationEntry.IsEnabled = true;
            }

            var questionOne = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Quality of Session Content *"
            };


            var answerOnePicker = new Picker
            {
                Title = "Select",
            };

            answerOnePicker.Items.Add("4 - Excellent");
            answerOnePicker.Items.Add("3");
            answerOnePicker.Items.Add("2");
            answerOnePicker.Items.Add("1 - Poor");

            var questionTwo = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Quality of Session Delivery *"
            };

            var answerTwoPicker = new Picker
            {
                Title = "Select",
            };

            answerTwoPicker.Items.Add("4 - Excellent");
            answerTwoPicker.Items.Add("3");
            answerTwoPicker.Items.Add("2");
            answerTwoPicker.Items.Add("1 - Poor");

            var questionThree = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Overall Session Quality *"
            };

            var answerThreePicker = new Picker
            {
                Title = "Select",
            };

            answerThreePicker.Items.Add("4 - Excellent");
            answerThreePicker.Items.Add("3");
            answerThreePicker.Items.Add("2");
            answerThreePicker.Items.Add("1 - Poor");

            var feedbackLabel = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Feedback"
            };

            var txtFeedback = new Editor
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
            };

            var extendedQuestion = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Overall feedback for your experience at Azure Conference till now:"
            };

            var questionFour = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "How satisfied were you with this event *"
            };
            var answerFourPicker = new Picker
            {
                Title = "Select",
            };

            answerFourPicker.Items.Add("4 - Very Satisfied");
            answerFourPicker.Items.Add("3");
            answerFourPicker.Items.Add("2");
            answerFourPicker.Items.Add("1 - Very Dissatisfied");

            var questionFive = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "How likely are you to complete a web site, business solution, or consumer app (using any OS) that utilizes Azure services in the next 6 months? *"
            };
            var answerFivePicker = new Picker
            {
                Title = "Select",
            };

            answerFivePicker.Items.Add("4 - Very likely");
            answerFivePicker.Items.Add("3");
            answerFivePicker.Items.Add("2");
            answerFivePicker.Items.Add("1 - Not at all");

            var questionSix = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "How likely are you to recommend the use of Microsoft products/solutions to colleagues or peers? *"
            };
            var answerSixPicker = new Picker
            {
                Title = "Select",
            };

            answerSixPicker.Items.Add("4 - Very likely");
            answerSixPicker.Items.Add("3");
            answerSixPicker.Items.Add("2");
            answerSixPicker.Items.Add("1 - Not at all");

            var buttonReset = new Button
            {
                Text = "Reset"
            };

            var buttonSubmit = new Button
            {
                Text = "Submit"
            };

            buttonReset.Clicked += (sender, args) =>
            {
                answerOnePicker.SelectedIndex      = answerTwoPicker.SelectedIndex = answerThreePicker.SelectedIndex =
                    answerFourPicker.SelectedIndex = answerFivePicker.SelectedIndex = answerSixPicker.SelectedIndex = -1;
                txtFeedback.Text = "";
            };

            var spinner = new ActivityIndicator
            {
                IsRunning = false,
                IsVisible = false,
                Color     = Device.OnPlatform(App.XamBlue, Color.White, Color.White)
            };


            var isSubmitting = false;

            buttonSubmit.Clicked += async(sender, args) =>
            {
                if (!App.NetworkMonitor.IsAvailable())
                {
                    await DisplayAlert("No Internet Connectivity!", "Your Phone is not connected to the Internet. Please connect and try again.", "OK");
                }
                else if (isSubmitting == false)
                {
                    isSubmitting = true;
                    var answerOne   = Utils.GetPickerValue(answerOnePicker.SelectedIndex);
                    var answerTwo   = Utils.GetPickerValue(answerTwoPicker.SelectedIndex);
                    var answerThree = Utils.GetPickerValue(answerThreePicker.SelectedIndex);

                    var answerFour = Utils.GetPickerValue(answerFourPicker.SelectedIndex);
                    var answerFive = Utils.GetPickerValue(answerFivePicker.SelectedIndex);
                    var answerSix  = Utils.GetPickerValue(answerSixPicker.SelectedIndex);

                    if (!String.IsNullOrEmpty(registrationEntry.Text) &&
                        !long.TryParse(registrationEntry.Text, out uuid))
                    {
                        registrationEntry.Text = "";
                        await DisplayAlert("Invalid Registration Id!", "Please check your Tag for Registration Id.", "OK");

                        registrationEntry.Focus();
                    }
                    else if (uuid == 0 || answerOne == -1 || answerTwo == -1 ||
                             answerThree == -1)
                    {
                        await
                        DisplayAlert("Mandatory inputs missing!",
                                     "Please provide your response for the mandatory(*) fields.", "OK");

                        isSubmitting = false;
                    }
                    else
                    {
                        try
                        {
                            spinner.IsRunning = true;
                            spinner.IsVisible = true;
                            var feedback = new Feedback2();
                            feedback.OverallRating = answerThree;
                            feedback.PlatformId    = Device.OnPlatform(3, 2, 1);
                            feedback.SessionId     = App.CurrentSession.Id;
                            feedback.SessionRating = answerOne;
                            feedback.SpeakerRating = answerTwo;
                            feedback.TextFeedback  = txtFeedback.Text;
                            feedback.UserId        = uuid;
                            App.uuid           = uuid.ToString();
                            feedback.ToContact = true;

                            var eventFeedback = new Eventfeedback();
                            eventFeedback.UserId = uuid;
                            eventFeedback.OverallSatisfaction = answerFour;
                            eventFeedback.CompleteAzure       = answerFive;
                            eventFeedback.RecommendAzure      = answerSix;

                            Insights.Track("ContactUs Data", new Dictionary <string, string> {
                                { "UserID", uuid.ToString() },
                                { "Feedback", JsonConvert.SerializeObject(feedback) },
                                { "EventFeedback", JsonConvert.SerializeObject(eventFeedback) }
                            });

                            await
                            DisplayAlert("Submitting you feedback!", "Please wait while we submit your feedback.",
                                         "OK");

                            var res = await App.feedbackManager.SaveFeedbackTaskAsync(feedback);

                            var res1 = await App.feedbackManager.SaveEventFeedbackTaskAsync(eventFeedback);

                            if (!res || !res1)
                            {
                                await
                                DisplayAlert("No Internet Connectivity!",
                                             "Your Phone is not connected to the Internet. Please connect and try again.",
                                             "OK");
                            }
                            else
                            {
                                App.FeedbackList.Add(App.CurrentSession.Id);
                                if (App.CurrentDayType == DayTypes.Day1)
                                {
                                    App.DayOneFeedbackCount = App.DayOneFeedbackCount + 1;
                                    App.DayOneExtFeedback   = true;
                                    AppStorageHelper.SaveDayOneExtFeedback(1);
                                    AppStorageHelper.SaveDayOneFeedbackCount(App.DayOneFeedbackCount);
                                }
                                else if (App.CurrentDayType == DayTypes.Day2)
                                {
                                    App.DayTwoFeedbackCount = App.DayTwoFeedbackCount + 1;
                                    App.DayTwoExtFeedback   = true;
                                    AppStorageHelper.SaveDayTwoExtFeedback(1);
                                    AppStorageHelper.SaveDayTwoFeedbackCount(App.DayTwoFeedbackCount);
                                }
                                await DisplayAlert("Thank You!", "Thanks for providing your valuable feedback.", "OK");

                                handle.Stop();
                                await this.Navigation.PopAsync();
                            }
                        }
                        catch (Exception ex)
                        {
                            Insights.Report(ex);
                        }
                        isSubmitting      = false;
                        spinner.IsVisible = false;
                        spinner.IsRunning = false;
                    }
                }
            };

            var stackButtons = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Children          = { buttonReset, buttonSubmit },
            };

            var feedbackStack = new StackLayout
            {
                Children = { titleLabel,       title,           registrationIdLabel, registrationStack, questionOne,      answerOnePicker,
                             questionTwo,      answerTwoPicker, questionThree,       answerThreePicker, feedbackLabel,    txtFeedback,
                             extendedQuestion, questionFour,    answerFourPicker,    questionFive,      answerFivePicker, questionSix,
                             answerSixPicker,  spinner,         stackButtons },
            };

            var scrollView = new ScrollView
            {
                VerticalOptions = LayoutOptions.Fill,
                Orientation     = ScrollOrientation.Vertical,
                Content         = feedbackStack,
            };

            Content         = scrollView;
            Title           = "Feedback";
            Padding         = new Thickness(10, 0);
            BackgroundColor = Color.Black;

            BindingContext = _viewModel;
        }
Пример #4
0
        public ContactUsPage()
        {
            //if (!Xamarin.Insights.IsInitialized)
            //{
            //    Xamarin.Insights.Initialize("cb9dddf47d18b81b88181a4f106fcb7565048148");
            //    Insights.ForceDataTransmission = true;
            //    if (!string.IsNullOrEmpty(App.uuid))
            //    {

            //        var manyInfos = new Dictionary<string, string> {
            //        { Xamarin.Insights.Traits.GuestIdentifier, App.uuid },
            //        { "CurrentCulture", CultureInfo.CurrentCulture.Name }
            //    };

            //        Xamarin.Insights.Identify(App.uuid, manyInfos);
            //    }
            //}
            handle = Insights.TrackTime("ContactUsTime");
            var registrationIdLabel = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Registration Id *"
            };

            registrationEntry = new Entry
            {
                Placeholder = "XXXXXXXX",
                TextColor   = Device.OnPlatform(Color.Black, Color.White, Color.White),
                Keyboard    = Keyboard.Numeric,
            };

            registrationEntry.Unfocused += async(sender, args) =>
            {
                if (!String.IsNullOrEmpty(registrationEntry.Text) && !long.TryParse(registrationEntry.Text, out uuid))
                {
                    registrationEntry.Text = "";
                    await DisplayAlert("Invalid Registration Id!", "Please check your Tag for Registration Id.", "OK");

                    registrationEntry.Focus();
                }
            };

            var changeLink = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(14), Font.SystemFontOfSize(22)),
                FontAttributes  = FontAttributes.Italic,
                FontLabelType   = FontLabelType.Light,
                LineBreakMode   = LineBreakMode.WordWrap,
                VerticalOptions = LayoutOptions.End,
                TextColor       = App.XamDarkBlue,
                Text            = "Edit"
            };

            var tap = new TapGestureRecognizer((view, obj) =>
            {
                registrationEntry.IsEnabled = true;
                registrationEntry.Focus();
                changeLink.IsVisible = false;
            });

            changeLink.GestureRecognizers.Add(tap);

            var registrationStack = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
            };

            if (!String.IsNullOrEmpty(App.uuid))
            {
                registrationEntry.Text      = App.uuid;
                registrationEntry.IsEnabled = false;
                registrationStack.Children.Add(registrationEntry);
                registrationStack.Children.Add(changeLink);
            }
            else
            {
                registrationStack.Children.Add(registrationEntry);
                registrationEntry.IsEnabled = true;
            }

            var questionOne = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "As a result of attending this event, my propensity to recommend Microsoft Cloud Services has *"
            };

            var answerOnePicker = new Picker
            {
                Title = "Select",
            };

            answerOnePicker.Items.Add("Increased");
            answerOnePicker.Items.Add("Decreased");
            answerOnePicker.Items.Add("Stayed the same");

            var questionTwo = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Which of the following best describes your role in deciding on investing in the Microsoft Cloud Solution? *"
            };

            var answerTwoPicker = new Picker
            {
                Title = "Select",
            };

            answerTwoPicker.Items.Add("I am a Technical Decision Maker");
            answerTwoPicker.Items.Add("I am a Business Decision Maker");
            answerTwoPicker.Items.Add("I influence the above decision");



            var questionTwoText = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "My role is: "
            };

            var answerTwoText = new Entry
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsEnabled         = false
            };

            answerTwoPicker.SelectedIndexChanged += (sender, args) =>
            {
                if (answerTwoPicker.SelectedIndex == 2)
                {
                    answerTwoText.IsEnabled = true;
                    answerTwoText.Focus();
                }
                else
                {
                    answerTwoText.IsEnabled = false;
                    answerTwoText.Text      = "";
                }
            };

            var questionTwoStack = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    = { questionTwoText, answerTwoText }
            };

            var questionThree = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Approximately how many PCs do you have in your organization? (Please mention nos.) *"
            };

            var answerThree = new Entry
            {
                TextColor = Device.OnPlatform(Color.Black, Color.White, Color.White),
                Keyboard  = Keyboard.Numeric,
            };

            //var answerThreePicker = new Picker
            //{
            //    Title = "Select",
            //};
            //answerThreePicker.Items.Add("< 10");
            //answerThreePicker.Items.Add("11 - 50");
            //answerThreePicker.Items.Add("51 - 100");
            //answerThreePicker.Items.Add("> 100");

            var questionFour = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "When do you intent to deploy Microsoft Cloud Solution? *"
            };

            var answerFourPicker = new Picker
            {
                Title = "Select",
            };

            answerFourPicker.Items.Add("0 - 3 months");
            answerFourPicker.Items.Add("3 - 6 months");
            answerFourPicker.Items.Add("6 months - 1 year");
            answerFourPicker.Items.Add("More than 1 year");

            var questionFive = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Do you have a planned budget for implementing Microsoft Cloud Solution offerings interested in? *"
            };

            var answerFivePicker = new Picker
            {
                Title = "Select",
            };

            answerFivePicker.Items.Add("Yes");
            answerFivePicker.Items.Add("No");


            var questionFiveText = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Estimated budget (optional)"
            };

            var answerFiveText = new Entry
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsEnabled         = false
            };

            answerFivePicker.SelectedIndexChanged += (sender, args) =>
            {
                if (answerFivePicker.SelectedIndex == 0)
                {
                    answerFiveText.IsEnabled = true;
                    answerFiveText.Focus();
                }
                else
                {
                    answerFiveText.IsEnabled = false;
                    answerFiveText.Text      = "";
                }
            };

            var questionFiveStack = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    = { questionFiveText, answerFiveText }
            };

            var questionSix = new FontLabel
            {
                Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small),
                                         Font.SystemFontOfSize(18), Font.SystemFontOfSize(22)),
                FontLabelType = FontLabelType.Light,
                LineBreakMode = LineBreakMode.WordWrap,
                TextColor     = App.XamBlue,
                Text          = "Comments:"
            };

            var answerSix = new Editor
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
            };

            var buttonReset = new Button
            {
                Text = "Reset"
            };

            var buttonSubmit = new Button
            {
                Text = "Submit"
            };

            buttonReset.Clicked += (sender, args) =>
            {
                answerOnePicker.SelectedIndex = answerTwoPicker.SelectedIndex = answerFourPicker.SelectedIndex = answerFivePicker.SelectedIndex = -1;
                answerTwoText.Text            = answerSix.Text = answerThree.Text = "";
            };

            var stackButtons = new StackLayout
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Orientation       = StackOrientation.Horizontal,
                Children          = { buttonReset, buttonSubmit },
            };

            var spinner = new ActivityIndicator
            {
                IsRunning = false,
                IsVisible = false,
                Color     = Device.OnPlatform(App.XamBlue, Color.White, Color.White)
            };
            //spinner.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            //spinner.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");

            var isSubmitting = false;

            buttonSubmit.Clicked += async(sender, args) =>
            {
                if (!App.NetworkMonitor.IsAvailable())
                {
                    await DisplayAlert("No Internet Connectivity!", "Your Phone is not connected to the Internet. Please connect and try again.", "OK");
                }
                else if (isSubmitting == false)
                {
                    isSubmitting = true;
                    var answerOne         = Utils.GetPickerValue(answerOnePicker.SelectedIndex);
                    var answerTwo         = Utils.GetPickerValue(answerTwoPicker.SelectedIndex);
                    var answerFour        = Utils.GetPickerValue(answerFourPicker.SelectedIndex);
                    var answerFive        = Utils.GetPickerValue(answerFivePicker.SelectedIndex);
                    var answerTwoTextReq  = false;
                    var answerFiveTextReq = false;
                    if (answerTwo == 2 && String.IsNullOrEmpty(answerTwoText.Text))
                    {
                        answerTwoTextReq = true;
                        answerTwoText.Focus();
                    }
                    if (answerFive == 0 && String.IsNullOrEmpty(answerFiveText.Text))
                    {
                        answerFiveTextReq = true;
                        answerFiveText.Focus();
                    }
                    if (!String.IsNullOrEmpty(registrationEntry.Text) &&
                        !long.TryParse(registrationEntry.Text, out uuid))
                    {
                        registrationEntry.Text = "";
                        await DisplayAlert("Invalid Registration Id!", "Please check your Tag for Registration Id.", "OK");

                        registrationEntry.Focus();
                    }
                    else if (uuid == 0 || answerOne == -1 || answerTwo == -1 ||
                             answerFour == -1 || answerFive == -1 || String.IsNullOrEmpty(answerThree.Text) || answerTwoTextReq || answerFiveTextReq)
                    {
                        await
                        DisplayAlert("Mandatory inputs missing!",
                                     "Please provide your response for the mandatory(*) fields.", "OK");
                    }
                    else
                    {
                        try
                        {
                            spinner.IsRunning = true;
                            spinner.IsVisible = true;

                            var contactUs = new ContactUs();
                            contactUs.AnswerOne      = answerOne;
                            contactUs.AnswerTwo      = answerTwo;
                            contactUs.AnswerTwoText  = answerTwoText.Text;
                            contactUs.AnswerThree    = answerThree.Text;
                            contactUs.AnswerFour     = answerFour;
                            contactUs.AnswerFive     = answerFive;
                            contactUs.AnswerFiveText = answerFiveText.Text;
                            contactUs.AnswerSix      = answerSix.Text;
                            contactUs.PlatformId     = Device.OnPlatform(3, 2, 1);
                            contactUs.UserId         = uuid;
                            App.uuid = uuid.ToString();
                            Insights.Track("ContactUs Data", new Dictionary <string, string>
                            {
                                { "UserID", uuid.ToString() },
                                { "Data", JsonConvert.SerializeObject(contactUs) }
                            });
                            //await DisplayAlert("Submitting your data!", "Please wait while we submit your feedback.", "OK");
                            var res = await App.feedbackManager.SaveContactUsTaskAsync(contactUs);

                            if (!res)
                            {
                                await
                                DisplayAlert("No Internet Connectivity!",
                                             "Your Phone is not connected to the Internet. Please connect and try again.",
                                             "OK");
                            }
                            else
                            {
                                await DisplayAlert("Thank You!", "Thanks for providing your valuable feedback.", "OK");

                                //await this.Navigation.PopAsync();
                                answerOnePicker.SelectedIndex          =
                                    answerTwoPicker.SelectedIndex      =
                                        answerFourPicker.SelectedIndex = answerFivePicker.SelectedIndex = -1;
                                answerTwoText.Text = answerSix.Text = answerThree.Text = "";
                                handle.Stop();
                            }
                        }
                        catch (Exception ex)
                        {
                            Insights.Report(ex);
                        }
                        isSubmitting      = false;
                        spinner.IsVisible = false;
                        spinner.IsRunning = false;
                        App.IOsMasterDetailPage.IsPresented = true;
                    }
                }
            };

            var contactStack = new StackLayout
            {
                Children = { registrationIdLabel, registrationStack, questionOne, answerOnePicker, questionTwo, answerTwoPicker, questionTwoStack, questionThree, answerThree, questionFour, answerFourPicker, questionFive, answerFivePicker, questionFiveStack, questionSix, answerSix, spinner, stackButtons },
            };

            var scrollView = new ScrollView
            {
                VerticalOptions = LayoutOptions.Fill,
                Orientation     = ScrollOrientation.Vertical,
                Content         = contactStack,
            };

            Content         = scrollView;
            Title           = "Contact Us";
            Padding         = new Thickness(10, 0);
            BackgroundColor = Color.Black;
            BindingContext  = App.ViewModel;
        }
Пример #5
0
 public void Stop()
 {
     _trackHandle.Stop();
 }
Пример #6
0
        protected override bool OnBackButtonPressed()
        {
            return(base.OnBackButtonPressed());

            handle.Stop();
        }