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(); } } }
public override void ViewWillDisappear (bool animated) { base.ViewWillDisappear (animated); if (trackerHandle != null) { trackerHandle.Stop (); trackerHandle = null; } }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); if (trackerHandle != null) { trackerHandle.Stop(); trackerHandle = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); trackerHandle = Insights.TrackTime("Time spent on welcome screen"); trackerHandle.Start(); lblTitle.Text = Strings.Welcome_Title; lblPromise.Text = Strings.Welcome_Promise; btnConnectWithFacebook.SetTitle(Strings.Welcome_Facebook, UIControlState.Normal); btnConnectWithGoogle.SetTitle(Strings.Welcome_Google, UIControlState.Normal); btnConnectWithFacebook.Alpha = 0; }
public override void ViewDidLoad() { base.ViewDidLoad(); trackerHandle = Insights.TrackTime("Time spent on welcome screen"); trackerHandle.Start(); lblTitle.Text = Strings.WelcomeTitle; lblPromise.Text = Strings.WelcomePromise; btnConnectWithFacebook.SetTitle(Strings.WelcomeFacebookButton, UIControlState.Normal); View.BackgroundColor = Color.Blue.ToNative(); btnConnectWithFacebook.Alpha = 0; }
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; }
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; }
public override void ViewDidLoad() { base.ViewDidLoad(); if (BeerDrinkin.Core.Helpers.Settings.UserTrackingEnabled) { trackerHandle = Insights.TrackTime("Time Viewing BeerDescription"); trackerHandle.Start(); Insights.Track("Beer Description Loaded", new Dictionary<string, string> { {"Beer Name", beer.Name}, {"Beer Id", beer.Id} }); } TableView.Source = new DescriptionTableViewSource(ref cells); TableView.Delegate = new DescriptionDelegate(ref cells); TableView.ReloadData(); View.SetNeedsDisplay(); }
public Tracker(ITrackHandle trackHandle) { _trackHandle = trackHandle; }
public SessionPage() { _viewModel = new SessionViewModel(); //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("SessionDetailsTime", info); //_viewModel.Error += (sender, args) => DisplayAlert("Sorry about the mess.", args.ErrorMessage, "OK"); Title = "Session Details"; //var share = new ToolbarItem //{ // Icon = Utils.GetFile("ic_action_social_share.png"), // Name = "Share", // Command = new Command(() => DependencyService.Get<IShare>().ShareText("I can't wait to check out " + _viewModel.Session.Title + " at #XamarinEvolve")) //}; //ToolbarItems.Add(share); var titleLabel = new FontLabel { Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(22)), FontLabelType = FontLabelType.Light, LineBreakMode = LineBreakMode.WordWrap, TextColor = App.XamBlue, Text = "Title" }; var favoriteImageSize = Device.OnPlatform(50, 50, 50); var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandProperty, "TapCommand"); var favoriteImage = new Image { WidthRequest = favoriteImageSize, HeightRequest = 20, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Start, Source = ImageSource.FromFile("heart2.png") }; favoriteImage.SetBinding <SessionViewModel>(IsVisibleProperty, s => s.IsFavorite); favoriteImage.GestureRecognizers.Add(tapGestureRecognizer); var unfavoriteImage = new Image { WidthRequest = favoriteImageSize, HeightRequest = 20, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Start, Source = ImageSource.FromFile("heart2empty.png") }; unfavoriteImage.SetBinding <SessionViewModel>(IsVisibleProperty, s => s.IsUnFavorite); unfavoriteImage.GestureRecognizers.Add(tapGestureRecognizer); var grid = new Grid(); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50, GridUnitType.Absolute) }); grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid.Children.Add(titleLabel); grid.Children.Add(favoriteImage); grid.Children.Add(unfavoriteImage); Grid.SetColumn(titleLabel, 0); Grid.SetColumn(favoriteImage, 1); Grid.SetColumn(unfavoriteImage, 1); feedbackButton = new Button { Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(22)), TextColor = Device.OnPlatform(Color.White, Color.White, Color.White), Text = "Add Feedback", BorderColor = Color.White, BorderRadius = 5 }; feedbackButton.Clicked += async(sender, args) => { if ((App.DayOneFeedbackCount == 3 && !App.DayOneExtFeedback) || (App.DayTwoFeedbackCount == 3 && !App.DayTwoExtFeedback)) { var feedbackPage = new ExtendedSessionFeedback(); await Navigation.PushAsync(feedbackPage); } else { var feedbackPage = new SessionFeedbackPage(); await Navigation.PushAsync(feedbackPage); } }; var title = new FontLabel { Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(22)), FontLabelType = FontLabelType.Light, LineBreakMode = LineBreakMode.WordWrap, TextColor = Color.White }; title.SetBinding <SessionViewModel>(Label.TextProperty, s => s.Session.Title); var timeLabel = new FontLabel { Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(22)), FontLabelType = FontLabelType.Light, LineBreakMode = LineBreakMode.WordWrap, TextColor = App.XamBlue, Text = "Time" }; var time = new FontLabel { Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(22)), FontLabelType = FontLabelType.Light, LineBreakMode = LineBreakMode.WordWrap, TextColor = Color.White }; time.SetBinding <SessionViewModel>(Label.TextProperty, s => s.Session.DateTimeDisplay); var locationLabel = new FontLabel { Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(22)), FontLabelType = FontLabelType.Light, LineBreakMode = LineBreakMode.WordWrap, TextColor = App.XamBlue, Text = "Track Name" }; var location = new Label { Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(22)), LineBreakMode = LineBreakMode.WordWrap, TextColor = Color.White }; location.SetBinding <SessionViewModel>(Label.TextProperty, s => s.Session.TrackName); var descriptionLabel = new FontLabel { Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(22)), FontLabelType = FontLabelType.Light, LineBreakMode = LineBreakMode.WordWrap, TextColor = App.XamBlue, Text = "Description" }; var description = new Label { Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(22)), LineBreakMode = LineBreakMode.WordWrap, TextColor = Color.White }; description.SetBinding <SessionViewModel>(Label.TextProperty, s => s.Session.Abstract); var sessionStack = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Children = { grid, feedbackButton, title, timeLabel, time, locationLabel, location, descriptionLabel, description }, Padding = new Thickness(5, 20), //BackgroundColor = Color.Transparent }; var scrollView = new ScrollView { VerticalOptions = LayoutOptions.Fill, Orientation = ScrollOrientation.Vertical, Content = sessionStack, //BackgroundColor = Color.Transparent }; var sessionPage = new ContentPage { Title = "By Track", Content = scrollView, BackgroundImage = "background.png" }; BackgroundImage = "background.png"; var listView = new CustomListView { RowHeight = Device.OnPlatform(400, 70, 125), ItemTemplate = new DataTemplate(typeof(SpeakerDetailsCelliOS)), HasUnevenRows = true, IsGroupingEnabled = false, BackgroundColor = Color.Transparent, HorizontalOptions = LayoutOptions.FillAndExpand //GroupShortNameBinding = new Binding("Key")//Remove for now as it causes crash on iOS if you scroll too fast:( }; listView.SetBinding <SessionViewModel>(ListView.ItemsSourceProperty, x => x.Speakers); listView.ItemSelected += async(sender, e) => { listView.SelectedItem = null; }; var speakersStack = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Children = { listView }, Padding = new Thickness(5, 20), //BackgroundColor = Color.Transparent }; var speakersPage = new ContentPage { Content = speakersStack, Title = "Speakers", BackgroundImage = "background.png" }; Children.Add(sessionPage); Children.Add(speakersPage); //int speakerPhotoSize = Device.OnPlatform(80, 80, 100); //speakerPhoto = new CircleImage //{ // WidthRequest = speakerPhotoSize, // HeightRequest = speakerPhotoSize, // Aspect = Aspect.AspectFill, // HorizontalOptions = LayoutOptions.Center, // VerticalOptions = LayoutOptions.Center, // Source = Utils.GetFile("missing.png") //}; //speakerPhoto.SetBinding<SessionViewModel>(Image.SourceProperty, s => s.Speakers, // converter: new MainSpeakerImageConveter(_viewModel)); // Color color = App.XamDarkBlue; // var favorite = new Button // { // Text = " ADDED TO FAVORITES ", //to do put back in binding // HeightRequest = Device.OnPlatform<double>(25, 30, 70), // WidthRequest = Device.OnPlatform(150, 150, 220), // BackgroundColor = Color.Transparent, // TextColor = color, // Font = Font.SystemFontOfSize(NamedSize.Micro), // BorderWidth = 1, // BorderRadius = 5, // BorderColor = color, // HorizontalOptions = LayoutOptions.End, // IsVisible = false // }; // favorite.SetBinding<SessionViewModel>(IsVisibleProperty, x => x.IsBusy, // converter: new ReverseBooleanConverter()); // favorite.SetBinding<SessionViewModel>(Button.CommandProperty, s => s.IsFavoriteSession, // converter: new FavoriteSessionConverter(favorite, _viewModel, Navigation)); // double relativeHeight = bannerImageHeight + (speakerPhotoSize * .75); // var relativeLayout = new RelativeLayout // { // HeightRequest = relativeHeight, // VerticalOptions = LayoutOptions.Start // }; // relativeLayout.Children.Add(bannerImageStack, null, null, Constraint.RelativeToParent(v => v.Width)); // relativeLayout.Children.Add(title, // Constraint.Constant(10), //Constraint.RelativeToParent(parent => 5), Constraint.RelativeToParent(parent => (parent.Width - 20)), Constraint.Constant(bannerImageHeight * .6)); // relativeLayout.Children.Add(by, //Constraint.Constant(10), // Constraint.Constant(bannerImageHeight * .68), //Constraint.RelativeToParent(parent => (parent.Width - 20))); // relativeLayout.Children.Add(speakerPhoto, // // ReSharper disable once PossibleLossOfFraction // Constraint.Constant(speakerPhotoSize / 4), // Constraint.Constant(bannerImageHeight - speakerPhotoSize / 4)); // double addHeightForFravorite = Device.OnPlatform(favorite.HeightRequest / 2, favorite.HeightRequest / 2, 0); // relativeLayout.Children.Add(favorite, Constraint.RelativeToParent(v => // { // // ReSharper disable once CompareOfFloatsByEqualityOperator // var width = Device.OnPlatform(150, 150, 200); // return v.Width - 35 - width; // }), Constraint.Constant(bannerImageHeight + addHeightForFravorite)); // var whenWhere = new Label // { // Text = "WHEN AND WHERE", // TextColor = App.XamLightGray, // Font = Font.SystemFontOfSize(NamedSize.Small, FontAttributes.Bold) // }; // var timeLabel = new Label // { // Font = Device.OnPlatform(Font.SystemFontOfSize(NamedSize.Small), // Font.SystemFontOfSize(NamedSize.Medium), // Font.SystemFontOfSize(NamedSize.Medium)), // TextColor = App.XamGray // }; // timeLabel.SetBinding<SessionViewModel>(Label.TextProperty, s => s.Session, // converter: new FullSessionDateTimeConverter()); // var location = new Label // { // Font = Device.OnPlatform(Font.SystemFontOfSize(NamedSize.Small), // Font.SystemFontOfSize(NamedSize.Medium), // Font.SystemFontOfSize(NamedSize.Medium)), // TextColor = App.XamGray, // }; // location.SetBinding<SessionViewModel>(Label.TextProperty, s => s.Room, converter: new RoomTitleConverter()); // var details = new Label // { // Text = "DETAILS", // TextColor = App.XamLightGray, // Font = Font.SystemFontOfSize(NamedSize.Small, FontAttributes.Bold) // }; // var description = new HTMLLabel // { // Font = Device.OnPlatform(Font.SystemFontOfSize(NamedSize.Small), // Font.SystemFontOfSize(NamedSize.Small), // Font.SystemFontOfSize(NamedSize.Small)), // TextColor = App.XamGray // }; // description.SetBinding<SessionViewModel>(Label.TextProperty, s => s.Description, converter: new DetailsNotAvailableConverter("Details are not available at this time.")); /*var descriptionScroll = new ContentView * { * VerticalOptions = LayoutOptions.FillAndExpand, * HorizontalOptions = LayoutOptions.FillAndExpand, * Content = new ScrollView * { * VerticalOptions = LayoutOptions.FillAndExpand, * HorizontalOptions = LayoutOptions.FillAndExpand, * Content = description * } * };*/ //var alarmButton = new Button //{ // TextColor = Color.White, // BorderRadius = 5, // HorizontalOptions = LayoutOptions.FillAndExpand, // HeightRequest = Device.OnPlatform<double>(35, 35, 70), // Font = Font.SystemFontOfSize(NamedSize.Small), // Command = _viewModel.ToggleCalendarCommand, // IsVisible = false //}; //alarmButton.SetBinding<SessionViewModel>(BackgroundColorProperty, s => s.CalendarColor); //alarmButton.SetBinding<SessionViewModel>(IsVisibleProperty, s => s.CalendarVisible); //alarmButton.SetBinding<SessionViewModel>(Button.TextProperty, s => s.CalendarText); //var feedback = new Button //{ // Text = "Provide Feedback", //to do put back in binding // TextColor = Color.White, // BackgroundColor = App.XamBlue, // BorderRadius = 5, // BorderColor = App.XamBlue, // HorizontalOptions = LayoutOptions.FillAndExpand, // HeightRequest = Device.OnPlatform<double>(35, 35, 70), // Font = Font.SystemFontOfSize(NamedSize.Small), // IsVisible = false //}; //feedback.SetBinding<SessionViewModel>(Button.CommandProperty, s => s.FeedbackConditionsChanged, converter: new SessionFeedbackConverter(feedback, _viewModel, Navigation)); //var gridContent = new Grid //{ // Padding = 10 //}; //gridContent.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); //gridContent.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); //gridContent.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); //gridContent.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); //gridContent.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); //gridContent.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); //gridContent.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); //gridContent.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); //gridContent.Children.Add(whenWhere); //gridContent.Children.Add(timeLabel); //gridContent.Children.Add(location); //gridContent.Children.Add(details); //gridContent.Children.Add(description); //gridContent.Children.Add(alarmButton); //gridContent.Children.Add(feedback); //Grid.SetRow(whenWhere, 0); //Grid.SetColumnSpan(whenWhere, 2); //Grid.SetRow(timeLabel, 1); //Grid.SetColumnSpan(timeLabel, 2); //Grid.SetRow(location, 2); //Grid.SetColumnSpan(location, 2); //Grid.SetRow(details, 3); //Grid.SetColumnSpan(details, 2); //Grid.SetRow(description, 4); //Grid.SetColumnSpan(description, 2); //Grid.SetRow(alarmButton, 5); //Grid.SetColumnSpan(alarmButton, 2); //Grid.SetRow(feedback, 5); //Grid.SetColumnSpan(feedback, 2); //var gridMain = new Grid(); //gridMain.RowDefinitions.Add(new RowDefinition { Height = new GridLength(relativeHeight) }); //gridMain.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); //gridMain.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); //gridMain.Children.Add(relativeLayout); //gridMain.Children.Add(gridContent); //Grid.SetRow(relativeLayout, 0); //Grid.SetRow(gridContent, 1); //this.SetBinding(IsBusyProperty, "IsBusy"); //Content = new ScrollView { Content = gridMain }; BindingContext = _viewModel; }