开发者

Application Level Hook for OpenFileDialog and SaveFileDialog

I'm developing a C# Windows Forms Application using .NET 4 and I am facing a very interesting requirement. What happens is that I'd like to have two kinds of OpenFileDialog/SaveFileDialog: the default ones from Windows API and custom ones with special features that suits my business scenario. Depending on a business rule, the default dialog or the custom dialog should be shown.

I already have my custom Open and SaveFileDialogs. The tricky thing is that I can't simply implement the logic to call one or another, instead I need to hook somehow the OpenFileDialog.ShowDialog and SaveFileDialog.ShowDialog calls on application level so that it shows the default or the custom dialog.

I need it like this because I'm also using third-party controls (DevExpress, for example) and I need that when any of the DevExpress' controls calls OpenFileDialog or SaveFileDialog, the same business开发者_运维百科 rule should be applied to define if the default or custom dialog will be shown.

So, everytime that anyone in my application scope calls OpenFileDialog or SaveFileDialog, this business rule should be triggered to find out the correct dialog to show (default one or custom one).

Has anybody ever needed to implement something like this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