How to print Values in Console in Nunit - c#

how to get values in windows screen and to print in console in C# while using automation id (Inspect Tool)
Read Only Collection Class _ name = new(Base Class Name. Desktop Session . Find Elements By Name("Class name in Inspect"));
I cant able to print vales in Console
Is there any other options

Related

How to use Application dialogs in c#?

Im trying to follow this Microsoft tutorial to display the names of a distribution list in c#
https://learn.microsoft.com/en-us/office/client-developer/outlook/pia/how-to-get-members-of-an-exchange-distribution-list
This example prompts the user to select an Exchange distribution list from the Select Names dialog box and expands the distribution list to display its members.
except when I get an error here
I have this in a console app project. How can I fix this?
You can fix this by creating an Application instance, as per suggestion made by the prompt in your screenshot. Like so:
Application app = new Application();
Outlook.SelectNamesDialog snd = app.Session.GetSelectNamesDialog();
Sources:
How to invoke a method with (Outlook.Application application) as parameter in C#?

How to find out whether a string is an AUMID for an installed UWP app?

Is there a .Net library to use to test whether a string is an AUMID for an installed UWP app or not?
An example, if the user enters
Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge
How can I make sure that there actually is a UWP app with this AUMID installed?
Well, the AUMID for a UWP has the format FamilyName!AppID, as documented here, for example.
To find out whether a given string is an AUMID for an installed UWP app you have to compare against that. You can build a list of all UWP app AUMIDs and see if the string is one of them, or you can split your string at the exclamation mark, find a package with the given family name, and if the package exists see if it has an application with the given application ID.
The API that does these things is the Windows.Management.Deployment.PackageManager class. Unfortunately, when enumerating the application inside a package, we don't get the application ID. Only in version 10.0.16257.0 of the SDK the Windows.ApplicationModel.Core.AppListEntry class has an AppUserModelId property. Without it seems like you have to look at the package manifest yourself.
It's a lot easier to in PowerShell of course, since it has a cmdlet that get you the package manifest in object form. Microsoft has this example to generate all UWP app AUMIDs:
$installedapps = get-AppxPackage
$aumidList = #()
foreach ($app in $installedapps)
{
foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id)
{
$aumidList += $app.packagefamilyname + "!" + $id
}
}
$aumidList
(From: Find the Application User Model ID of an installed app
)
Now just see if your string is in the list.

c# wpf set link in the right-click context menu of windows

I want to set in the right-click menu of windows, a shortcut to my app.
The goal is to select a document (image, pdf etc.) -> right-click -> 'Send with my app' ( and optionnaly open a certain class with arguments, like the files path)
I've saw some many possibilities to do that ...
but I would like to know the good way to do that with a c# wpf app.
The goal is to send an installation program to many clients to allow them to use the app, and set the entry on the context menu
In order to show custom options in Windows context menu, you will need to update the registry. Here is how to do it
http://www.howtogeek.com/107965/how-to-add-any-application-shortcut-to-windows-explorers-context-menu/
Once done, in your wpf application, you can get the command line arguments passed using :
string[] args = Environment.GetCommandLineArgs();
from these args, you can extract any argument passed (file location etc)

Set Process 'image name' and 'description' wtih C#

I want to go into as much detail as possible so this question is easily understood and answer-able
Essentially I need a way set up the process name and process description with C# on the applications startup.
Here is an example of what I would like changing;
Note: I want to set my OWN C# applications image and description with CODE.
I want to be able to change the following things in my application on startup.
Image Name in the Processes list, as well as the Description in the Processes list.
So far in my C# application i can set the process name with the properties but id rather be able to set it with some sort of code snippet (as well as the description).
I hope this has been a information question and you good clever people at stackoverflow can help.
You can't change the image name. It's the name of your executable file.
The process description, however, can be changed on your C# project assembly info:
Right click on your C# project in Visual Studio > Properties > Application > Assembly information > Title.
You can't change the description at runtime from code: the OS loads the description at startup from the Version Information file resource.
The Image Name property is the name of the executable itself (ie Foobar.exe), the Description property is the Title of the application in the Assembly Information dialogue box, as shown below:
At this point, when you run your program, you will see two entries into the task manager as shown below:
One will say the name you specified in the Title box, the other will say vshost32.exe as the description. To fix this, untick the option called Enable the Visual Studio hosting process in the project properties page.
As close as I can come to an answer is to pragmatically create a new executable with the desired name and description launch that executable then allow your launch process to die.
Try using your application as a 'host' for another app.
As soon as the application is launched, it downloads a file from a dropbox link (a direct download link) and saves it locally, (In the temp folder probably).
Then our application launches that application and then kills itself with maybe an error.
now the process running on that one would be gone, and we have a new process with our set title and description. Easy!

How to write a Config App for a Console App - sharing data?

My console app uses a bunch of string variables entered by the user. Currently the user can type these as parameters to the console app which then persists them using Properties.Settings.
Instead I'd like a GUI app which has a bunch of text boxes and a 'Save' button.
How can I make this work? I presume there needs to be a way for each app to read/save the common variables. It should work without needing admin privileges when installed on customer's machines.
.NET supports XML (De)Serialization.
Define a class with your setting parameters as fields, connect those fields to your GUI elements, the way you want. Write that class to the XML file and restore the values on application launch.

Categories