Dynatrace implementation in Xamarin Forms - xamarin.forms

How do I log a button tap event or a method call event in my Xamarin Forms (iOS) app for logging details in Dynatrace Dashboard.
Have followed the implementation process as mentioned in
https://www.dynatrace.com/support/help/how-to-use-dynatrace/real-user-monitoring/setup-and-configuration/mobile-apps/development-frameworks/xamarin-nuget
But Unable to implement code to log events

call using the below way using dependency service,
IDynatrace dynatrace = DependencyService.Get<IDynatrace>();
dynatrace.SendBizEvent("your business type event", new Dictionary<string, object> { });

Related

ASP.NET MVC5 code event in Controller should reload View

In my MVC5 application, users log in from external software without a separate login. After some times the external application can be closed and in this case a login form should appear.
I receive an event
Software.DataChange + = delegate ()
{
.... code goes here
IsUserLoggedIn = false;
};
And now the globally defined variable IsUserLoggedIn changes.
Now the login view should be called. And that's where my problems begin.
Can I do this in the controller?
Or can I assign a field via SignalR and then trigger a reload of the page? SignalR is already used for some progress bars.
Thanks
Ottilie

Azure AD B2C Xamarin Forms - After Successful login OnAppearing method executing again

This is iOS specific issue.
I have completed all the steps suggested in document over here https://azure.microsoft.com/en-in/resources/samples/active-directory-b2c-xamarin-native/
In Andtoid it is working fine. But in iOS it is not returning back to application after successful login.
Yes, Login page is displaying properly we can enter the credentials over there but once login in successful then browser is closed but debugger not attaching back to application.
I have Eneabled Keychain access, Added Url Types in info.plist and also added below code to AppDelegate.cs
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{
AuthenticationContinuationHelper.SetAuthenticationContinuationEventArgs(url);
return true;
}
And on FInishLaunching event I have added below code
var authenticationService = DependencyService.Get();
// Default system browser
authenticationService.SetParent(null);
Actually I am calling SignInAsync method from OnAppearing event of view. So after successful validation OnAppearing event is firing again and it lost the previous flow.
Please let me know if I am missing something. Your help is much appreciated.
Thanks.

Subscribing to an Azure Event Grid topic directly from an Angular client

I'm working on an application that needs to respond to events from a third-party WebHook. I chose Azure Event Grid as my chosen event broker, Angular for the frontend and Asp.Net Core for the backend.
In my current solution, I'm publishing to the Azure Event Grid from the WebHook using an HTTP triggered Azure Function. This function formats the third-party event to the correct Azure Event Grid format (with the concerned event user as the subject, and the event type the WebHook event type). For now, the event grid events are pushed to my Asp.Net backend using a WebHook Azure Event Grid subscription.
My issue is that some of the events only concern the frontend (like reminders/light notifications), and thus I want to directly publish the event from Event Grid to the frontend, without using a WebSocket to an endpoint in my backend.
I'm currently using SignalR to create a WebSocket connection between Angular and Asp.Net Core, but I don't want to overload my backend with sending events that will just be redirected to Angular.
Is there a way to directly subscribe to Azure Event Grid using a WebSocket connection? What would be the most optimal solution in terms of minimal pushing/polling? Or should I just switch to another event broker with a JavaScript library (like RabbitMQ)?
The Azure SignalR Service can help you integrate your clients such as Asp.net, Angular, etc. for consuming the Azure Event Grid events. The following screen snippet shows an example of your logical subscriber (client) using a webhook event handler endpoint.
As the above picture shows, the EventGridTrigger function represents an integrator to the Azure SignalR Service. The AF has been extended for SignalR Service bindings, see more details here.
Using this extension, the EventGridTrigger function as an integrator to SignalR Service is very straightforward and lightweight, see the following an example:
#r "Microsoft.Azure.EventGrid"
#r "Microsoft.Azure.WebJobs.Extensions.SignalRService"
#r "Newtonsoft.Json"
using Microsoft.Azure.EventGrid.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Microsoft.Azure.WebJobs.Extensions.SignalRService;
public static async Task Run(EventGridEvent eventGridEvent, IAsyncCollector<SignalRMessage> signalRMessages, ILogger log)
{
await signalRMessages.AddAsync(
new SignalRMessage
{
Target = "Notify",
Arguments = new[] { eventGridEvent.Data.ToString() }
});
}
and the function.json:
{
"bindings": [
{
"type": "eventGridTrigger",
"name": "eventGridEvent",
"direction": "in"
},
{
"type": "signalR",
"name": "signalRMessages",
"hubName": "mySignalRService/users/myClientId",
"connectionStringSetting": "AzureSignalRConnectionString",
"direction": "out"
}
]
}
Also, have a look at more examples (e.g. codeproject, github, here) for using an Azure SignalR Service on the client side.

