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


C# GSM.RemoveCallByLongestDuration方法代码示例

本文整理汇总了C#中GSM.RemoveCallByLongestDuration方法的典型用法代码示例。如果您正苦于以下问题:C# GSM.RemoveCallByLongestDuration方法的具体用法?C# GSM.RemoveCallByLongestDuration怎么用?C# GSM.RemoveCallByLongestDuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GSM的用法示例。


在下文中一共展示了GSM.RemoveCallByLongestDuration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main()
        {
            // Create an instance of the GSM class
            Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-GB");
            Display display = new Display(2.5F, "256K");
            Battery battery = new Battery(950, 35, BatteryType.LiIon);
            GSM gsmTest = new GSM("Samsung Ace", "Samsung Group", 545.00M, "Ivan Ivanov", battery, display);

            //Add few calls
            DateTime date = DateTime.Now;
            gsmTest.AddCallInHistory(date, "0889909988", 65);
            gsmTest.AddCallInHistory(date.AddHours(1), "0889969988", 25);
            gsmTest.AddCallInHistory(date.AddHours(2), "0883909988", 3600);
            gsmTest.AddCallInHistory(date.AddHours(6.5), "0889969988", 1000);

            //Display the information about the calls.
            Console.WriteLine("Print the call hisory of phone {0}", gsmTest.ModelOfGSM);
            Console.WriteLine(gsmTest.PrintCallHistory());

            //Assuming that the price per minute is 0.37 calculate and print the total price of the calls in the history
            //use readonly modificator about pricePerminute
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("Total price of calls is: {0}", gsmTest.CalcucateTotalPrice(0.37M));

            Console.ForegroundColor = ConsoleColor.Gray;
            //Remove the longest call from the history and calculate the total price again.
            gsmTest.RemoveCallByLongestDuration();
            Console.WriteLine(gsmTest.PrintCallHistory());

            //Finally clear the call history and print it.
            gsmTest.ClearCallHistory();
            Console.WriteLine(gsmTest.PrintCallHistory());
        }
开发者ID:ralikuman,项目名称:TelerikAcademy,代码行数:33,代码来源:GSMCallHistory.cs


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