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


C# GSM.ClearCallHistory方法代码示例

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


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

示例1: Main

    static void Main()
    {
        Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US");

        GSM gsm = new GSM("Galaxy S3", "Samsung");

        gsm.AddCall(new Call(DateTime.Now, "5551337", 150));
        gsm.AddCall(new Call(DateTime.Now.AddDays(-1), "5551337", 230));
        gsm.AddCall(new Call(new DateTime(2013, 2, 19), "5551337", 420));

        foreach (var call in gsm.CallHistory)
        {
            Console.WriteLine(call);
        }

        Console.WriteLine("{0:C}", gsm.CalculateCallsPrice(0.37M));

        //get the longest call;
        Call maxCall = gsm.CallHistory.Where(x => x.Duration == gsm.CallHistory.Max(y => y.Duration)).Single();

        //remove the longest call from the call history
        gsm.RemoveCall(maxCall);

        //print the total price without the longest call
        Console.WriteLine("{0:C}", gsm.CalculateCallsPrice(0.37M));

        gsm.ClearCallHistory();

        foreach (var call in gsm.CallHistory)
        {
            Console.WriteLine(call);
        }
    }
开发者ID:andon-andonov,项目名称:TelerikAcademy,代码行数:33,代码来源:GSMCallHistoryTest.cs

示例2: Main

        static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            GSM gsm = new GSM("htc one", "HTC");
            gsm.AddCall(new Call(DateTime.Now, "0897213421", 430));
            gsm.AddCall(new Call(DateTime.Now, "0882345233", 630));
            gsm.AddCall(new Call(DateTime.Now, "0882332432", 930));

            foreach (var call in gsm.CallHistory)
            {
                Console.WriteLine("Date: {0}",call.Date);
                Console.WriteLine("Time: {0}",call.Time);
                Console.WriteLine("Number: {0}",call.DialledPhoneNumber);
                Console.WriteLine("Duration: {0}",call.Duration);
                Console.WriteLine("----------------------------");
            }

            decimal totalPriceCalls = gsm.CalcCallsTotalPrice(0.37m);
            Console.WriteLine(totalPriceCalls);
            int longestDuration = gsm.CallHistory.Max(c => c.Duration);
            Call longestCall = gsm.CallHistory.FirstOrDefault(c => c.Duration == longestDuration);
            gsm.CallHistory.Remove(longestCall);
            totalPriceCalls = gsm.CalcCallsTotalPrice(0.37m);
            Console.WriteLine(totalPriceCalls);
            gsm.ClearCallHistory();
        }
开发者ID:VDGone,项目名称:TelerikAcademy-1,代码行数:27,代码来源:GSMCallHistoryTest.cs

示例3: Main

        static void Main()
        {
            GSM NokiaN92 = new GSM("Nokia", "N82", 190, "Pesho Gosho", new Battery(Battery.Type.NiCD, 150, 13.5), new Display(2.5, 2000000000));

            Console.WriteLine("Add some calls...");
            NokiaN92.AddCall("0892023111", 250, 2013, 2, 25, 21, 9, 3);
            NokiaN92.AddCall("0892023111", 50, 2013, 2, 22, 12, 2, 30);
            NokiaN92.AddCall("0892023111", 110, 2013, 1, 7, 18, 3, 12);
            Console.WriteLine("Print the calls:");
            foreach (var item in NokiaN92.CallHistory)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("Calculate price of calls if the price per minute is 0.37: {0}", NokiaN92.TotalCallsPrice((decimal)0.37));

            Console.WriteLine("Deleting longest call duration  with the method .DeleteCall(Call)");
            NokiaN92.DeleteCall(NokiaN92.CallHistory[0]);
            Console.WriteLine("Calculate price of calls if the price per minute is 0.37: {0}", NokiaN92.TotalCallsPrice((decimal)0.37));

            Console.WriteLine("Clear the CallHistory and print it:");
            NokiaN92.ClearCallHistory();
            foreach (var item in NokiaN92.CallHistory)
            {
                Console.WriteLine(item);
            }
        }
