/// <summary> /// Reports the passed exception if Insights are initialized /// </summary> /// <param name="exception">Excpetion to report.</param> /// <param name="serverity">Serverity for the to report the exception.</param> public static void Report(Exception exception, Insights.Severity serverity = Insights.Severity.Error) { if (Insights.IsInitialized) { Insights.Report(exception, serverity); } }
public static void Report(Exception e, Insights.Severity severity = Insights.Severity.Warning) { if(!IsEnabled) return; Insights.Report(e, severity); }
public void Report(Exception ex, IDictionary extraData = null, Insights.Severity warningLevel = Insights.Severity.Warning) { Debug.WriteLine ("KINDER: Exception occurred: " + ex); if(!Insights.IsInitialized) return; Insights.Report (ex, extraData, warningLevel); }
static Task <int> Main() { return(Deployment.RunAsync(() => { var config = new Pulumi.Config(); var botName = config.Require("botName"); var resourceGroup = new ResourceGroup("botservice-rg"); var storageAccount = new Storage.Account("sa", new Storage.AccountArgs { ResourceGroupName = resourceGroup.Name, AccountReplicationType = "LRS", AccountTier = "Standard" }); var appServicePlan = new Plan("asp", new PlanArgs { ResourceGroupName = resourceGroup.Name, Kind = "App", Sku = new PlanSkuArgs { Tier = "Basic", Size = "B1" }, }); var container = new Storage.Container("zips", new Storage.ContainerArgs { StorageAccountName = storageAccount.Name, ContainerAccessType = "private", }); var blob = new Storage.ZipBlob("zip", new Storage.ZipBlobArgs { StorageAccountName = storageAccount.Name, StorageContainerName = container.Name, Type = "block", Content = new FileArchive("bot/publish") }); var codeBlobUrl = SharedAccessSignature.SignedBlobReadUrl(blob, storageAccount); var appInsights = new Insights("ai", new InsightsArgs { ApplicationType = "web", ResourceGroupName = resourceGroup.Name }); var appInsightApiKey = new ApiKey("ai", new ApiKeyArgs { ApplicationInsightsId = appInsights.Id, ReadPermissions = "api", }); var luis = new Cognitive.Account("cs", new Cognitive.AccountArgs { Kind = "CognitiveServices", // includes LUIS ResourceGroupName = resourceGroup.Name, Sku = new AccountSkuArgs { Name = "S0", Tier = "Standard" } }); var msa = new Application("msapp", new ApplicationArgs { Oauth2AllowImplicitFlow = false, AvailableToOtherTenants = true, PublicClient = true }); var pwd = new RandomPassword("password", new RandomPasswordArgs { Length = 16, MinNumeric = 1, MinSpecial = 1, MinUpper = 1, MinLower = 1 }); var msaSecret = new ApplicationPassword("msasecret", new ApplicationPasswordArgs { ApplicationObjectId = msa.ObjectId, EndDateRelative = "8640h", Value = pwd.Result }); var app = new AppService("app", new AppServiceArgs { ResourceGroupName = resourceGroup.Name, AppServicePlanId = appServicePlan.Id, AppSettings = { { "WEBSITE_RUN_FROM_PACKAGE", codeBlobUrl }, { "MicrosoftAppId", msa.ApplicationId }, { "MicrosoftAppPassword", msaSecret.Value }, { "LuisApiKey", luis.PrimaryAccessKey }, }, HttpsOnly = true }); var bot = new WebApp(botName, new WebAppArgs { DisplayName = botName, MicrosoftAppId = msa.ApplicationId, ResourceGroupName = resourceGroup.Name, Sku = "F0", Location = "global", Endpoint = Output.Format($"https://{app.DefaultSiteHostname}/api/messages"), DeveloperAppInsightsApiKey = appInsightApiKey.Key, DeveloperAppInsightsApplicationId = appInsights.AppId, DeveloperAppInsightsKey = appInsights.InstrumentationKey }); return new Dictionary <string, object?> { { "Bot Endpoint", bot.Endpoint }, { "MicrosoftAppId", msa.ApplicationId }, { "MicrosoftAppPassword", msaSecret.Value } }; })); }
public void Report(Exception exception = null, Insights.Severity warningLevel = Insights.Severity.Warning) { Insights.Report(exception, warningLevel); }
public void Report(Exception exception, string key, string value, Insights.Severity warningLevel = Insights.Severity.Warning) { Insights.Report(exception, key, value, warningLevel); }
//Register new LocalBox part 4 public void SetUpPassphrase(LocalBox localBox) { LayoutInflater factory = LayoutInflateHelper.GetLayoutInflater(homeActivity); View viewNewPhrase = factory.Inflate(Resource.Layout.dialog_new_passphrase, null); EditText editNewPassphrase = (EditText)viewNewPhrase.FindViewById <EditText> (Resource.Id.editText_dialog_new_passphrase); EditText editNewPassphraseVerify = (EditText)viewNewPhrase.FindViewById <EditText> (Resource.Id.editText_dialog_new_passphrase_verify); var dialogBuilder = new AlertDialog.Builder(homeActivity); dialogBuilder.SetTitle("Passphrase"); dialogBuilder.SetView(viewNewPhrase); dialogBuilder.SetPositiveButton("OK", (EventHandler <DialogClickEventArgs>)null); dialogBuilder.SetNegativeButton(Resource.String.cancel, (EventHandler <DialogClickEventArgs>)null); var dialog = dialogBuilder.Create(); dialog.Show(); var buttonCancel = dialog.GetButton((int)DialogButtonType.Negative); var buttonAddPassphrase = dialog.GetButton((int)DialogButtonType.Positive); buttonAddPassphrase.Click += async(sender, args) => { string passphraseOne = editNewPassphrase.Text; string passphraseTwo = editNewPassphraseVerify.Text; if (String.IsNullOrEmpty(passphraseOne)) { homeActivity.ShowToast("Passphrase is niet ingevuld"); } else if (String.IsNullOrEmpty(passphraseTwo)) { homeActivity.ShowToast("U dient uw ingevoerde passphrase te verifieren"); } else { if (!passphraseOne.Equals(passphraseTwo)) { homeActivity.ShowToast("De ingevoerde passphrases komen niet overeen. Corrigeer dit a.u.b."); } else { try { homeActivity.ShowProgressDialog("Passphrase aanmaken. Dit kan enige tijd in beslag nemen. Een ogenblik geduld a.u.b."); bool newPassphraseSucceeded = await BusinessLayer.Instance.SetPublicAndPrivateKey(localBox, passphraseOne); homeActivity.HideProgressDialog(); if (!newPassphraseSucceeded) { homeActivity.ShowToast("Passphrase instellen mislukt. Probeer het a.u.b. opnieuw"); } else { dialog.Dismiss(); homeActivity.ShowToast("LocalBox succesvol geregistreerd"); homeActivity.menuFragment.UpdateLocalBoxes(); SplashActivity.intentData = null; } } catch (Exception ex) { Insights.Report(ex); homeActivity.HideProgressDialog(); homeActivity.ShowToast("Passphrase instellen mislukt. Probeer het a.u.b. opnieuw"); } } } }; buttonCancel.Click += (sender, args) => { DataLayer.Instance.DeleteLocalBox(localBox.Id); homeActivity.menuFragment.UpdateLocalBoxes(); dialog.Dismiss(); }; }
private void InitPlugins() { Insights.Initialize(Keys.XamarinInsightsKey); }
protected override void OnAppearing() { base.OnAppearing(); Insights.Track(InsightsConstants.MenuPage); _menuListView.ItemTapped += _menuListView_ItemTapped; }
public bool GetAesKey(string path, out AesKeyResponse result) { if (!IsAuthorized()) { ReAuthorise(); } StringBuilder localBoxUrl = new StringBuilder(); localBoxUrl.Append(_localBox.BaseUrl); localBoxUrl.Append("lox_api/key"); localBoxUrl.Append(path); string AccessToken = _authorization.AccessToken; var handler = new HttpClientHandler { }; using (var httpClient = new HttpClient(handler)) { httpClient.MaxResponseContentBufferSize = int.MaxValue; httpClient.DefaultRequestHeaders.ExpectContinue = false; httpClient.DefaultRequestHeaders.Add("x-li-format", "json"); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Uri.EscapeDataString(AccessToken)); var httpRequestMessage = new HttpRequestMessage { Method = HttpMethod.Get, RequestUri = new Uri(localBoxUrl.ToString()) }; try { var response = httpClient.SendAsync(httpRequestMessage).Result; if (response.IsSuccessStatusCode) { var jsonString = response.Content.ReadAsStringAsync().Result; result = JsonConvert.DeserializeObject <AesKeyResponse> (jsonString); return(true); } else if (response.StatusCode == System.Net.HttpStatusCode.NotFound) { // geen key gevonden, maar op zich niet fout. result = null; return(true); } else { result = null; return(false); } } catch (Exception ex) { Insights.Report(ex); result = null; return(false); } } }
protected override void OnAppearing() { base.OnAppearing(); Insights.Track(InsightsReportingConstants.PAGE_LEADDETAIL); }
public void LogError(Exception e) { Insights.Report(e, Insights.Severity.Error); }
public ITrackHandle TrackTime(string identifier, IDictionary <string, string> table = null) { return(Insights.TrackTime(identifier, table)); }
public ITrackHandle TrackTime(string identifier, string key, string value) { return(Insights.TrackTime(identifier, key, value)); }
public void Track(string trackIdentifier, string key, string value) { Insights.Track(trackIdentifier, key, value); }
public void Track(string trackIdentifier, IDictionary <string, string> table = null) { Insights.Track(trackIdentifier, table); }
public Task Save() { return(Insights.Save()); }
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; }
protected override void InitializeXamarinInsights() { Insights.Initialize(XAMARIN_INSIGHTS_APP_KEY, Application.Context); // can't reference _service here since this method is called from the base class constructor. }
public virtual void RaiseCallbackAsync(string callbackId, bool repeating, int repeatDelayMS, bool repeatLag, bool notifyUser, Action <DateTime> scheduleRepeatCallback, Action letDeviceSleepCallback, Action finishedCallback) { DateTime callbackStartTime = DateTime.Now; Task.Run(async() => { try { ScheduledCallback scheduledCallback = null; // do we have callback information for the passed callbackId? we might not, in the case where the callback is canceled by the user and the system fires it subsequently. if (!_idCallback.TryGetValue(callbackId, out scheduledCallback)) { SensusServiceHelper.Get().Logger.Log("Callback " + callbackId + " is not valid. Unscheduling.", LoggingLevel.Normal, GetType()); UnscheduleCallback(callbackId); } if (scheduledCallback != null) { // the same callback action cannot be run multiple times concurrently. drop the current callback if it's already running. multiple // callers might compete for the same callback, but only one will win the lock below and it will exclude all others until it has executed. bool actionAlreadyRunning = true; lock (scheduledCallback) { if (!scheduledCallback.Running) { actionAlreadyRunning = false; scheduledCallback.Running = true; } } if (actionAlreadyRunning) { SensusServiceHelper.Get().Logger.Log("Callback \"" + scheduledCallback.Name + "\" (" + callbackId + ") is already running. Not running again.", LoggingLevel.Normal, GetType()); } else { try { if (scheduledCallback.Canceller.IsCancellationRequested) { SensusServiceHelper.Get().Logger.Log("Callback \"" + scheduledCallback.Name + "\" (" + callbackId + ") was cancelled before it was raised.", LoggingLevel.Normal, GetType()); } else { SensusServiceHelper.Get().Logger.Log("Raising callback \"" + scheduledCallback.Name + "\" (" + callbackId + ").", LoggingLevel.Normal, GetType()); if (notifyUser) { SensusContext.Current.Notifier.IssueNotificationAsync("Sensus", scheduledCallback.UserNotificationMessage, callbackId, true, scheduledCallback.DisplayPage); } // if the callback specified a timeout, request cancellation at the specified time. if (scheduledCallback.CallbackTimeout.HasValue) { scheduledCallback.Canceller.CancelAfter(scheduledCallback.CallbackTimeout.Value); } await scheduledCallback.Action(callbackId, scheduledCallback.Canceller.Token, letDeviceSleepCallback); } } catch (Exception ex) { string errorMessage = "Callback \"" + scheduledCallback.Name + "\" (" + callbackId + ") failed: " + ex.Message; SensusServiceHelper.Get().Logger.Log(errorMessage, LoggingLevel.Normal, GetType()); SensusException.Report(errorMessage, ex); } finally { // the cancellation token source for the current callback might have been canceled. if this is a repeating callback then we'll need a new // cancellation token source because they cannot be reset and we're going to use the same scheduled callback again for the next repeat. // if we enter the _idCallback lock before CancelRaisedCallback does, then the next raise will be cancelled. if CancelRaisedCallback enters the // _idCallback lock first, then the cancellation token source will be overwritten here and the cancel will not have any effect on the next // raise. the latter case is a reasonable outcome, since the purpose of CancelRaisedCallback is to terminate a callback that is currently in // progress, and the current callback is no longer in progress. if the desired outcome is complete discontinuation of the repeating callback // then UnscheduleRepeatingCallback should be used -- this method first cancels any raised callbacks and then removes the callback entirely. try { if (repeating) { lock (_idCallback) { scheduledCallback.Canceller = new CancellationTokenSource(); } } } catch (Exception) { } finally { // if we marked the callback as running, ensure that we unmark it (note we're nested within two finally blocks so // this will always execute). this will allow others to run the callback. lock (scheduledCallback) { scheduledCallback.Running = false; } // schedule callback again if it was a repeating callback and is still scheduled with a valid repeat delay if (repeating && CallbackIsScheduled(callbackId) && repeatDelayMS >= 0 && scheduleRepeatCallback != null) { DateTime nextCallbackTime; // if this repeating callback is allowed to lag, schedule the repeat from the current time. if (repeatLag) { nextCallbackTime = DateTime.Now.AddMilliseconds(repeatDelayMS); } else { // otherwise, schedule the repeat from the time at which the current callback was raised. nextCallbackTime = callbackStartTime.AddMilliseconds(repeatDelayMS); } scheduleRepeatCallback(nextCallbackTime); } else { UnscheduleCallback(callbackId); } } } } } } catch (Exception ex) { string errorMessage = "Failed to raise callback: " + ex.Message; SensusServiceHelper.Get().Logger.Log(errorMessage, LoggingLevel.Normal, GetType()); try { Insights.Report(new Exception(errorMessage, ex), Insights.Severity.Critical); } catch (Exception) { } } finally { finishedCallback?.Invoke(); } }); }
protected override void InitializePlatformSpecific(string insightsKey) { Insights.Initialize(insightsKey); }
public static void HandleException(Exception exception) { Debug.WriteLine("Exception caught" + exception); Insights.Report(exception); }
public override void OnStart() { base.OnStart(); Insights.Track(this.GetType().Name); }
public void ShowNewFolderDialog() { LayoutInflater factory = LayoutInflateHelper.GetLayoutInflater(homeActivity); View viewNewFolder = factory.Inflate(Resource.Layout.dialog_new_folder, null); EditText editTextFolderName = (EditText)viewNewFolder.FindViewById <EditText> (Resource.Id.editText_dialog_folder_name); //Build the dialog var dialogBuilder = new AlertDialog.Builder(homeActivity); dialogBuilder.SetTitle(Resource.String.folder_new); dialogBuilder.SetView(viewNewFolder); dialogBuilder.SetPositiveButton(Resource.String.add, (EventHandler <DialogClickEventArgs>)null); dialogBuilder.SetNegativeButton(Resource.String.cancel, (EventHandler <DialogClickEventArgs>)null); var dialog = dialogBuilder.Create(); dialog.Show(); //Get the buttons var buttonAddFolder = dialog.GetButton((int)DialogButtonType.Positive); var buttonCancel = dialog.GetButton((int)DialogButtonType.Negative); buttonAddFolder.Click += async(sender, args) => { if (String.IsNullOrEmpty(editTextFolderName.Text)) { homeActivity.ShowToast("Naam is niet ingevuld"); } else { homeActivity.ShowProgressDialog("Map wordt aangemaakt. Een ogenblik geduld a.u.b."); try{ int numberOfDirectoriesOpened = ExplorerFragment.openedDirectories.Count; string directoryNameToUploadFileTo = ExplorerFragment.openedDirectories [numberOfDirectoriesOpened - 1]; bool addedSuccesfully = (await DataLayer.Instance.CreateFolder(System.IO.Path.Combine(directoryNameToUploadFileTo, (editTextFolderName.Text)))); dialog.Dismiss(); if (!addedSuccesfully) { homeActivity.HideProgressDialog(); homeActivity.ShowToast("Toevoegen map mislukt. Probeer het a.u.b. opnieuw"); } else { homeActivity.HideProgressDialog(); homeActivity.ShowToast("Map succesvol toegevoegd"); //Refresh data homeActivity.RefreshExplorerFragmentData(); } }catch (Exception ex) { Insights.Report(ex); homeActivity.HideProgressDialog(); homeActivity.ShowToast("Toevoegen map mislukt. Probeer het a.u.b. opnieuw"); } } }; buttonCancel.Click += (sender, args) => { dialog.Dismiss(); }; }
private void InitPlugins() { CachedImageRenderer.Init(); Toolkit.Init(); Insights.Initialize(Keys.XamarinInsightsKey, this); }
public override void OnChange(bool selfChange, global::Android.Net.Uri uri) { // for some reason, we get multiple calls to OnChange for the same outgoing text. ignore repeats. if (_mostRecentlyObservedSmsURI != null && uri.ToString() == _mostRecentlyObservedSmsURI) return; // TODO: Fix issue #75 -- need to handle MMS. they are structured differently than SMS, and the code below does not work. if (uri.ToString() == "content://sms/raw") return; ICursor cursor = _context.ContentResolver.Query(uri, null, null, null, null); if (cursor.MoveToNext()) { // we've been seeing some issues with missing fields: https://insights.xamarin.com/app/Sensus-Production/issues/23 // catch any exceptions that occur here and report them. try { string protocol = cursor.GetString(cursor.GetColumnIndexOrThrow("protocol")); int type = cursor.GetInt(cursor.GetColumnIndexOrThrow("type")); int sentMessageType; // https://github.com/predictive-technology-laboratory/sensus/wiki/Backwards-Compatibility #if __ANDROID_19__ if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat) sentMessageType = (int)SmsMessageType.Sent; // API level 19 else #endif sentMessageType = 2; if (protocol != null || type != sentMessageType) return; string toNumber = cursor.GetString(cursor.GetColumnIndexOrThrow("address")); long unixTimeMS = cursor.GetLong(cursor.GetColumnIndexOrThrow("date")); DateTimeOffset dotNetDateTime = new DateTimeOffset(1970, 1, 1, 0, 0, 0, new TimeSpan()).AddMilliseconds(unixTimeMS); string message = cursor.GetString(cursor.GetColumnIndexOrThrow("body")); _outgoingSMS(new SmsDatum(dotNetDateTime, null, toNumber, message, true)); _mostRecentlyObservedSmsURI = uri.ToString(); } catch (Exception ex) { // if anything goes wrong, report exception to Insights try { Insights.Report(ex, Insights.Severity.Error); } catch { } } finally { // always close cursor try { cursor.Close(); } catch { } } } }
public Task PurgePendingCrashReports() { return(Insights.PurgePendingCrashReports()); }
private async void LoadInspos() { try { //check is device is connected to the internet var content = await _client.GetStringAsync(url_photo); var posts = JsonConvert.DeserializeObject <List <Inspo> >(content); //Sort list after Categories if/else statement if (_category == "Eyes") { posts.RemoveAll(inspo => !inspo.Tags.Contains <string>("Eyes")); this.Title = "EYES"; } else if (_category == "Lips") { posts.RemoveAll(inspo => !inspo.Tags.Contains <string>("Lips")); this.Title = "LIPS"; } else if (_category == "Eyebrows") { posts.RemoveAll(inspo => !inspo.Tags.Contains <string>("Eyebrows")); this.Title = "EYEBROWS"; } else if (_category == "Contouring") { posts.RemoveAll(inspo => !inspo.Tags.Contains <string>("Contouring")); this.Title = "COUNTOURING"; } else if (_category == "Night") { posts.RemoveAll(inspo => !inspo.Tags.Contains <string>("Night")); this.Title = "NIGHT"; } else if (_category == "Day") { posts.RemoveAll(inspo => !inspo.Tags.Contains <string>("Day")); this.Title = "DAY"; } else if (_category == "Trending") { posts.RemoveAll(inspo => !inspo.Tags.Contains <string>("Trending")); this.Title = "TRENDING"; } else if (_category == "EditorsPick") { posts.RemoveAll(inspo => !inspo.Tags.Contains <string>("EditorsPick")); this.Title = "EDITOR's PICK"; } DiscoverInsposList_Sorted = new ObservableCollection <Inspo>( posts .Where(i => !_blockedUserList.Contains(i.UserId)) .OrderByDescending(i => i.InspoCreated) .OrderByDescending(i => i.InspoCreated) .OrderByDescending(i => i.Points) ); listviewInspo.ItemsSource = DiscoverInsposList_Sorted; if (listviewInspo.IsRefreshing == true) { listviewInspo.IsRefreshing = false; } } catch (Exception e) { try { Insights.Report(e); await DisplayAlert("Useless", "I tried to load the inspos, but I failed. Horribly.", "Be better"); } catch { await DisplayAlert("Error", "Error when trying to connect! Something is wrong! HELP!", "Jesus, calm down already."); } } finally { this.IsBusy = false; } base.OnAppearing(); }
public override void OnCreate() { base.OnCreate(); Insights.Initialize("951f79208700699208f428bfed2efe78eb950895", Context); RegisterActivityLifecycleCallbacks(this); }
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 void Report(Exception exception, IDictionary extraData, Insights.Severity warningLevel = Insights.Severity.Warning) { Insights.Report(exception, extraData, warningLevel); }
public static async Task <string> GetPhotoEmotionScore(Emotion[] emotionResults, int emotionResultNumber, EmotionType currentEmotionType) { float rawEmotionScore; var isInternetConnectionAvilable = await ConnectionService.IsInternetConnectionAvailable().ConfigureAwait(false); if (!isInternetConnectionAvilable) { return(ErrorMessageDictionary[ErrorMessageType.ConnectionToCognitiveServicesFailed]); } if (emotionResults == null || emotionResults.Length < 1) { return(ErrorMessageDictionary[ErrorMessageType.NoFaceDetected]); } if (emotionResults.Length > 1) { OnMultipleFacesDetectedAlertTriggered(); return(ErrorMessageDictionary[ErrorMessageType.MultipleFacesDetected]); } try { switch (currentEmotionType) { case EmotionType.Anger: rawEmotionScore = emotionResults[emotionResultNumber].Scores.Anger; break; case EmotionType.Contempt: rawEmotionScore = emotionResults[emotionResultNumber].Scores.Contempt; break; case EmotionType.Disgust: rawEmotionScore = emotionResults[emotionResultNumber].Scores.Disgust; break; case EmotionType.Fear: rawEmotionScore = emotionResults[emotionResultNumber].Scores.Fear; break; case EmotionType.Happiness: rawEmotionScore = emotionResults[emotionResultNumber].Scores.Happiness; break; case EmotionType.Neutral: rawEmotionScore = emotionResults[emotionResultNumber].Scores.Neutral; break; case EmotionType.Sadness: rawEmotionScore = emotionResults[emotionResultNumber].Scores.Sadness; break; case EmotionType.Surprise: rawEmotionScore = emotionResults[emotionResultNumber].Scores.Surprise; break; default: return(ErrorMessageDictionary[ErrorMessageType.GenericError]); } var emotionScoreAsPercentage = ConversionService.ConvertFloatToPercentage(rawEmotionScore); return(emotionScoreAsPercentage); } catch (Exception e) { Insights.Report(e); return(ErrorMessageDictionary[ErrorMessageType.GenericError]); } }
public void Identify(string uid, string key, string value) { Insights.Identify(uid, key, value); }