当前位置: 首页>>代码示例>>C#>>正文


C# GSM.ShowInformation方法代码示例

本文整理汇总了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
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:40,代码来源:CallHistory-Test.cs


注:本文中的GSM.ShowInformation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。