开发者ID:krstan4o,项目名称:TelerikAcademy,代码行数:27,代码来源:GSMCallHistoryTest.cs

示例4: Main

    static void Main(string[] args)
    {
        GSM phone = new GSM("lala", "sumsAng", "batman", 10000.99);

        phone.MakeCall(DateTime.Now, "0899999999", 3.44);
        phone.MakeCall(DateTime.Now.AddHours(3), "0899999999", 3.44);
        phone.MakeCall(DateTime.Now.AddDays(99), "0889666999", 9.44);
        phone.MakeCall(DateTime.Now.AddDays(5).AddHours(10), "0009666999", 9.44);

        Console.WriteLine("Calls ordered by date: ");
        foreach (DateTime timeOfCall in phone.GetCallsByDate())
        {
            Console.WriteLine(timeOfCall.ToString());
        }

        phone.DeleteCall(2);
        Console.WriteLine("New calls: ");
        foreach (DateTime timeOfCall in phone.GetCallsByDate())
        {
            Console.WriteLine(timeOfCall.ToString());
        }

        phone.ClearCallHistory();
        Console.WriteLine("\nNothing will show, because history is deleted: ");
        foreach (DateTime timeOfCall in phone.GetCallsByDate())
        {
            Console.WriteLine(timeOfCall.ToString());
        }
    }
开发者ID:Dyno1990,项目名称:TelerikAcademy-1,代码行数:29,代码来源:AddDeleteHistory.cs

示例5: Test

    public static void Test()
    {
        // create new GSM instance
        var huawei = new GSM(
            "Ascend G600", 
            "Huawei", 
            "Mtel", 
            new Display(4.5, Display.ColorDepth._32Bit), 
            new Battery("Toshiba-tbsae", 380, 6, Battery.Type.LiPol), 600);

        // add some calls to list of calls
        huawei.AddCall("0888124122", 210);
        huawei.AddCall("0888124122", 40);
        huawei.AddCall("0888124122", 80);
        huawei.AddCall("0919125121", 600);
        huawei.AddCall("0919125121", 10);

        huawei.ShowCalls(); // Print the call list

        // Calculate the price of the each call
        Console.WriteLine("The price of all calls is {0} ", huawei.CalculatePriceOfCalls(0.32m));
        huawei.RemoveLongestCall();
        huawei.ClearCallHistory();
        huawei.ShowCalls();
    }
开发者ID:hrist0stoichev,项目名称:Telerik-Homeworks,代码行数:25,代码来源:GSMCallHistoryTest.cs

示例6: Main

        static void Main()
        {
            Console.OutputEncoding = System.Text.Encoding.Unicode;
            GSM myPhone = new GSM("3310", "Nokia", 1000M, "Ivan", new Display(1740, 33480, 160000000), new Battery("PK15", 50000, 2000, BatteryType.LiPol));

            myPhone.AddCall("08999333888", DateTime.Now, 200);
            myPhone.AddCall("08999333888", DateTime.Now, 300);
            myPhone.AddCall("08888333888", DateTime.Now, 400);
            myPhone.AddCall("08888333888", DateTime.Now, 500);
            myPhone.AddCall("09999999999", DateTime.Now, 1);
            myPhone.AddCall("08888555555", DateTime.Now, 200);
            myPhone.AddCall("08888555555", DateTime.Now, 300);
            myPhone.AddCall("08888555555", DateTime.Now, 400);
            myPhone.AddCall("08888555555", DateTime.Now, 10101);

            Console.WriteLine(myPhone.ShowCallHistory());

            Console.WriteLine("Total call price: {0:C2}", myPhone.TotalCallPrice(0.37M));

            myPhone.DeleteLongestCall();
            myPhone.DeleteShortestCall();
            myPhone.DeleteCall(3);

            Console.WriteLine(new string('*', 50));
            Console.WriteLine(myPhone.ShowCallHistory());

            myPhone.ClearCallHistory();

            Console.WriteLine(new string('*', 50));
            Console.WriteLine(myPhone.ShowCallHistory());
        }
开发者ID:MihailGochev,项目名称:Telerik,代码行数:31,代码来源:GSMCallHistoryTest+.cs

