本文整理汇总了C#中GSM.ShowInformation方法的典型用法代码示例。如果您正苦于以下问题:C# GSM.ShowInformation方法的具体用法?C# GSM.ShowInformation怎么用?C# GSM.ShowInformation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GSM
的用法示例。
在下文中一共展示了GSM.ShowInformation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestRunner
public static void TestRunner()
{
// Create a new instance of class GSM
GSM mobile = new GSM("Razr V3x", "Motorola", null, 99.99m, null, new Battery(Battery.Type.LiIon));
mobile.ShowInformation(); // Display mobile's information
decimal pricePerMinute = 0.37m; // Define the price per minute
// Add few calls
mobile.CallHistory.Add(new Call(DateTime.Now.AddMinutes(-12314), "0123456789", new TimeSpan(1, 29, 15)));
mobile.CallHistory.Add(new Call(DateTime.Now.AddMinutes(1210), "7635554521", new TimeSpan(2, 39, 0)));
mobile.CallHistory.Add(new Call(DateTime.Now.AddMinutes(-652), "5524156583", new TimeSpan(3, 49, 0)));
mobile.CallHistory.Add(new Call(DateTime.Now.AddMinutes(543), "0123456789", new TimeSpan(4, 59, 0)));
mobile.CallHistory.Add(new Call(DateTime.Now.AddMinutes(2131), "0123456789", new TimeSpan(4, 59, 0)));
mobile.CallHistory.Show(); // Display call history information of mobile
Console.WriteLine("Total calls: {0}", mobile.CallHistory.Count());
Console.WriteLine("Total price ({0}/min): {1,2}$", pricePerMinute, mobile.CallHistory.CalculatePrice(pricePerMinute));
Console.WriteLine("Longest call: " + mobile.CallHistory.GetLongestCall());
// Remove all the longest call from the history
mobile.CallHistory.RemoveAllLongestCalls();
Console.WriteLine("\n-> Deleting the longest calls...\n");
mobile.CallHistory.Show();
// Calculate the total price again
Console.WriteLine("Total calls: {0}", mobile.CallHistory.Count());
Console.WriteLine("Total price ({0}/min): {1,2}$", pricePerMinute, mobile.CallHistory.CalculatePrice(pricePerMinute));
Console.WriteLine("Longest call: {0}\n", mobile.CallHistory.GetLongestCall());
mobile.CallHistory.Clear(); // Clear call history
Console.WriteLine("-> Clearing all call history...\n");
mobile.CallHistory.Show(); // Display call history information of mobile
}