c# custom credential provider - c#

I am trying to develop a custom credential provider. Trying to learn the basics. I implemented ICredentialProvider and ICredentialProviderCredential.
I added a custom credential tile, edit text and command link to windows logon UI.
What i want to do is, when i click on CommandButton i try to read textbox value but i could not do that.
I want to open a custom windows form (e.g MFA form), how can i open a custom form?
I am using phaetto/windows-credentials-provider implementation as example
There is not much information about this topic.

1. Text field
You must collect and keep securely the value(s) of text box(ex) field(s) as far as it is updated and your tile implementation class is notified about the change of that value.
You will be notified about every single character user entered into the text field. Be ready for this.
As far as user type info input text box your provider's method ICredentialProviderCredential::SetStringValue will be called on every text box update.
2. Popup window (dialog)
If you want to open any window you must acquire a parent window handle from Logon UI / Cred UI. Handle acquisition method is ICredentialProviderCredentialEvents::OnCreatingWindow.
You can find more details in the answer and it's comments: https://stackoverflow.com/a/52089207/3868464 .

Related

Action.Submit validation #bot frameworkV4

My bot consists of adaptive card which has text box and submit.action,when user clicks on submit it does some action in the next dialog
Iam able to prompt the adaptive card and submit the action .
But i need 2things to be done here
1.for few cards when user go back and resubmit the form it has to submit with old data
2.when user go back and click submit it has to throw some prompt message saying card expired or submitted already
I an working with .net core,v4 and waterfall dialog
Can anyone help me in this.
There isn't an easy way to do this in the current state of the Bot Framework. Here's a couple of good options:
Use the AdaptiveCardPrompt. This isn't officially-supported, but I believe provides you with all of the customization you're looking for, out-of-the-box.
Attach your Adaptive Card to an ActivityPrompt and write a custom validator for it.
The trickiest part about your issue is collecting data from a card after the user has already completed the prompt. Once the prompt is over, there's no good way to use it. However, you could:
Add a card Id to the data property of the Action.Submit
Capture the input in OnMessageAsync()
If Activity.Value contains the card Id from step 1, handle it appropriately. Note, however, that it gets very difficult to use this within a dialog if the prompt has already completed.
You can go through the following link for handling user action https://learn.microsoft.com/en-us/azure/bot-service/nodejs/bot-builder-nodejs-dialog-actions?view=azure-bot-service-3.0

Get new Messagebox style - WPF

I am currently working on a Windows Presentation Foundation app and I need to make use of Message boxes. I want to get few information from user inside Message Box popup.
But they appear always like this:
But I think the actual look of it should be like that:
Does anybody know, why this is, and how to solve it? I tried all everything listed
here
, but nothing worked.
I agree with Keithernet, build your own. Its more of an Input Dialog box. You may want to plan it to create a window, create it with ex: 4 parameters which you could override so you can apply them in the form including
The title,
The prompt you want the user to fill in
optional default button 1 text
optional default button 2 text.
have the input value stored into a public property in the window for the text to be bound to during entry.
If the user clicks the cancel button (or similar), clear the text entry and close the window. If ok button, just close the window.
Then, when you call it with a YourWindow.ShowDialog(), upon return, you can look at the public property for that input text value.
You could even do with a property / flag if the user cancelled directly or not. I have done similar in a couple of my WPF apps.
MessageBox is very limited. Based on your screenshot, you should just create your own child Window with your own XAML so you can get the user input.
You can find sample service implementations/NuGets for this on GitHub. Here is one I've created sometime ago: https://github.com/Dirkster99/MsgBox
Just create your own is an oversimplifying statement in my opinion because this is usually a dialog that you want to show in different parts of the application. Therefore, you have to settle for a software design pattern (I chose a service implementation as suggested here).
Likewise, there are other design decisions that should be taken. I have for instance made sure that the API has a compatible subset of Show API calls with the standard .Net MessageBox to make its application as flexible as possible. I also settled for light and dark themes hoping this will make its application easy in any other theme...

C# Custom paste like feature

I am trying to create a way or inserting text anywhere on the system in Windows, much like the clipboard works. For example, pressing ctrl+shift+1 would 'paste' text set in my application into where the user is currently pointing the cursor.
For example, if my application sets it to be 'local.network' and the user presses ctrl+shift+1 in their browser address bar, it would paste in 'local.network'. I then want to have different values set, depending on what number the user presses. Is this possible or can I not create a system wide function like this?
What you're looking for is how to register a hotkey.
Register more than one hotkey with RegisterHotKey
Set global hotkeys using C#
in response to your followup comment, sorry, I though the question was more about the capturing the key press event. If you need to paste text to a window that you don't own, then this question would be a near duplicate. That question uses WM_SETTEXT but you can easily use WM_PASTE instead.

Storing all the events that happened inside a Windows Forms application

Is there a way to store all the window form events inside a list, so all of those events can be reapplied when the user opens the form next time?
Example: Let's say the user clicks a button inside a form and types in a string and then closes the form. After a while the user reopens the application again, and the form is re-initialized so that the click action and the string the user input is restored. (Kind of like an auto-save function.)
Purpose for this:
Recover after suspension.
Allow user to undo their work (Undo Button).
I am still not sure I understand you, but you say you want to get a list of events, okay, that can be done using Reflection. Here is a good link: http://www.switchonthecode.com/tutorials/csharp-tutorial-using-reflection-to-get-object-information
Your example:
Let's say the user clicks a button inside a form and type in a string,
he then closes the form, after a while he open the application again,
and form can re-initialize the form and apply the click action and the
string he inputted(kind of like an auto-save function).
-You can do this without getting a list of events. So I don't see why you have to do it this way. There are multiple ways to do this. If you are using a winform, one basic solution is to define properties using the settings page. Check this out:
http://msdn.microsoft.com/en-us/library/cftf714c(VS.90).aspx
Use the Settings page of the Project Designer to specify a project's application settings. Application settings enable you to store and retrieve property settings and other information for your application dynamically. They also enable you to maintain custom application and user preferences on a client computer. For more information, see Application Settings.
To access the Settings page, select a project node in Solution
Explorer, and then, on the Project menu, click Properties. When the
Project Designer appears, click the Settings tab.
You can establish waypoints (to borrow a term from aviation) and save values to your settings collection periodically without the user having to do anything, like they would have to do if you provided a save button. But that just brings up the point, what's wrong will the lowly save button. It's a well known convention. People know that if they don't want to lose data, they should save every now and then.

How to write text to an external application

I'm developing an application to help the user write common text faster.
What I have in mind is a Windows app where the user can configure his key combinations, so that when he's, for instance, writing an email on Outlook or Gmail, he just has to press those keys and the text he configured before will be pasted into whatever app he's using.
So, instead of a user having to write "Dear sir, your order has been received succesfully" every time he receives an order and wants to send a confirmation email, he could just press something like "Crtl + O + R", and the corresponding text will be written for him.
I think that in order to achieve that my app has to do two things:
Intercept the key combination pressed buy the user when he's focused on a different app.
"Paste" the corresponding text to that app.
I have no real clue on how to achieve this, because what my app will be doing is something like "pasting" text on another app (otlook, word, notepad or whatever thing a user can type into), replacing the short text the user wrote with the long text he defined.
Any suggestions? I've looked into hot keys, but I'm not sure they're the way to go, and I also have no idea on how to "paste" the new text.
Thanks.
Have you considered simply adding text to the clipboard? Show the text next to a button that says "Copy to clipboard", and the user can just grab it and click Ctrl-V.
Can't think of a Windows app that does it this way, but I know it's possible; heck, Bit.ly can do it from your browser.

Categories

Resources