Change Windows 8.1 lock screen image via WPF application - c#

I'm trying to change Windows 8.1 (desktop) lock screen image from WPF application.
I've found solution with Windows SDK approach, but it uses runtime application as example (actually, all information I've found was regarding to WinRT apps). But I don't want to use WinRT - all I want is to use LockScreen class in plain old WPF.
After all I have managed to do this in the WPF app several times. This included:
1) manually adding <TargetPlatformVersion/>8.1</TargetPlatformVersion> into .csproj as suggested here;
2) adding references to Windows and System.Runtime.WindowsRuntime as suggested ibid;
3) following these steps to change lock screen background
Then I've faced the problem with platform - application does what it should only with x64 platform (not anyCPU). And not each time (I could not determine consistency yet).
Any way I think that I am over-complicating the solution. Does anyone have other suggestions? Is there any other simpler/cleaner way to change Windows 8.1 lock screen image via WPF application?

Related

How to Launch UWP app from Task Scheduler

I have an app that converts UWP InkCanvas drawings into SVG from UWP native ISF. I need to run it daily, and the conversion logic does not work in either Console apps, WPF apps or Windows Forms apps with Ink Canvas - as there appear to be differences between as to how InkCanvas data is serialized on these other platforms.
I'm looking for a way to launch the UWP app on a schedule - so any pointers in that direction are greatly appreciated.
I do understand that using the UWP apps in this way is probably not a recommended scenario - unfortunately I do not have control over the app that produces these drawings initially - but I do need to convert them to SVG.
If your UWP application is registered to a URI schema it's relatively straightforward to do.
For the scheduled task set explorer.exe as the app, and your-app-schema:// as the parameter.
You can check the schemas and registered apps under Settings -> Apps -> Default Apps -> Choose default apps by protocol. For example the Windows Calculator is registered as calculator://.
You can register a protocol for your application (if you develop it) with the instructions here: https://learn.microsoft.com/en-us/windows/uwp/xbox-apps/automate-launching-uwp-apps#protocol-activation

Why does the Xamarin.Forms designer not show windows layouts?

I tried searching for this everywhere, but I cannot find any solution.
I also tried looking at solution properties, project properties, visual studio preferences, Visual Studio extensions, change XAML xmlns definitions but I have no clue why this is not possible, and I think it should be standard simple functionality.
When you create a new Xamarin.Forms project that includes
, you would suspect that there is not only a way to see your XAML design on Android and iOS but also for any Windows platform you are targeting, such as W10 Desktop but also other Windows platforms that UWP supports and that supposedly Xamarin. Forms do support according to the website from Microsoft. You can easily build your project for these platforms, no problem. But I want to see what I am doing before I compile my work.
When opening your XAML design, instead of a simple Android / iOS and Windows tab in the design panel, Windows is nowhere to be found.
How am I supposed to see how my Windows screen is going to look without an option to see this? In WPF and plain UWP, this works fine, but somehow for Xamarin it only shows Android/IOS, but apparently, Xamarin has full support for Windows (desktop).
I am looking for multi-platform support to create a windows desktop application that is easily portable to iOS and Android. I thought Xamarin could do that, but if I am not able to see what I am doing on Windows in terms of layout, how am I supposed to develop a solid UI for the platform?
I am probably missing some kind of checkbox somewhere (I am hoping), but I cannot find any information about this. Yes, I tried to google. And Stack overflow. And Xamarin documentation from Microsoft. And watch YouTube videos about Xamarin for 20 minutes that supposed to explain the Xamarin multi-platform support. And after 20 minutes I find they only specifically explain iOS/Android but nothing about Windows. So yeah, getting pretty tired of searching and hope someone can be kind enough to help me out.
This is a limitation of Xamarin.Forms. Although it uses XAML, it has a custom XAML dialect which is not compatible with WPF/UWP, so the built-in UWP designer cannot handle it directly and it will require a custom designer implementation.
But if you want a first-class Windows development experience compatible with Android, iOS and even WebAssembly, try looking into the Uno Platform. This is a UWP bridge with full XAML compatibility with UWP XAML, so your app will look exactly the same on all platforms and provides full templating and styling support. In addition, Uno Platform provides bridge for many non-UI APIs as well, including things like Clipboard, Accelerometer and so on. In the end you will be able to just write a Windows app which will work everywhere with minimal changes.
You can use XAML adaptive triggers to make sure the app works well on each screen size and scales great from desktop to mobile.
If you want desktop version of you app just add UWP or WPF blank project to your solution.
For UWP it goes like this:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/windows/installation/
For WPF it goes like this:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/wpf
Right click on your "Project.UWP" or "Project.WPF" project and pick "Set as Startup Project"
and building your solution.

Which C# project type should I choose? Need UWP design features, but WPF functionality

