Chat implementation in windows form using SignalR - windows

I am trying to implement chat application in windows form using SignalR. Actually I had created the web chat application using signalR now i want to synchronize it with windows application.
I am facing following problems
1) How to initialize the hub class as in web application we initialize it in javascript on page load. So how can we innitialize the hub and in web application there is global file to maphub for dynamically generating the signalr javascript so where in windows application can i map the hub to dynamically generate the same.
2) As i want to synchronize the windows application with the web application so do i need to keep both the projects under one solution or can i synchronize the two different solutions??
Please provide the startup code for the first problem as i have searched alot but not getting any way to implement the chat in windows form. the code i found on net just raising errors but helping me in any sense.

This is a full working sample for using SignalR in WinForms and WPF
You can download it and play with it.
There is a WinForms Server and Client which can be your starting point.
It is a good idea to keep the projects under one solution, but its up to you. The WinForms projects will need a server URL where they can communicate with each other (you can see this in the sample code from the above link)

Related

How to Run SignalR service as a Server in Xamarin

I have a requirement were I need to run SignalR server in Xamarin app, and consume it in web app. As far as I have seen in examples, Xamarin is used as a client consuming the SignalR. Can anyone help me how to register and start SignalR in Xamarin like we do in dotnet core app as below
services.AddSignalR();
app.UseSignalR(routes => {
routes.MapHub<HubName>("path");
});
Is there a way were I can run same/alternative code in Xamarin. Thanks
Your above code, those are used in asp.net core webapp. What I currently know is that you can use SingalR Self-Host to achieve your needs, but it seems that .net core cannot be used, because the official documents are based on .net framework.
Official sample uses the console application, and this article uses windows service.
By using Microsoft.AspNet.SignalR.SelfHost package can achieve your needs.

How to host ms bot created in c# or composer in windows service?

We must use C# MS bot in windows service. How to implement it in .Net core for MSBot SDKv4?
All samples using IIS/Azure App service as hosting platform.
They're aren't any examples or samples that show how to explicitly do this. But you should be able to follow articles such as this or this and then tweak as needed. It shouldn't be much different than hosting any other asp.net core application.
The two points to make sure and cover are:
Make sure that the bot/application is configured (whether in appsettings.json or otherwise) so that it has the right configuration data. Specifically appid/password
Ensure the endpoint can be hit by the connector/channels.

Phonegap App using Application express database

I'm about to make an application using phonegap but the database I have to use is already used by a web app made with oracle application express. So I wanted to know is there a way of creating a web service inside that web app to retrieve the data on my mobile app ?
The second option I was thinking about is not passing by the apex web app, but just trying to use a WS to access the oracle database (with all the problems I will have to face at deployment). Can someone give me some directives ? Thanks in advance.
One quick google search will give you a couple of presentations (1) (2)
About integration between Apex and Phonegap, and a book

Windows 8 Application Packaging

I am working on creating a Windows 8 application. UI is using HTML5. Using WinJs I am calling a WCF service that returns a datatable used to build out the UI. All that is good.
I would also like to create a Window Service that gets packaged up with the application, so when someone download/installs it gets unpackaged and the windows service is started/executed. Is this type of configuration possible?
The WCF service today is a web service, but I would like to make it a windows service. The idea is to make everything self contained. This would allow me to make it available in the Microsoft Online store - if I wanted to go that route.
Windows 8 Applications don't support installing services. The best you can do is install a service separately.
Your WCF service should be decoupled from your app and most probably running on a different machine! I am pretty sure that the they are not going to allow you to install or run services in context of a Windows Store App.
Installing a windows service is not an ideal approach for any Windows 8 application. I understand that you want to make everythig self contained but, why as a WCF local service then? Why don't you consider having it has a data access layer in your app itself? Just a thought.
REGARDING CLIENT SIDE
Web services are separate projects and separate deployment models. You can have one Visual Studio project for the Windows 8 client app and one project for the Web Services side.
Windows 8 apps have several options for saving persistent data, such as endpoints for consuming web services.
There are several consideration when storing Windows 8 application data, such as the location of web services to be consumed.
Windows 8 Application data also includes session state, user preferences, and other settings. It is created, read, updated, and deleted when the app is running.
There are 3 types of dimensions to consider. The system manages these data stores for your app:
(1) local: Persistent data that exists only on the current device
(2) roaming: Data that exists on all devices on which the user has installed the app
(3) temporary: Data that could be removed by the system any time the app isn't running
As a developer, you concern yourself with a couple of objects to persist application data:
The first container object is ApplicationDataContainer. The other is ApplicationData. You can use these objects to store your local, roaming, or temporary data.
REGARDING SERVER SIDE
Your Windows 8 Client app will consume http-based web services.
Most developers deploy web services to the cloud to be consumed by iOS, Android, Windows, and other server side services.
Windows Azure is a cloud offering that makes exposing services to clients very simple.
You can leverage either cloud services for robust solutions or the lighter weight Azure Web Sites.
You can typically choose either of these two project types to create web services:
(1) Windows Communication Foundation WCF; or
(2) ASP.NET Web API, which is included with MVC version 4.
WCF has been around longer and has historically been the primary choice for developers when it comes to exposing services.
Microsoft's more modern concepts about web services relate to the ASP.NET Web API, which truly embracing HTTP concepts (URIs and verbs). Also, the ASP.NET Web API can be used to create services that leverage request/response headers, hypermedia, etc.

Visual studio Lightswitch - Version management

I have a business LS web application which I update from time to time.
I do the update by simply using the deploy wizard and everything is working great.
My problem is handling all my users that opened my system in their IE and left it open through my deploy process.
Since they have the old web application is opened on their browsers, and I have deployed the new version to the server, I can see errors occuring in certain situations.
Is there a way to make sure all users with the application opened will be forced to refresh the web application page? Maybe remotely disconnect all currently connected users?
There is no built in way of doing this. You will need to write a custom solution. Someone in the MSDN Forums has written a class to do this for OOB apps.
You should be able to reuse the timer part of that class. I'm not sure if the UpdateAvailable method will work for Web-based applications or not. You'll have to experiment with that.
Alternatively, you can create a custom notification system. Insert a message to your users into a table in your database from the administrator account. Have a timer on the user account check the table every so often. If it finds a new message, display a notification to the user.
Then you can use either an HTTP Response Header or an ASP method to log the users out as described in this Microsoft Support article.

Resources