WPF save as dialog ... in a view? - c#

My application has a wizard with some steps used to export data.
I want one of these steps to be the "Save as" step where the user choose the location on disk where the results will be exported.
I don't want to pop the save as dialog, but would like to have the equivalent in a view that I could put in my wizard as "just another step".
Any idea?

Unfortunately that's not possible without engineering your own non-standard save control. Save location in windows is done via the common save file dialog control. This is presented as a dialog and is not embeddable as an inline control.
My advice would be to follow the pattern laid out by other wizards
The save location should be expressed with a text box where users can directly enter the save location
To the right of the box is a Browse button which is hooked up to the save dialog
I would definitely recommend heavily against implementing your own Save control. There are a lot of odd nuances handled by the standard Save dialog that you would almost certainly miss (network locations, share point, etc ...). The result would be a non-standard and frustrating experience for end users

Related

How do I save inputted text from a textbox to .settings file when a button is clicked WPF?

I have a small WPF application for installing files. When a button is clicked a window opens prompting the user to input the install path to a textbox and click a button when finished. How do I put this input into the settings file so it can be used app wide? I can provide any code if requested.
PS: I am very new to StackOverflow, so please give me a heads up if I should be doing something differently when asking questions. :)
As you said, a hint will suffice. I think it would be a good idea to take a look at that following classes in order to learn how to save some settings to a file so that you can use it application wide.
StreamWriter
XmlSerializer
I think this link would also be useful.
C# - approach for saving user settings in a WPF application?

How to reduce hard coding of dialog flow in MSBot?

I am creating a dialog flow in MSBot and I am hard-coding the content which will be displayed in Bot Emulator.
For example I want to make the dialog flow for creating the steps, and in rich cards there will be a button for the next step. Now the content I will be creating for the rich card, I have to hard-code in C# if I have a single dialog flow.
But if I have to create the dialog flow for other possible use cases, then I have to hard-code it for everyone.
So is there a way to reduce my effort for hard-coding each of the dialogs? Because if I have to change the steps then I have to manually go to that file and change the whole logic.
It is possible to do this in a generic fashion, where the source for the dialog flow steps are retrieved from a database or some other store. Please see this simple example: https://github.com/EricDahlvang/MultiTurnHelpStepsBot
The current step is stored in context.ConversationData(), and when the user clicks next or back, context.ConversationData() is checked to determine what to show next.

How can I save a multiple screenshots using hook in C#, directly to a word file?

Before I start, I am totally new to C# and most of my programming knowledge come from searching what i need on Google. :P I am good at copy paste but have basic programming skills.
I am working on an windows screenshot application to capture screens using Print Scrn key (by Hook in C#). So this application minimizes on start and user would be able to capture screens by just clicking on Print Scrn key.
I problem is I want the application to be able to save these screen caps in a word file in the background and when the user Hits "End" key the Word file Save Dialog should be displayed (This way user can save the word file by giving a name).
I know this is kind of tricky, but currently we do all these manually which eats up lot of our time. Open Word-> Take Screenshot - > Navigate to Word -> Paste - > Navigate to Window -> Take Screenshot - > Navigate to word again -> Paste .....
I wanted your help to make is let pain... Simple take screen caps-> keep doing it until done -> Click End to Save document.
I have found a portion of code to use Hook from stack overflow, all I need is a way to open an handle word file in the background.
Also I am able to generate pdf file using a third party .dll --which generates document with watermark :( So I thought I should use Word.
Your help would be much appreciated! Cheers! :)
I've actually made an application very similar to this and this is what I think personally: don't try to hook into keyboard shortcuts. What I did was created a system tray icon that if you middle click on will start the capture process.
Sending to Word as an in between staging step to get to PDF is weird. With iTextSharp library you can, with relative ease, add images to a PDF. And there is actually quite a few examples of doing so.
An existing model of an application to look at would be the Snipping Tool in Windows. It's not hard to screen capture the entire screen with .NET and place it on a form that you overlay across the entire screen. You can then allow them with their cursor to select a portion of the form.

How can I use FileOpenPicker to browse my install folder?

I am building a C# Windows Store app and I want to include a few image files with it for the app background. I want to let the user pick one of these images for the app background or pick from their own pictures. The FileOpenPicker.SuggestedStartLocation is only useful for picking from a predefined set of start locations. FilePicker contracts are too complex, include extra UI that appears within the file picker page, and let other apps get to my image files when they really should not have that access.
The only viable alternative so far is to create my own file picker page that looks close to the built-in page, but this is an ugly solution to what should not be this hard.
The best way is to devise your own. Load your included images into a selectable GridView or such and add another button or a specific tile to let the user pick from elsewhere. I wouldn't try to make the basic functionality look like the file picker.
Neither the app's install location or app data folders are intended to be user data, so there isn't an in-box way to pick from them. Advanced users can point the FileOpenPicker at those locations, but there is nothing like SuggestedStartLocations to guide the user there.

how to show a windows folder contents in a windows form using .NET?

i want to show the folder contents in my windows form from where user can copy paste the files user needed, what type of container i have to use for this purpose?
Basically you have two options. You can get an already build control and use it in your application, there are lots of them but not very good and you'll have to pay for one.
Or you could use a TreeView / ListView and build your own control that will suite best what you need. Here is an example explained and with source code.
Another alternative is you can get the Windows API Code Pack which contains a managed wrapper for the actual explorer shell control which basically allows you to embed explorer directly in your application.
before i used Ultra win tree(infrajestics control) to view all files with in the tree view.
Consider using the FolderView and FileView controls from Shell MegaPack.
Assuming :
the design requirements prohibit showing the actual location of the files the end-user can copy or paste. Assume all file names shown are stripped of their path locations.
the list of files is "flat" (no treeview type display is needed)
there's a need to move, or copy, one or more files from an original "complete" list to another "partial list"
I'd create an interface with two ListViews in a Panel : one column per ListView wide enough to display file names : allow multi-select in both of them.
I'd either implement drag-and-drop using standard techniques, or, more likely, I'd create a set of buttons with arrows to move items back and forth between the ListViews. I might have seperate delete buttons for each ListView and require the end-user to confirm deletion depending on the application.
If "multiple copies" (more than one list entry with identical content) are allowed I would probably use some keyboard options to control this, particularly if I were drag/dropping.
Depending on the application, I'd think about letting the end-user make "snapshots" of the current state of the two ListViews, which could then be "restored" : while a simple "Cancel" button could take care of the case where you want to reset the whole thing.

Categories