示例7: Main

        static void Main()
        {
            GSM TestGSM = new GSM("GALAXY S4", "Samsung", 1365, "Ivan",
                new Battery("Toshiba", 24, 12, BatteryType.LiIon), new Display(7, 256));

            GSM[] arrayOfGSM = { TestGSM, GSM.IPhone4S };

            foreach (var item in arrayOfGSM)
            {
                Console.WriteLine(item.ToString());
                Console.WriteLine();
            }

            TestGSM.AddCallsToHistory(new Call(DateTime.Now, "0834567822", 66));
            TestGSM.AddCallsToHistory(new Call(DateTime.Now, "0888456378", 99));
            TestGSM.AddCallsToHistory(new Call(DateTime.Now, "0899456578", 115));

            TestGSM.DisplayCallHistory();

            Console.WriteLine();
            Console.WriteLine("Total price of calls is : {0:F3} leva ", TestGSM.TotalPriceOfCalls());
            Console.WriteLine();

            TestGSM.DeleteCallFromHistory();
            Console.WriteLine();

            TestGSM.DisplayCallHistory();

            Console.WriteLine();
            Console.WriteLine("Total price of calls is : {0:F3} leva ", TestGSM.TotalPriceOfCalls());

            TestGSM.ClearCallHistory();
            Console.WriteLine();
            TestGSM.DisplayCallHistory();
        }
开发者ID:valkanov,项目名称:TelerikAcademy,代码行数:35,代码来源:GSMTest.cs

示例8: Main

        static void Main(string[] args)
        {
            try
            {
                //Create battery and display for the GSM
                Battery battery = new Battery("BL-5C",360,7,Battery.BatteryType.LithiumLon);
                Display display = new Display(3,65536);
                //Create GSM
                GSM gsm = new GSM("1208", "nokia", 50, "Georgi", battery, display);
                //Console.WriteLine(gsm.ToString()); //Print GSM data

                //Mace some calls and print the history
                gsm.AddCall(new Call(new DateTime(2013, 02, 22, 19, 01, 22), "00359888888888", 200));
                gsm.AddCall(new Call(new DateTime(2013,02,22,20,02,33),"0887888888",302));
                gsm.AddCall(new Call(new DateTime(2013, 02, 22, 20, 30, 19), "0889-88-88-88", 178));
                gsm.PrintCallHistiry();
                //Calculate the price of all calls
                decimal price = 0.37m;
                gsm.CalculateTotalCallsPrice(price);

                //Remove the longest call and calculate the price again
                gsm.DeleteCall(1); //The calls in the list start from 0, so the second call(longest) is 1
                gsm.CalculateTotalCallsPrice(price);

                //Clear the history and print it
                gsm.ClearCallHistory();
                gsm.PrintCallHistiry();

            }
            catch (Exception ex)
            {

                Console.WriteLine("Error!"+ex.Message);
            }
        }
开发者ID:Jarolim,项目名称:TelerikAcademy-1,代码行数:35,代码来源:GSMCallHistoryTest(Main).cs

示例9: 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

