private static IMessageSender BuildMessageSender(ConnectivityConfig config) { IMessageSender sender = null; #if WIFI if (null != config.Wifi && config.Wifi.Enabled) { if (null != sender) { throw new ApplicationException("Cannot configure multiple connectivity methods"); } sender = new WifiMessageSender(config.Wifi.SSID, config.Wifi.Password, config.Wifi.SecurityMode); } #endif #if ETHERNET if (null != config.Ethernet && config.Ethernet.Enabled) { if (null != sender) { throw new ApplicationException("Cannot configure multiple connectivity methods"); } sender = new EthernetMessageSender(); } #endif #if NO_NETWORKING if (null == sender) { Debug.Print("Using dummy message sender - requests will *not* be sent anywhere"); sender = new NullMessageSender(); } #endif if (null == sender) { throw new ApplicationException("No valid networking stack selected"); } return(sender); }
private static IMessageSender BuildMessageSender(ConnectivityConfig config) { IMessageSender sender = null; #if WIFI if (null != config.Wifi && config.Wifi.Enabled) { if (null != sender) { throw new ApplicationException("Cannot configure multiple connectivity methods"); } sender = new WifiMessageSender(config.Wifi.SSID, config.Wifi.Password, config.Wifi.SecurityMode); } #endif #if ETHERNET if (null != config.Ethernet && config.Ethernet.Enabled) { if (null != sender) { throw new ApplicationException("Cannot configure multiple connectivity methods"); } sender = new EthernetMessageSender(); } #endif #if NO_NETWORKING if (null == sender) { Debug.Print("Using dummy message sender - requests will *not* be sent anywhere"); sender = new NullMessageSender(); } #endif if (null == sender) { throw new ApplicationException("No valid networking stack selected"); } return sender; }