User Specific DLL for UWP - c#

I am looking for a way to update a UWP Library for a specific user, the app is hooked into a server that I could easily send the new .dll file down with, can I just replace the file in the install folder like I could in WPF or a windows service? Or could I have a second app that could do this when the original app isn't running?

I really dont think this is possible because UWP apps run in a sandbox. You could not create a second app to update the first because it would not be able to access the files of the first app.

Related

Trying to get Hard Drive Serial Number into a SQL Server via UWP app

I'm a relatively new Developer building my first app.
Right now I'm in the process of developing a UWP app and I am needing to get the Hard Drive Serial number from the PC from the Views (OnNavigatedTo), then after a few more fields are filled out, to then save all values to a SQL Server.
What I have discovered up to this point:
Grabbing some values like Hard Drive SN are not so easy with UWP.
I don't seem to have access to Registry HKLM via UWP
I can grab it very easily with PowerShell, and write it to a JSON or XML file. which I plan to do with a Service Account when PC is imaged.
I Don't know where to put the file where the App can see it.
Writing to Sql Server can only be done by creating a webservice and making HTTP / JSON calls via App. (I have this part setup but have not started accessing it via app yet)
So the part I really need help with I guess, is Where to Put JSON/XML file that App will be able to see and read from. Unless of course, someone knows of another way to get Hard Drive SN into a UWP app.
Thanks for Any Help
The recommended way to do this (if you want to go to the Windows Store) is to use a FileOpenPicker and have the user choose the file manually.
If this is for side-loading only (not going to the Windows Store) you can write the file to the user's Documents folder and then the UWP can read it using documentsLibrary capability without any user intervention. You could also use a fullTrust extension to run the PowerShell script and to put the file in the app's data folder. You can check out the Desktop Bridge docs for more info on fullTrust extensions.

How to create a background application using UWP without UI?

I need to run a BLE Discovery in background and need to show toast when a device found.This is done using UWP with UI. But I need only background application. Is there any way?
Firstly I think that it is good to clarify that even if you want to create UWP app that works in background you have to create normal Universal Windows Application from template in Visual Studio:
Each UWP application can register Background Task to perform some background operations.
You can find the whole implementation guide under below link:
https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/create-and-register-a-background-task
Background task has to be registered by the app so there is no way to create only Background task without the app.
Please also remember that application without UI will not pass Windows Store certification.
Lukmanul Hakim,
I have been facing a similar problem and found the best way is through a windows service. In particular:
BluetoothLEAdvertisementWatcher works in Windows services, unit test projects, and UWP packages (with the right manifest capabilities).
The advertisment watcher executes but does not deliver data/events in WPF desktop apps and .net command line programs.
As you note, UWP seems to require annoying UI and can only communicate in a limited way via app services.
Once you have the data in a windows service, you can do work there or communicate with any desktop app using regular IPC mechanisms like named pipes.
You will need to install the Windows 10 SDK and reference the windows runtime typically at: C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd
For reference here is the basic code to get advertisments:
var watcher = new BluetoothLEAdvertisementWatcher();
watcher.Received += OnAdvertismentReceived;
watcher.Start();

Run desktop app via WEB app

I have desktop application that can be installed on the users computer with "setup" msi file like any other application.
I'm developing web application and I need somehow to integrate the desktop application with the web application. Web application is developed using PHP (desktop application is developed using C#), and when clicking on one button on the web application, the desktop application needs to be launched.
Is there a way of doing this? I was thinking about a few scenarios:
-Maybe if possible to install the app directly on the server and to launch it from there?
-Maybe to be required the user to have the app installed on his computer and to call the app from there?
If possible I would prefer to not use the second approach because it's better if the third party to not be involved - it will be more user friendly if the application is launched directly. But any help will be appreciated because at this point I'm not sure if that is possible to be done at all.
You can install app at server an run it with exec() or "`" operator - but to control gui of app you need to use some like autoit ant etc.
If you ultimately decide to require your users to have the client application installed and expect majority of the users to be on Windows, you could register your application to handle specific scheme and parse its command line when started. More on this here:
http://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx
You'd register a custom scheme and then intercept in in the application's command line arguments. The whole URL will be passed as an argument, e.g.:
myapp://parameter1,parameter2
The browser will mostly ask whether or not the user trusts the application to handle this scheme with an option to remember this setting.
If you don't have access to the source code of the client application, you can develop a middleware, some sort of a launcher that handles the URL and then runs the client application after maybe modifying some configuration files based on the URL or otherwise controlling the third-party application to do as you with.
As for solution #1, I don't think C# matters if your application can run on Mono, so you should be able to just run it from PHP. However, this probably won't work on web hosting and you will have to get a VPS for that.
There are very good (security) reasons why it is hard to launch client-side processes from web browsers.
Do you have access to the source code of the C# app? If so, you could consider modifying it to take advantage of Microsoft ClickOnce deployment.
Some references:
http://msdn.microsoft.com/en-us/library/t71a733d.aspx
http://msdn.microsoft.com/en-us/library/t71a733d(v=vs.80).aspx
http://msdn.microsoft.com/en-us/library/6ae39a7c.aspx
http://www.codemag.com/Article/0902031
Here's an old article on deploying WinForms applications via ClickOnce with Visual Studio 2005: http://msdn.microsoft.com/en-us/library/ms953320.aspx
It can possibly be done with IIS but it can be cumbersome setting it up to run as the current user, especially since it would probably also need to run elevated for an app that needs to attach to the current user's desktop.
Easiest is to install a Windows LAMP distro (like WAMP: http://www.wampserver.com/en/) and then run the httpd.exe directly from an elevated (Admin) command prompt; do not run apache as a service!
Once you do this performing and exec("command"); call in php will bring up a desktop app as if it was invoked from an admin command prompt. Obviously you need to set up the apache server to be accessible from outside the local system, etc.

Is there a possibility to start another App or Program from a Windows 8 Store App (C#)

I want to start another App or Program from my Windows Store App. For example my App is showing emails, so if someone clicks on such an email Outlook should open. Is this possible in an "App-Sandbox"?
It is not possible to just launch an arbitrary application, but with custom protocol activation you can launch an app that handles that protocol and if it is not installed - the OS will ask the user to install it. It means that if you can define a custom protocol in your app - you can launch it from another app with this protocol assuming no other app registers to handle it. An example of that is any XBOX Live app - if you check their manifest files - they all handle custom protocols.
If your specific question is about launching a specific app by name or location then no, this is not possible, but if you know a protocol handled by the app you want to launch - you can try using that - just bear in mind that there might be other apps that handle that protocol.
Short answer: no, it's not possible.
You can open files with their associated application but not spawn any arbitrary external process.
As #mitch-wheat pointed out, that's why it's called a sandbox.
Check out this sample
The sample is for Windows 8.1 but I think will work for Windows 8 as well.

How do you download app from app store from C# app?

I am looking for a way to downloa an app store app to my PC from a C# program.
I need it to be done automatically and without leaving the program's context.
I have 2 ideas
1. using iTunes
2. implementing a component that uses the app store protocol for download
So...
How can I invoke iTunes and have download a specified app programaticaly?
Are there any documentation on App Store protocol?
Thanks,
Guy

Categories