I am developing a mobile (Xamarin.IOS) and a desktop app (C# Winforms) for our small start-up for internal use. I want to be able to send commands (not remote notifications) to the client (mobile app) through our main desktop app.
For example; I want all our employees using our mobile app to perform certain task, let's say, show a popup window with specific text when they open up the app. Any ideas about how to implement such kind of thing? Is is technically possible to tell a device to remotely execute certain management commands?
Thanks in advance.
There are multiple ways of doing this.
A Microsoft MVP, Mark Arteaga, suggests using Azure Functions-HTTP Triggers to do this. He presented this in multiple Microsoft events and also has a Github repo where he implements it in a sample mobile app.
So whenever you need to, you would send commands through Azure Functions to the client using similar, and if you want to go one step further, you can even look into implementing it with Backgrounding using Shiny
Related
I'm implementing a game in Unity and I have a problem that I need advise for. I want to connect a tablet and a computer. The scene that is on the computer is supposed so send an event once an object is collected so that a special scene can be shown on the tablet. So based on what is happening on the computer there is a different scene shown on the tablet.
I only have no idea how to achieve that.
First, you need to create 2 different applications (for desktop and mobile). Second, you need to determine what protocol you want to connect desktop app and mobile app. The easiest way to implement this I think by using WebSocket/internet but not HTTP. Yes, you need to write code for the backend so it likes creating 3 different apps. But you can use firebase to simplify this process.
I recommended you use firestore from firebase. Connect booth app to firestore. When desktop app sends data to firestore, firebase will automatically notify mobile app and send that data. But you need to figure out yourself how to pair a desktop app and a mobile app otherwise, your firestore will receive data from all connected desktop app and send the same data to all connected mobile app.
This tutorial to use firestore:
https://www.youtube.com/watch?v=b5h1bVGhuRk
But before that, you need to add firebase to your project before you add firestore:
https://firebase.google.com/docs/unity/setup
You can use any wireless protocol available. You can even use Bluetooth if you want your app offline. But I don't know how to use Bluetooth...
I would like to add/start/stop/remove an application (IoT Core) just like the web interface or the Power Shell commands: "IotStartup" but from within a C# application running on the IoT Core itself.
Is there a c# API for this or do I have to implement the Power Shell commands inside my application?
Using the Device Portal API could work for you.
Here are the docs.
https://learn.microsoft.com/en-us/windows/uwp/debug-test-perf/device-portal-api-core
Device Portal APIs are intended for remote management, and may not work from within a UWP against localhost due to loopback restrictions in Windows (to prevent an app from attacking the device it's running on).
That said, the Windows.Management.Deployment.PackageManager class provides installation and removal APIs for apps. To launch an app, you can use Windows.System.Launcher. Note that PackageManager is a restricted capability, so the app won't be able to go into the Store without special permissions from Microsoft. It will work in sideloaded scenarios though.
There is no way to close an app from another app with existing APIs. However, Launching the app using the above, then connecting with an AppServiceConnection to manage it, you can send a "Close" message over the AppServiceConnection that causes the app to close itself.
Ive made a Windows Form Application and all is working fine on that.
but what im trying to do is make it so people have a mobile App(that ill end up making) that will allow them to be away from the PC and push a button on the mobile app that will send someform or command to the Winform Application and get it to trigger a button click event.
E.G
Winform is open on PC has a button on it that will play or pause music.
I go get a drink downstairs and i want to pause the music from the mobile app.
Push the button on the mobile app and it connects to the Winform application and triggers the event for the pause button.
If anyone can help me out with this or put me in the right direction to do somthing like this that would be great. thank you.
Ben
Basically what you just described is that you need to build a mobile application.
There are several tools that allow you to move your application to web. I used to work with these guys, they were called Artinsoft at the time but they are now called Mobilize.net, and they have a tool for making this conversion: www.mobilize.net/press/topic/convert-windows-to-web
However in your cases it seems like what you are trying to build is a remote control, in this case you need to either expose an endpoint for a mobile app to connect to or create a centralized server that both the remote and Winforms connect to.
I suggest using a TCP/IP connection. I don't know anything about mobile development, so I'll just focus on .NET and the concepts should carry-over.
System.Net.Sockets contains TCP classes for opening connections to hosts/clients. I'd recommend that the desktop-app acts as the host while the mobile-app is the client.
There are plenty of online articles on the subject, so take one and explore it's code until you understand it. Then, prototype your task on a single desktop machine using two-different .NET programs, one for the host (mimics the desktop program in the final project) and the other as the client (mimics the mobile-app in the final project). Then, learn the mobile API for networking and mimic what you did in the client-test program on-to the mobile platform project.
I'm working on a net based POS system and need to enable silent printing.
(Print without displaying the PrintDialog).
I have managed to get it working but at times when cashiers want to generate new vouchers it does not print and this is becoming a problem.
I have been instructed to create a Windows Forms app that will be installed on all of my cashiers machines, what this app needs to do is once the cashiers log onto the website and sells a voucher i need data to be sent from my ASP.NET website to the Windows form application where the silent print can take place, so as soon as the cashiers clicks on the 'Sell Voucher' button the data must be sent to the installed windows app and print automatically.
The data that will be sent to the cashiers machines is basic info like Cashier Name, Account Name, Site...etc
How would i go about achieving this result?
Thank you in advance.
The two apps will probably need to share a single data source (e.g. using SQL Server).
If the printing needs to happen silently, without user intervention, then you will need to implement a listener (typically as a Windows Service) that waits for new items to be added and are ready to print.
See: Publish-subscribe pattern or, alternatively, Observer Pattern.
Look into WCF or signalr.net
for signalR there is a .net client for easy implementation into a windows app
I have a project I'm working on that requires our WPF application read SMS messages off of a user's connected Windows Mobile phone so we can display recent ones, etc.
I've had little luck with any of the libraries I've found. Most promising seemed to be OpenNETCF.Desktop.Communications but ultimately it seems like I won't be able to do what I need to with it.
What's the best way to read SMS messages off of a connected phone? Will it just be easier for me to write some sort of service app for the phone that acts as a server and our WPF app as the client?
Thanks!
There's nothing out-of-the-box that will do what you want. RAPI, which the OpenNETCF library wraps, has a set of communication APIs, but nothing for SMS. It does have the ability to snap-in custom APIs, so you could create a custom API and use that. The advantage with this strategy is you don't need any user intervention to get stuff onto the device (no copy and run of a service app stuff). The down side is that the custom RAPI DLL for the device must be native code.
If you go with your own mechanism, you can then use the POOM APIs in managed code to get the messages and ship them. The only challenge there is that you have to run some form of a "service" app on the device to listen for calls, which means writing your own protocol, which means a fairly large test matrix.
Jeyo have a product that pulls SMS messages from a phone into outlook PST files. Strikes me that you could just use that product and trawl the PST for recent messages (bit of a kludge I know, but if you were desperate) or talk to them about if they'll licence some of their code for you?