示例10: Main

    static void Main()
    {
        GSM nokia = new GSM("N73", "Nokia", "Pesho", 360,
            new Battery("BP-6M", 370, 6, BatteryType.LiIon), new Display(2.4, 243000));

        GSM samsung = new GSM("GalaxyS III", "Samsung", "Gosho", 819,
            new Battery("HR32", 790, 50, BatteryType.LiIon), new Display(4.8, 16000000));

        GSM sonyEricsson = new GSM("Xperia Z", "Sony Ericsson", "Kiro", 864,
            new Battery("PM63", 550, 40, BatteryType.LiIon), new Display(5, 16000000));

        GSM vertu = new GSM("Ascent", "Vertu", "Dimcho", 10400,
            new Battery("RP-M4", 150, 4, BatteryType.LiIon), new Display(0.87, 6));

        GSM[] mobilePhones = { nokia, samsung, sonyEricsson, vertu, GSM.IPhone4S };

        foreach (var phone in mobilePhones)
        {
            Console.WriteLine(phone);
            Console.WriteLine("------------------------------");
        }

        Call callOne = new Call("0885131618", 125);
        Call callTwo = new Call("0886933601", 563);
        Call callThree = new Call("0886948266", 256);

        vertu.AddCall(callOne);
        vertu.AddCall(callTwo);
        vertu.AddCall(callThree);

        Console.WriteLine("Total price of all calls: {0}", vertu.CalcPriceOfCalls(0.37));

        double maxDuration = 0;
        string number = "";

        foreach (var call in vertu.CallHistory)
        {
            if (maxDuration < call.Duration)
            {
                maxDuration = call.Duration;
                number = call.DialedPhoneNumber;
            }
        }

        Call longestCall = new Call(number, maxDuration);

        Console.WriteLine("The longest call lasted {0} seconds and it is made with number {1}.", maxDuration, number);
        vertu.DeleteCall(longestCall);
        Console.WriteLine("Now the longest call is removed from the call history.");
        Console.WriteLine("New total price of all calls: {0}", vertu.CalcPriceOfCalls(0.37));
        vertu.ClearCallHistory();
        Console.WriteLine("Call history is now cleared!!!");
    }
开发者ID:powerslider,项目名称:TelerikAcademyHomeworks,代码行数:53,代码来源:GSMTest.cs

示例11: Main

    static void Main()
    {
        try
        {
            //adding battery type i the battery constructor
            Battery batteryOne = new Battery("SameModel", 10, 20, BatteryType.LiIon);
            Console.WriteLine("-------------------------EX3---------------------------");
            Console.WriteLine(batteryOne.Type);
            // creating phone
            Display displayOne = new Display(55f);
            GSM gsm = new GSM("55k33", "Nokia", 666, "Nqkoi", batteryOne, displayOne);
            // test for override method ToString()
            Console.WriteLine("-------------------------EX4---------------------------");
            Console.WriteLine(gsm.ToString());
            Console.WriteLine("-------------------------EX.7--------------------------");
            //creating object test
            GSMTests test = new GSMTests();
            test.Tests();//call its method  It is void method so it will directly write the data
            //ex.9
            Console.WriteLine("------------------------EX9---------------------------");
            string dateTime ="22.12.2013 01.05.35";

            DateTime day = DateTime.ParseExact(dateTime, "dd.MM.yyyy HH.mm.ss", CultureInfo.InvariantCulture);//date
            string dateTime2 = "20.12.2013 01.05.35";
            DateTime day2 = DateTime.ParseExact(dateTime2, "dd.MM.yyyy HH.mm.ss", CultureInfo.InvariantCulture);//date
            Call firstCall = new Call(day,"0555555555",78);
            Call secondCall = new Call(day2, "0555555555", 105);
            Console.WriteLine(firstCall.DateAndTime);
            gsm.AddCalls(firstCall);
            gsm.AddCalls(secondCall);
            Console.WriteLine();
            Console.WriteLine(gsm.CallHistory[0].DateAndTime);
            Console.WriteLine(gsm.CallHistory[1].DateAndTime);
            Console.WriteLine("------------------------EX10--------------------------");
            gsm.DeleteCall(secondCall);
            for (int i = 0; i < gsm.CallHistory.Count; i++)
            {
                 Console.WriteLine(gsm.CallHistory[i].DateAndTime);
            }
            gsm.ClearCallHistory();
            Console.WriteLine("There is {0} call in the call history",gsm.CallHistory.Count);
            Console.WriteLine("--------------------------EX12------------------------");
            GSMCallHistoryTest testHistory = new GSMCallHistoryTest();
            testHistory.GSMCallHistoryTests();

        }
        catch (ArgumentException exep)
        {
            Console.WriteLine("There is incorrect data!");
            Console.WriteLine(exep.ToString());
        }
    }
开发者ID:naturalna,项目名称:OOPPrinciples,代码行数:52,代码来源:CreatingGsm.cs