I want to take advantage of the nice acrylic brush that is offered in UWP, but I also need to be able to access other process information and load DLLs for SDKs (e.g. Aura(needs dll) and Philips Hue(works without referencing dll) and detect system hibernation/wake (UWP cant't distinguish between going to the lock screen or going to hibernation or waking/logging in)).
I tried to make this in UWP, but the sandbox is making it impossible.
I also tried in WPF, but I couldn't get as good and nice performing acrylic effect as UWP offered, only the aero blur which is not as strongly blurred.
I lastly tried to create a WPF project that uses the Microsoft.Toolkit.Wpf.UI.Controls Nuget package, however it doesn't seem to come with the acrylic brush for WPF.
What are my alternatives in C#?
Is it possible to run a uwp app as the UI and have a WPF app as a constant background task without delay, messaging back and forth?
Is it possible to run a uwp app as the UI and have a WPF app as a constant background task without delay, messaging back and forth?
Yes, sort of. You can add a desktop extension component to your UWP app.
#Stefan Wick has written a number of blog posts on the subject and also provided a code sample on GitHub that shows how to extend a UWP app with a "classic" .NET console desktop application that runs as a full trust process.
Please refer to his blog for more information.
The question is asked in a kind of odd shape...
however in WPF you can achive blur effect linke this:
<Grid.Effect>
<BlurEffect Radius="4" KernelType="Gaussian"/>
</Grid.Effect>
The radius changes the "blurynes"
And no you cannot run seperate applications without any draw backs...
you should also check out:
Apply blur to everything behind a chosen container
I think you are looking for Application Packaging Project in Visual Studio. You can find the examples on MS blog: https://blogs.windows.com/buildingapps/2017/12/04/extend-desktop-application-windows-10-features-using-new-visual-studio-application-packaging-project/#KeIh8l8WoJ5OLGkE.97

can .net windows forms project and .net UWP project be merged?

I have a GUI windows form app written in .NET .
And I have a new .NET UWP app that has UWP camera and UWP sockets.
Can I port the UWP camera and UWP sockets code into the .NET Windows form app project?
(If I went the other way, it probably will take much longer to port the Windows forms GUI into a UWP GUI.)
WinForm project can use most new Windows 10 API designed for UWP. Check this post.
If went the other way, you need to port bit by bit of the existing GUI, so it all depends how complex your WinForm GUI is.
The first challenge is you are using XAML, another language instead of C# to write UWP UI.
Some WinForm controls you are using just do not have a UWP counterpart, you need to turn to the community to check if there are alternatives that are freely available l, or purchase proprietary product, or write your own control.
No. WinForm and UWP projects are very different. UWP are compiled to native code and WinForm are compiled to IL that are then run by the CLR. Microsoft is currently working on the ability to put a UWP control inside a WinForm application. You can check it out here.

Minimize Windows 8 Store App while tracking location with GPS

I'm working on a metro app and am having trouble finding how not to show the application.
We recently deployed tablets to our field reps, and need to add gps tracking. GPS is much easier to deal with in the metro libs (it's like 4 lines of code vs. unmanaged) so we're hoping to be able to push a metro app instead of spending time coding a winforms/wpf desktop app (the tablets are full version windows, so it's an option if we can't hide a metro app. I feel like it should be possible though as the start screen tiles update automatically without opening the main program).
In WPF, it's fairly simple to make a window invisible. I'm creating the metro app in wpf, but it uses different libs than desktop and I may just not know how to do it.
In desktop programs, it's fairly simple. You do something along the lines of:
<Page
x:Class = xxxxxxxx
..
Visibility="Hidden">
Unfortunately, with metro, the only options I have are collapsed and visible. Collapsed doesn't seem to have any effect, unless it's just because it's not deployed and visual studio shows it anyway...
So basically I'm trying to figure out if there's a way to start the program minimized or hidden so that it doesn't interrupt the field reps every time it takes their location.
If you really want to make a metro app and want it to run "minimised" you will need to look at background task. To start the background task the user would still need to start the app at least once, futhermore background task have limitation how how often and how long they can run. Also there is a lot of constraint on deploying a windows store app if you cannot publish it in the store.
If your goal is to just have access to GPS through C# apis, the GPS is actually one of the winRT api you can use from the desktop, you can find a tutorial on how to access winRT api from the desktop here
Here is the complete list of winRT api accessible from the desktop (You can find Geoposition class among them).
Have you looked into creating a background task that transmits GPS? The background task can run without the app running.
I am not entirely certain you can voluntarily minimize a Windows Store App on a user's behalf. I see nothing in IntelliSense about it, nor have I found anything online or see any app do it.
However, be aware that deploying the app without using the Windows Store -- sideloading -- requires Windows 8 Enterprise edition computers joined to the domain OR Windows 8 Pro with a sideloading key ($30 per key, purchased in packs of at least 100.) Perhaps a WPF app with unmanaged code is worth the money and effort.

Categories

Resources