Programatically launch Windows Photos App in Edit mode - c#

How can I programmatically launch Windows built-in photos app with a specific file loaded and in edit mode?
(It should be possible since there's an "Edit with Photos" command in the right click context menu in Windows Explorer).
If it helps, I found this registry script that adds the command:
Windows Registry Editor Version 5.00
; Created by: Shawn Brink
; Created on: July 3rd 2017
; Tutorial: https://www.tenforums.com/tutorials/88126-edit-photos-context-menu-add-remove-windows-10-a.html
[HKEY_CLASSES_ROOT\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit]
"ActivatableClassId"="App.AppX65n3t4j73ch7cremsjxn7q8bph1ma8jw.mca"
"Extended"=-
"ProgrammaticAccessOnly"=-
"PackageId"="Microsoft.Windows.Photos_2017.39091.15730.0_x64__8wekyb3d8bbwe"
"ContractId"="Windows.File"
"DesiredInitialViewState"=dword:00000000
#="#{Microsoft.Windows.Photos_2017.39091.15730.0_x64__8wekyb3d8bbwe?ms-resource://Microsoft.Windows.Photos/Resources/EditWithPhotos}"
[HKEY_CLASSES_ROOT\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit\command]
"DelegateExecute"="{4ED3A719-CEA8-4BD9-910D-E252F997AFC2}"

Related

How to Create a Test Project for Winappdriver with C#

I need to learn about how to set-up a winappdriver windows app test project in visual studio and inspecting the elements for a medium size windows application.
Navigate to the WinAppDriver GitHub web page and download the latest
version. I downloaded the 1.2 version
After installation, you will find the diver at C:\Program Files
(x86)\Windows Application Driver location.
First, we need to enable Developer Mode on our Windows 10, Developer
mode is not enabled. Enable it through Settings and restart Windows
Application Driver
If you have Microsoft Visual Studio installed, you will most likely
have Element Inspector already installed on your machine
In case you do not have it installed, navigate to the Windows 10 SDK
site, download and install it.Run the inspect.exe and make sure it is
working fine
**.
Create a new NUnit test project
2- download appium dependency from NuGet
3- Update an existing UnitTest1.cs class as follows:**
using NUnit.Framework;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Windows;
using System
[SetUp]
public void Setup()
{
AppiumOptions Options = new AppiumOptions();
Options.AddAdditionalCapability("app", "C:\\Windows\\System32\\notepad.exe");
Options.AddAdditionalCapability("deviceName", "WindowsPC");
DesktopSession = new WindowsDriver<WindowsElement>(new Uri(DriverUrl), Options);
Assert.IsNotNull(DesktopSession);
}
[TearDown]
public void Close()
{
DesktopSession.CloseApp();
}
}
4= Run the test
Note: If some references or packages are missing, right-click on it and include it in the solution.
5- Create Windows Elements and perform actions
Open up application under test (AUT), in our case it is Notepad.exe, and Inspect.exe tool to fetch locators.
Click on the Notepad text area and find the AutomationId attribute on the right-hand side of the Inspect.exe tool.
WindowsElement NotepadTextArea = DesktopSession.FindElementByAccessibilityId(“15”);
NotepadTextArea.SendKeys(“Hello World”);
Try! try! ,Run the test! Run the test! Run the test!
#pawansinghncr's answer is correct, but I would also suggest trying out the UI Recorder, it's in the Releases page of the WinAppDriver's Github.

C# Browser version get wrong version for windows 11

C# Browser version get wrong version for windows 11(last windows update v:11.187.14393.0)
HttpBrowserCapabilities browser = Request.Browser;
Console.WriteLine("Result:" + browser.MajorVersion.ToString());
Result:7
Go into Internet Explorer and hit F12. Check the emulation tab.
Document Mode and User Agent string are what determine the browser version.
change both those settings to
Document Mode: Edge (default)
User Agent String: Default

No emulator device found in my visual studio to run my android app

Today i download the visual studio 2015 .because i want to start android programming.
So i download xamarin for visual studio as you can see here :
So other packets are installed as you can see here :
So i create a blank apps and the code is like this :
namespace App1
{
[Activity(Label = "App1", MainLauncher = true, Icon = "#drawable/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
}
}
}
I install this file but i don't know what is that exactly i think it is simulator mono-4.2.2.30-gtksharp-2.12.30-win32-0.
But when i run this program
I get this error :
Severity Code Description Project File Line Suppression State
Warning #(Content) build action is not supported App1 C:\Users\ehsan\Documents\Visual Studio 2015\Projects\App1\App1\Properties\AndroidManifest.xml
Some thing that i should add is there is no emulator in the list of visual :
The sdk manager :
You need to do 2 things for getting the emulator to work properly -
Install the necessary components in the SDK manager for the Android version you are targetting. Along with System Image.
For that system image you can choose a preset virtual device present in the AVD Manager.
Then launch the Emulator and ensure you see the home screen is loaded in the Virtual device then start the application from Visual Studio. It will then install the apk into the Virtual device and launch your app.
See the sample image of SDK manager installation components
Check whether Visual Studio Emulator for Android is installed or not.
If not installed, click here for download.
Documentation : http://blogs.msdn.com/b/visualstudioalm/archive/2014/11/12/introducing-visual-studio-s-emulator-for-android.aspx
Steps to Install and configure Visual Studio Emulator for Android : https://msdn.microsoft.com/en-us/library/mt228279.aspx
Warning #(Content) build action is not supported
There is a small workaround for this warning.
Select Properties of AndroidManifest.xml
Set Build Action as None
Another option is to use the Xamarin Android Player: https://xamarin.com/android-player. I have found that it works very well and is pretty fast. I know the question was about VS's emulator, but this is a good alternative if you can't get that working.

