string GetConnectionCostInfo(ConnectionCost connectionCost) { string cost = string.Empty; cost += "Connection Cost Information: \n"; cost += "====================\n"; if (connectionCost == null) { cost += "Connection Cost not available\n"; return cost; } switch (connectionCost.NetworkCostType) { case NetworkCostType.Unrestricted: cost += "Cost: Unrestricted"; break; case NetworkCostType.Fixed: cost += "Cost: Fixed"; break; case NetworkCostType.Variable: cost += "Cost: Variable"; break; case NetworkCostType.Unknown: cost += "Cost: Unknown"; break; default: cost += "Cost: Error"; break; } cost += "\n"; cost += "Roaming: " + connectionCost.Roaming + "\n"; cost += "Over Data Limit: " + connectionCost.OverDataLimit + "\n"; cost += "Approaching Data Limit : " + connectionCost.ApproachingDataLimit + "\n"; return cost; }
// //Display Cost based suggestions to the user // string CostBasedSuggestions(ConnectionCost connectionCost) { string costBasedSuggestions = string.Empty; costBasedSuggestions += "Cost Based Suggestions: \n"; costBasedSuggestions += "====================\n"; if (connectionCost.Roaming) { costBasedSuggestions += "Connection is out of MNO's network, using the connection may result in additional charge. Application can implement High Cost behavior in this scenario\n"; } else if (connectionCost.NetworkCostType == NetworkCostType.Variable) { costBasedSuggestions += "Connection cost is variable, and the connection is charged based on usage, so application can implement the Conservative behavior\n"; } else if (connectionCost.NetworkCostType == NetworkCostType.Fixed) { if (connectionCost.OverDataLimit || connectionCost.ApproachingDataLimit) { costBasedSuggestions += "Connection has exceeded the usage cap limit or is approaching the datalimit, and the application can implement High Cost behavior in this scenario\n"; } else { costBasedSuggestions += "Application can implemement the Conservative behavior\n"; } } else { costBasedSuggestions += "Application can implement the Standard behavior\n"; } return costBasedSuggestions; }