Change the system settings on the change of settings in the application - windows-store-apps

I have an UWP application which display the battery status. On change of power saving mode in the application need to reflect in System settings.
Is it possible in UWP?

Is it possible in UWP?
No, this is not possible in UWP. We can't change System Settings just within a UWP app programmatically. As #lindexi said, the proper way to achieve what you want is launching the Settings app and then let user change the battery saver setting.
To launch to the battery saver setting page, we can use "ms-settings:batterysaver" URI like the following:
bool result = await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:batterysaver"));
For more info, please see Launch the Windows Settings app.
And after this, we can use PowerManager.EnergySaverStatus property to check if user has enabled battery saver.

Related

Viewer quality settings (for one viewer on the page)

I have two viewers on the same page. And I want to set performance settings for only one viewer with following code:
this.viewer.setQualityLevel(false, false);
this.viewer.setGroundShadow(false);
this.viewer.setGroundReflection(false);
this.viewer.setProgressiveRendering(true);
BUT (!) settings are applied for both viewers for some reason. Is there any way to apply them only for one viewer on the page?
The viewer settings are kept in localStorage, so changing them using methods like viewer.setQualityLevel probably propagates the updates to other viewer instances as well. Let me discuss this behavior with the dev team as (I think) it could be considered a bug.
In the meantime, if you need to change settings for a single instance of the viewer, consider using "lower level" methods that don't use the local storage. For example, instead of viewer.setQualityLevel(useSAO, useFXAA) you could use viewer.impl.togglePostProcess(useSAO, useFXAA), and instead of viewer.setGroundShadow(bool) you could use viewer.impl.toggleGroundShadow(bool).
EDIT
Also try the Profile API to persist settings - you can get the current profile with:
viewer.profile
I was unable to replicate the issue unfortunately ... looking at your code did you assign two viewers to the same handle? can you post your code to initialize viewers? what version of viewer btw?

How can XCUITest be used from within an OSX application to remote control iDevices?

Visionary scenario and current goal
My visionary scenario is to remotely control an non-jailbroken iDevice as lag-free as possible.
My current goal is to execute a tap on an iDevice from within an OSX application. For example: A button in a cocoa application which when clicked taps the middle of the screen on a lightning-connected iDevice.
I am not bound to OSX and am open to other avenues.
Approach
XCUITest in the XCTest framework allows to run automatic UI Tests. It is the native way of executing remote taps on iDevices.
The following line would execute a tap in the middle of the screen:
XCUIApplication().coordinateWithNormalizedOffset(CGVectorMake(0.5, 0.5)).tap()
Cheat Sheet for XCUITest: http://masilotti.com/ui-testing-cheat-sheet/
Unofficial Reference: http://masilotti.com/xctest-documentation/
Question
How can I use the XCUITest framework from within an OSX application to remotely tap a connected iDevice? I don't actually want to UI Test an existing application.
My problems start with #import XCTest which is not allowed without a test target and continue with .tap() (iOS) not being available in my cocoa application. How do integrate all this?
Other avenues
What other way should I possibly use instead? It must be possible to execute taps on a connected iDevice remotely, because Appium and Calabash use the now deprecated UIAutomation framework to do so. Both must switch to XCUITest from iOS10 onwards.
Edit 1 - Current status
It seems like my approach is much too complicated and basically means implementing Appium-light. My current approach is to use the Appium Server which handles UIAutomation (and in the future XCUITest). I then implement my own Client to send HTTP requests to the Appium REST-API.

How to execute a background task only for once in windows phone 8.1 universal app

In my application after first login/registration I need to download data from server this will take some time. And user can quit the application while data is loading. So I need to download the data in background process. I know I can use backgorund application/Class and register this class in windows phone application but this is only for one time. Is there any other way to do so without creating backgourd task for this?
Maybe this will help,
You're looking for BackgroundDownloader and DownloadOperation in the Windows.Networking.BackgroundTransfer namespace.
BackgroundDownloader downloader = new BackgroundDownloader();
DownloadOperation download = downloader.CreateDownload(source, destinationFile);
MSDN Windows.Networking.BackgroundTransfer
Background Transfer Sample Project (Windows Universal)

How to store user settings in windows rt app

Coming from a mobile background (Android/iOS) both OS's have something that you can hold application preferences (SharedPreferences in android and NSUserDefaults in iOS) like boolean's, int's, strings's ect. which are just key/value pairs that the user can set for polling intervals or turning off something in the app.
What is the equivalent to that in Windows RT?
Windows.Storage.ApplicationData.Current.LocalSettings is a container where you can programmatically add/set key-value-pairs. Are you looking for that?
http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.applicationdata.localsettings.ASPx

Adobe Air - Open app in fullscreen

I created an Air desktop app with Flash CS 5. Usually Windows (XP) is opening an application (like Firefox) with the latest set size and position.
For my installed Air app it's always just the default one.
How to start it with the latest used size and position?
Thanks.
Uli
hope this will work for you:
http://cookbooks.adobe.com/post_Using_the_FullScreen_functionality_in_AIR-8004.html
http://blog.ochodurando.com/2010/04/adobe-air-e-fullscreen/
You need to save a record somewhere that remembers the window's size, and possibly position. If your app has a preferences file, this would be an ideal place to store that information. Then, whenever your app starts, it checks for this information and resizes the window if any values are found.
Most popular programs include this feature (and don't even mention it, since it's pretty basic UI), but it's done intentionally and not as a default for every application. Thus if you want it, you have to program it in.
You can read and write to application.xml. You'll find there and nodes.
file = new File( File.applicationDirectory.nativePath + "/META-INF/AIR/application.xml" );
Adobe restrict writing access to application diractory but this trick is useful if you don't want to create a separate config file in app-storage:/ folder, which is of course prefered.