示例12: Main

    public static void Main()
    {
        // Create the phone
        GSM myPhone = new GSM("Nexus 5", "Google");
        Console.WriteLine("Your phone: {0} {1}\n", myPhone.Manufacturer, myPhone.Model);

        // Let's make some random calls
        int numCalls = 5;
        Random rand = new Random();
        int callNumber;
        int callDuration;
        for (int i = 0; i < numCalls; i++)
        {
            callNumber = rand.Next(884000000, 899999999);
            callDuration = rand.Next(30, 300);

            myPhone.OpenCall("+359" + callNumber);
            myPhone.CloseCall(callDuration);
        }

        // Display the call history
        DisplayCallHistory(myPhone);

        // Display total cost of all calls
        decimal pricePerMinute = 0.37m;
        PrintTotalCost(myPhone, pricePerMinute);

        // Get the longest call
        int longestCallIndex = 0;
        for (int i = 0; i < myPhone.CallHistory.Count; i++)
        {
            if (myPhone.CallHistory[i].Duration > myPhone.CallHistory[longestCallIndex].Duration)
            {
                longestCallIndex = i;
            }
        }

        // Remove the longest call
        myPhone.DeleteCall(longestCallIndex);

        // Display total cost of all calls
        Console.WriteLine("\nAfter removing the longest call from the history:");
        PrintTotalCost(myPhone, pricePerMinute);

        // Clear the call history and print it. 
        Console.WriteLine("\nClear call history...");
        myPhone.ClearCallHistory();
        Console.WriteLine();
        DisplayCallHistory(myPhone);      
    }
开发者ID:MarKamenov,项目名称:TelerikAcademy,代码行数:50,代码来源:GSMCallHistoryTest.cs

示例13: Main

    static void Main()
    {
        GSM phone1 = new GSM("Samsung", "Germany", 1000);
            GSM phone2 = new GSM("Nokia", "Italy", 200.99m, "Boris");
            GSM phone3 = GSM.IPhone4S;

            GSM[] phones = new GSM[] { phone1, phone2, phone3 };

            Call newCall1 = new Call("05.03.2013",  "0882203628", 100);
            Call newCall2 = new Call("01.02.2013", "11:00", "0882203628", 60);
            Call newCall3 = new Call("0882203628", 10);
            Call newCall4 = new Call("08.03.2013", "21:00", "0882203628", 360);

            phone1.AddCall(newCall1);
            phone1.AddCall(newCall2);
            phone1.AddCall(newCall3);
            phone1.AddCall(newCall4);

            //Print CallHistory
            StringBuilder result = new StringBuilder();
            foreach (var call in phone1.CallHistory)
            {
                result.AppendFormat("Date: {0}\nTime: {1}\nDialedNumber: {2}\nDuration (in seconds): {3}\n\n",
                    call.date, call.time, call.dialedPnoneNumber, call.duration);
            }

            Console.WriteLine(result.ToString());

            //Calculate TotalPrice
            decimal price = phone1.TotalPrice(0.37m);
            Console.WriteLine("{0:F2}лв.", price);

            //Calculate TotalPrice without long call
            phone1.DeleteCall(newCall4);
            decimal priceWithoutLongCall = phone1.TotalPrice(0.37m);
            Console.WriteLine("{0:F2}лв.", priceWithoutLongCall);

            //Clear CallHistory
            phone1.ClearCallHistory();

            StringBuilder resultClear = new StringBuilder();
            foreach (var call in phone1.CallHistory)
            {
                resultClear.AppendFormat("Date: {0}\nTime: {1}\nDialedNumber: {2}\nDuration (in seconds): {3}\n\n",
                    call.date, call.time, call.dialedPnoneNumber, call.duration);
            }
            Console.WriteLine();
            Console.WriteLine("The result after clear is: \n", resultClear.ToString());
    }
开发者ID:rumyanaaleksandrova,项目名称:Classes_1,代码行数:49,代码来源:GSMCallHistoryTest.cs

