Search code examples
c#portable-class-library

MessageBoxResult in portable library


I have my contracts (interfaces) in a portable class library. I would like to define a IUserNotifier interface, which I can implement for various platforms.

Are there any portable versions of MessageBoxResult, MessageBoxButton, MessageBoxImage? They are in PresentationFramework.dll. It cannot be referenced in a PCL. Should I copy these enums into my PCL?

Any idea?


Solution

  • MessageBoxResult, MessageBoxButton and MessageBoxImage are platform specific and they should not be in the model (portable) classes. For example Mono.Android doesn't have them. In order to share code you need to create abstraction level in portable classes. If they make sense for model create your own enum and convert it to platform specific types where needed.