error of updating an C# web service application by accessing a URL from MS installer command "msiexec" in C# VS 2010

This question is related to my previous question.
I need to publish a C# application (that has been set up in IIS 6.0 and built in VS2010) to a desktop with win7.
I have set up IIS on my desktop well. Now I can install the application on my laptop by accessing the URL
http://myDesktopName.domain.com/MyApp
pointing to a physical location in desktop
e:\myPath\myApp\myAppService.svc
When I publish a new version of the web service, the application should get updated when I open it.
But, it gave me an error:
**the filename,directory name, or volume label syntax is incorrect**
After searching online, I found this error is normally caused by some unacccepted chars in the link. Here is the code that the msi (MS installer) needs to access and get the new version of the application.
System.Diagnostics.Process.Start("msiexec", "/favmuso \"" + myurl + "\"");
here,
myurl is http://myDesktopName.domain.com/MyApp/MyAppSetup.msi
Here, http://myDesktopName/MyApp/ is the virtual directory set in IIS 6.0 on my desktop. I can access and download it from IE in my laptop without any problems.
But, when the application notified me that a new version is available for updating the old one, I clicked the pop-up ballon on the application icon and then I got the error:
Error 123. The filename, directory name, or volume label syntax is incorrect.
If I try to access it from the C# code, I got the same error.
Then, I did a test by running
msiexec **/favmuso** http://myDesktopName.domain.com/MyApp/MyAppSetup.msi /Lv mapp_msi.log
In the log file, i found :
MSI (s) (80:DC) [18:04:33:089]: SECREPAIR: Failed to open the
file:http://myDesktopName.domain.com/mypath/\myAppSdetup (10).msi for computing its hash. Error:123
Error 123. The filename, directory name, or volume label syntax is incorrect.
Why my applcation setup file name was changed to
\myAppSdetup (10).msi
The "/favmuso" options can be found at
https://technet.microsoft.com/en-gb/library/cc759262%28v=ws.10%29.aspx#BKMK_Install
Any help would be appreciated.
thanks
So I noticed that you've asked this question elsewhere, and everyone was focused on the /favmuso piece of it.
I've been recently exeriencing this issue when trying to repair MSIs with a URL source when the original application was installed by SCCM 2012.
The workaround I found was to add a registry value at HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Installer. The value below causes the MSI to skip the problematic portion of the repair and move on.
Name: SecureRepairPolicy
Type: REG_DWORD
Value: 1
To be a bit safer, you look into setting the registry value to 2 and using a whitelist as described in this Microsoft article: https://support.microsoft.com/en-us/kb/2918614. (Ctrl+F "Steps to opt-out the affected programs".)

Is there a way to alter the update URL for installed click once applications

We have been using click once since 2006 and now have a need to change the update location, this happened once before but we just uninstalled and reinstalled, this will now be problematic.
A solution was presented in Click Once Migrate URL, however when we tried this years ago (.NET 2.0), it failed with the app stating that the URL of the update and the URL of the client did not match raising a security risk and prevented the update from occurring and starting for that matter.
The docs state that this property can only be altered in the application manifest, but I'm not sure the approach to actually change this in an already deployed app.
I want to use a process such as the following assuming current version is 5 and deployment location is apps.mycompany.com and new location is clickonce.mycompany.com
Publish app at clickonce.mycompany.com with version 5.2
Publish app at apps.mycompany.com with version 5.1 which has bootstrapping code when the app starts up to alter the apps manifest to change the URL.
With this process the clients will then get two new updates consecutively. Infect, if I publish 5.1 to both locations it should work.
This type of thing can be solved by having the app uninstall itself, and then reinstall itself. I have done it before, although I was installing from a network location, and not a url, but it should be the same thing.
Here is a link on msdn for this solution. Go down to the section "How to programmatically uninstall a Click Once application and install a new version".
You can also check out a different version of the solution here.
This works, but it's a bit tricky. It is the only way I know of to solve this type of problem though.
EDIT If you use the information in that article, here are 2 things to watch out for.
Make sure the update for the app that is uninstalling itself is not optional. You need to make the required version be the current deployed version. Otherwise, the restore option is available and is the default for the uninstall dialog box, and the app won't uninstall itself.
Make sure in the GetUninstallString method in the DeploymentUtils class, change the DisplayName it is looking for from "TestCertExp_CSharp" to the name of your app.
use these command lines
mage.exe -Update setuptest_1_0_0_2.application -ProviderUrl http://127.0.0.1/setuptest/setuptest.application
mage.exe -Update setuptest_1_0_0_2.application -AppManifest setuptest_1_0_0_2\setuptest.exe.manifest
mage.exe -Sign setuptest_1_0_0_2.application -CertFile setuptest_TemporaryKey.pfx -Password mypassword
mage.exe -Update setuptest.application -ProviderUrl http://127.0.0.1/setuptest/setuptest.application
mage.exe -Update setuptest.application -AppManifest setuptest_1_0_0_2\setuptest.exe.manifest
mage.exe -Sign setuptest.application -CertFile setuptest_TemporaryKey.pfx -Password mypassword
Check this: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2939893&SiteID=1

Categories

Resources