"System.Net.HttpListener" not available in IAppBuilder properties

I am developing a web app with mix authentication (Owin Token Based and Windows authentication). I have implemented Owin token based authentication and want to implement windows authentication for the users which are marked as active directory users.
In Owin middleware, I want to get requesting user's windows username. I am getting object in OwinContext.Request.User.Identity. However, OwinContext.Request.User.Identity.Name is always blank string.
I found that I should add below lines in startup.cs:
var listener = (HttpListener)app.Properties["System.Net.HttpListener"];
listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication;
However, I am getting key not found exception. "System.Net.HttpListener" is not present in Properties array. I have installed Microsoft.Owin.SelfHost, Microsoft.Owin.Host.HttpListener. However, I am still getting the error.
Any help is greatly appreciated.
Thanks,
GB
For me issue was that project was started as shared lib, not a web app.
Solution was to add a line into .cspro file after <ProjectGuid> line.
<ProjectTypeGuids>{349C5851-65DF-11DA-9384-00065B846F21};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Then you dont need to add HttpListener explicitly, just reload project and follow this instructions starting from Properties edition part.
Enabling Windows Authentication in Katana
You can access principal the same ways:
Get the user in an OWIN middleware:
public async Task Invoke(IDictionary<string, object> env)
{
OwinContext context = new OwinContext(env);
WindowsPrincipal user = context.Request.User as WindowsPrincipal;
//...
}
Get the user in a Web API Controller:
// In a web api controller function
WindowsPrincipal user = RequestContext.Principal as WindowsPrincipal;
UPD: List of Visual Studio Projects GUIDs

ASP.NET MVC - Real time updates using Web Service

I'm trying to find examples on how to get real time updates using a web service in ASP.NET MVC (Version doesn't matter) and posting it back to a specific user's browser window.
A perfect example would be a type of chat system like that of facebooks' where responses are send to the appropriate browser(client) whenever a message has been posted instead of creating a javascript timer on the page that checks for new messages every 5 seconds. I've heard tons of times about types of sync programs out there, but i'm looking for this in code, not using a third party software.
What i'm looking to do specifically:
I'm trying to create a web browser chat client that is SQL and Web Service based in ASP.NET MVC. When you have 2-4 different usernames logged into the system they chat and send messages to each other that is saved in an SQL database, then when there has been a new entry (or someone sent a new message) the Web Service see's this change and then shows the receiving user the new updated message. E.G Full Chat Synced Chat using a Web Service.
The thing that really stomps me in general is I have no idea how to detect if something new is added to an SQL table, and also I have no idea how to send information from SQL to a specific user's web browser. So if there are people userA, userB, userC all on the website, i don't know how to only show a message to userC if they are all under the username "guest". I would love to know hot to do this feature not only for what i'm trying to create now, but for future projects as well.
Can anyone point me into the right direction please? I know SQL pretty well, and web services i'm intermediate with.
You can use SignalR for this task.
Via Scott Hanselman:
Create Asp.net mvc empty application
install nuget package of SignalR
Add new Controller (as example HomeController):
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
Create view Index with javascript references:
#Url.Content("~/Scripts/jquery-1.6.4.min.js")"
"#Url.Content("~/Scripts/jquery.signalR.js")"
and function:
$(function () {
var hub = $.connection.chatHub;
hub.AddMessage = function (msg) {
$('#messages').append('<li>' + msg + '</li>');
};
$.connection.hub.start().done(function() {
$('#send').click(function() {
hub.send($('#msg').val());
});
});
});
Create class ChatHub:
public class ChatHub:Hub
{
public void Send(string message)
{
Clients.AddMessage(message);
}
}

Resources