I have a list of items in a listview and when the user double-clicks an item, I display a messagebox with the contact's name and address.
My boss doesn;t like it because he thinks this violate some UI design principle for Windows Mobile devices. I can't find anything that prohibits this. He is thinking that it has something to do with the device not being able to go into power-saving mode when a message-box is displayed.
Is he right? Can you suggest an alternative (he doesn;t have an alternative except he doesn;t like what i have)
C#, Windows Mobile 6.0, WinForms
Windows Mobile 6 uses MessageBox all the time. It is probably better than rolling your own solution because you'll automatically benefit from updates in WM6.5 which a custom solution wouldn't.
The device has no problem going into power-saving mode while a message box is displayed. Other options available to you include using a tabbed view and switching to another tab to display details, or creating and displaying a new form to display details.
Related
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...
I am creating my personal gmail checker in C# and I need a way to popup a notification in system tray whenever there is a new email and how to control the contents of that notification bar. Also if possible I don't need it to be like windows notifications but my personal way. For example not popup like a notification but like a rectangle (or square or whatever) and if windows taskbar is in autohide the taskbar not be shown but only the notification. Also it is a wpf app. If you need more info let me know
Sounds like you're looking at trying to create a "toaster"-style popup. You can take a look at including something like this WPF NotifyIcon:
This is an implementation of a NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform. It does not just rely on the Windows Forms NotifyIcon component, but is a purely independent control which leverages several features of the WPF framework in order to display rich ToolTips, Popups, context menus, and balloon messages. It can be used directly in code or embedded in any XAML file.
You could also look at using a notification framework like Growl for Windows:
Ok, so what is Growl?
Put simply, Growl lets you know when things happen. Files finished downloading, friends came online, new email has arrived - Growl can let you know when any event occurs with a subtle notification. The rest of the time, Growl stays out of your way.
Along with letting you know when things happen, Growl also gives you full control over how you are notified and what action (if any) you want to take in response to the notification. You can choose to be alerted with a visual indicator or an audible alert, both, or neither. You can choose the type of display that is shown, whether the display remains on the screen, the importance of the notification, and even if the notification should be forwarded to another computer. You can have notifications that trigger an email, run a script, launch a program, or are read out loud.
You can find the documentation and Growl.net files on Growl's developer page.
I am interested to know how can I do the same thing that the apllication listed below does:
Start Menu Calculator
I want to know how can I create an custom tab in Start Menu Search and then handle it with my WPF application. It should only be enabled until my application is running.( Just like what The calculator does )
I read something about windows API Code Pack and I downloaded it but I don't know how can I use it. I searched through it but I didn't find anything.( If you know how I could do this using with Windows API Code Pack, please write an example that explains how to do it in C#)
The main exe "Start Menu Calculator.exe" installs a windows hook (using SetWindowsHookEx) into explorer.exe. The hook is implemented as usual in SBLib.dll which is then injected into Windows Explorer's memory space.
This hook searches for window handles belonging to the search box. See a discussion around this here:
How do I get a "handle" on the Windows Search textbox? and probably sub classes the search box windows (if you kill the "Start Menu Calculator.exe" process abruptly, it crashes Windows Explorer too... which kinda confirms this)
It then reacts to key presses, and I suppose it butchers up the result window. In the hierarchies of Windows, I think it's a Window named "Desktop Search Open View", you can get to it with SPY++ under "Start Menu", aside the windows mentioned in the msdn forum above.
So, no nice API behind this nice application. Massive hacks instead :-)
I think however, some level of integration is possible, using documented behavior, with the search box. I have not dug further, but there is the notion of federated search in Windows (Windows 7 Federated Search). I don't see if this would be capable of reacting instantaneously to what the user types in though...
As a side note, if you're also looking for a way to run javascript code from C#, there is a question here on SO that says it all: parse and execute JS by C#
When making Start Menu Calculator I initially tried to use federated search and Managed (.NET) code however you can't integrate into the start menu, only the shell search (for web service based search which lets you return custom results based on a search string). The problem is that the federated search is structured such that all the search data is pre-indexed so for the calculator to work I would have had to pre index every possible calculation! The reason it all works this way is to make sure that clicking the start menu is always fast and responsive (you don't want a web service call everytime you press start in the shell).
I ended up hiring someone to write a native windows app that places a IE control into the Start menu search area and passes the searched text in with the source. All the visual stuff is just css made to look like the start menu rendering and the calculations handled in javascript.
So yes, a bit of a hack but it seems to work and I havent had/heard of any crashing issues so far.
I have an app that currently shows a message box when the users saves that just says "Saved successfully". The problem is, user's tend to save frequently when using this app and the message box is a pain in the #$$. I'd like to have a little notification box that fades in and out and doesn't require user interaction, kind of like how Growl notifications work on a Mac.
Is there any .net library or free 3rd party application that does something like this?
There is no need to use 3rd party libraries for something like this.
Crate a form for your notifications, styled as you wish.
When you need to notify, you can Show the form - to fade it in and out use the Opacity property (using a timer to animate the changes).
Have a look at this and see if it does what you want.
Office 2003-like popup
Surfing the net, I came across this:
this code that shows how to display a notification at the bottom of the screen on a Windows Mobile device. My question is, is there a way to either specify which options are displayed beneath the notification (on the taskbar) or is there a way to detect when the user clicks on the notification itself, so that I can react to that programmatic ally.
With this specific API, the key is in the SHNOTIFICATIONDATA's hwndSink member. When the notification is clicked, the hwnd you pass in here will get the click message. For this it's simplest to pass in a MessageWindow's handle.
You might also look at the CeSetUserNotification API instead. It's actually quite a bit more robust in what it allows you to do and how you can get notifications back at the app.