示例14: Test

        public static void Test()
        {
            //Create Instance of GSM
            GSM myMobile = new GSM("One", "HTC", 1240, "Pratchett, Terry",
                                new Display(720, 1280, 4.5, 64000000),
                                new Battery("2070 mAh", 300, 150, Battery.BatteryTypes.LiIon)
                                );

            //Add some calls to CallHistory
            Call callOne = new Call(DateTime.Now, "+898 888 888", 1204);
            Call callTwo = new Call(DateTime.Now.AddDays(1), "+888 888 898", 1024);
            Call callThree = new Call(DateTime.Now.AddDays(1), "+888 888 898", 200);
            Call callFour = new Call(DateTime.Now.AddHours(1), "+888 898 898", 2020);

            myMobile.CallHistory.Add(callOne);
            myMobile.CallHistory.Add(callTwo);
            myMobile.CallHistory.Add(callThree);
            myMobile.CallHistory.Add(callFour);

            //Display the information about the calls
            Console.WriteLine("All calls information\n");
            foreach (Call item in myMobile.CallHistory)
            {
                Console.WriteLine(item);
            }

            //Assuming that the price per minute is 0.37 calculate and print
            //the total price of the calls in the history.
            Console.WriteLine("Calculate price example: ");
            var pricePerMinute = 0.37m;
            Console.WriteLine("Price of all calls {0:c}", myMobile.CallculatePrice(pricePerMinute));

            //Remove the longest call from the history and calculate the total price again.

                //find the longest call
            Call longestCall = FindLongestCall(myMobile);

                //remove the longest call
            myMobile.RemoveCall(longestCall);

                //calculate the price again and print it
            Console.WriteLine("Price after removing longest call: {0:c}", myMobile.CallculatePrice(pricePerMinute));

            //Finally clear the call history and print it.
            Console.WriteLine("\nBefore clear call history stores {0} items", myMobile.CallHistory.Count);
            myMobile.ClearCallHistory();
            Console.WriteLine("Now call history stores {0} items", myMobile.CallHistory.Count);
        }
开发者ID:nexusstar,项目名称:Telerik,代码行数:48,代码来源:GSMCallHistoryTest.cs

示例15: Print

    static public void Print()
    {
        
        GSM phone = new GSM("galaxy", "samsung");

        string date1 = "07/07/2011 10:48:12";
        string date2 = "17/03/2012 08:43:08";
        string date3 = "08/06/2012 02:52:24";
        Call call1 = new Call(ParseDate(date1).ToString("dd/MM/yyyy"), ParseDate(date1).ToString("hh:mm:ss"), 0898456456, 450);
        Call call2 = new Call(ParseDate(date2).ToString("dd/MM/yyyy"), ParseDate(date2).ToString("hh:mm:ss"), 0898324456, 350);
        Call call3 = new Call(ParseDate(date3).ToString("dd/MM/yyyy"), ParseDate(date3).ToString("hh:mm:ss"), 0898324879, 620);

        Console.WriteLine(call1);
        Console.WriteLine(new string('-', 20));
        Console.WriteLine(call2);
        Console.WriteLine(new string('-', 20));
        Console.WriteLine(call3);

        phone.AddCall(call1);
        phone.AddCall(call2);
        phone.AddCall(call3);

        decimal sum = phone.CalculateTotalPriceOfCalls(phone.CallHistory);
        Console.WriteLine("price of all calls in History is {0}", sum);

        ulong maxDuration = 0;
        int maxIndex = -1;
        for (int i = 0; i < phone.CallHistory.Count; i++)
        {
            if (maxDuration < phone.CallHistory[i].Duration)
            {
                maxDuration = phone.CallHistory[i].Duration;
                maxIndex = i;
            }
        }

        phone.DeleteCall(phone.CallHistory[maxIndex]);

        sum = phone.CalculateTotalPriceOfCalls(phone.CallHistory);
        Console.WriteLine("price of all calls in History is {0}", sum);

        phone.ClearCallHistory();
        Console.WriteLine("there are {0} calls in call history", phone.CallHistory.Count);
        //Console.WriteLine(call1.Date + " " + call1.Time + " " + call1.DialedNumber + " " + call1.Duration);

    }
开发者ID:hristo11111,项目名称:TelerikAcademy-HristoBratanov,代码行数:46,代码来源:GSMCallHistoryTest.cs


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