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


C# Call类代码示例

本文整理汇总了C#中Call的典型用法代码示例。如果您正苦于以下问题:C# Call类的具体用法?C# Call怎么用?C# Call使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Main

 static void Main()
 {
     try
     {
         BatteryEnumeration battery = BatteryEnumeration.CreateBattery();
         DisplayEnumeration display = DisplayEnumeration.CreateDisplay();
         GSMStatic phone = GSMProperty.CreatePhone<GSMStatic>(battery, display);
         string info = phone.ToString();
         Console.WriteLine("Phone info:");
         Console.WriteLine(info);
         Console.WriteLine();
         Console.WriteLine("Phone info about iPhone 4S:");
         Console.WriteLine(GSMStatic.IPhone4S);
         Console.WriteLine();
         Console.WriteLine("Enter dailed phone number");
         string dialedNumber = Console.ReadLine();
         Call call = new Call(phone, dialedNumber);
         Console.WriteLine("You called {0}", call.DailedPhone);
         Console.WriteLine("Date {0:dd:MM:yyyy}", call.Date);
         Console.WriteLine("at {0} o'clock", call.StartTime);
         Console.WriteLine("Press enter to finish the call");
         Console.ReadLine();
         Console.WriteLine("The call duration was {0}", call.FinishCall());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
开发者ID:vasilkrvasilev,项目名称:ObjectOrientedProgramming,代码行数:29,代码来源:GSMCall.cs

示例2: Main

        static void Main()
        {
            Console.WriteLine("Creating a new phone");
            MobilePhone yourPhone = new MobilePhone("tPhone", "Telerik", 250, "Pesho");
            Call firstCall = new Call(new DateTime(2015,03,12,21,15,59),"0887654321", 123);
            Call secondCall = new Call(new DateTime(2015, 03, 12, 22, 37, 01), "Mum", 1235);
            Call thirdCall = new Call(new DateTime(2015, 03, 13, 02, 49, 10), "Ex girlfriend", 30);
            
            yourPhone.AddCall(firstCall);
            yourPhone.AddCall(secondCall);
            yourPhone.AddCall(thirdCall);
           
            var result = yourPhone.SomeCalls;
            foreach (var call in result)
            {
                Console.WriteLine(call.PrintCalls());
            }

            double billToPay = yourPhone.CalculateInvoice(0.37, yourPhone.SomeCalls);
            Console.WriteLine();
            Console.WriteLine("Your invoice to pay is {0:C}",billToPay);
            var longestCall = yourPhone.SomeCalls.OrderBy(x => x.Duration).Last();
            yourPhone.RemoveCall(longestCall);
            billToPay = yourPhone.CalculateInvoice(0.37, yourPhone.SomeCalls);
            Console.WriteLine("Your invoice to pay after removing the call to your mother is {0:C}", billToPay);
            yourPhone.ClearHistory(yourPhone.SomeCalls);
            billToPay = yourPhone.CalculateInvoice(0.37, yourPhone.SomeCalls);
            Console.WriteLine("Your invoice after last payment is {0:C}", billToPay);

        }
开发者ID:Alex-Bubblemaster,项目名称:C-Sharp-OOP,代码行数:30,代码来源:MobilePhoneTest.cs

示例3: CheckCallInStatus_AnyCallIds_IsCallerTrue

        public void CheckCallInStatus_AnyCallIds_IsCallerTrue()
        {
            // Setup dependence
            var settingMock = new Mock<ISettings>();
            var componentMock = new Mock<IComponents>();
            var uowMock = new Mock<IUnitOfWork>();
            var repositoryMock = new Mock<IRepository>();
            var serviceLocatorMock = new Mock<IServiceLocator>();

            serviceLocatorMock.Setup(r => r.GetInstance<IRepository>())
                .Returns(repositoryMock.Object);
            ServiceLocator.SetLocatorProvider(() => serviceLocatorMock.Object);

            // Arrange data
            Guid id = Guid.NewGuid();
            bool expectedResult = true;
            string status = "Pending";
            bool isCaller = true;
            Call call = new Call
            {
                Id = id,
                CallerStatus = status
            };
            repositoryMock.Setup(r => r.FindById<Call>(id)).Returns(call);

            // Act
            CallService callService = new CallService(uowMock.Object, repositoryMock.Object, settingMock.Object, componentMock.Object);
            bool currentResult = callService.CheckCallInStatus(id, status, isCaller);

            // Assert
            repositoryMock.Verify(r => r.FindById<Call>(id));
            Assert.AreEqual(expectedResult, currentResult);
        }
开发者ID:nguyenminhthu,项目名称:TeleConsult,代码行数:33,代码来源:CallServiceTest.cs

示例4: Main

    static void Main()
    {
        DateTime date1 = new DateTime(2013, 5, 24, 11, 11, 30);
        DateTime date2 = new DateTime(2013, 5, 24, 15, 23, 2);
        DateTime date3 = new DateTime(2013, 5, 31, 9, 00, 00);
        DateTime date4 = new DateTime(2013, 5, 31, 18, 12, 20);

        Call call1 = new Call(date1, "0888313233", 850);
        Call call2 = new Call(date2, "0888909090", 95);
        Call call3 = new Call(date3, "0889556677", 213);
        Call call4 = new Call(date4, "0888313233", 37);

        Battery battery = new Battery ("PX8", BatteryType.LiIon, 300, 8);
        Display display = new Display(4, 16000000);
        GSM gsm = new GSM("I900", "Samsung", 500, "Me", battery, display);

        gsm.AddCalls(call1);
        gsm.AddCalls(call2);
        gsm.AddCalls(call3);
        gsm.AddCalls(call4);

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

        Console.WriteLine("Total amount to pay: {0:C}",gsm.TotalCallsPrice);

        gsm.DeleteCalls(call1);
        Console.WriteLine("Total amount to pay: {0:C}", gsm.TotalCallsPrice);

        gsm.ClearHistory();
        Console.WriteLine("Total amount to pay: {0:C}", gsm.TotalCallsPrice);
    }
开发者ID:stefan-er,项目名称:CSharp,代码行数:34,代码来源:GSMCallHistoryTest.cs

示例5: Fill

 private void Fill(DbDataReader reader, Call call)
 {
     call.Start = DateUtils.ConvertFromLinuxStamp(reader.GetValueObject<long>("begin_timestamp"));
     call.Duration = TimeSpan.FromSeconds(reader.GetValueObject<long>("duration"));
     call.Host_Identity = reader.GetObject<string>("host_identity");
     call.Id = reader.GetValueObject<long>("id");
 }
开发者ID:ggiraudon,项目名称:skype-history-reporter,代码行数:7,代码来源:SqliteCallRepository.cs

示例6: onSkypeCallStatus

        private void onSkypeCallStatus(Call call, TCallStatus status)
        {
            switch (status)
            {
                    //new call
                    //TODO: check why clsInprogress doesnt work here!
                case TCallStatus.clsRinging:
                    TCallType type = call.Type;

                    if ((type == TCallType.cltIncomingP2P) || (type == TCallType.cltOutgoingP2P))
                    {
                        foreach (DCallStartedHandler callStartedHandler in callStartedHandlers)
                        {
                            callStartedHandler(call.PartnerHandle, call.Id, type == TCallType.cltOutgoingP2P);
                        }
                    }
                    break;

                    //call closed
                case TCallStatus.clsMissed:
                case TCallStatus.clsFinished:
                case TCallStatus.clsRefused:
                case TCallStatus.clsCancelled:
                    foreach (DCallEndedHandler callEndedHandler in callEndedHandlers)
                    {
                        callEndedHandler(call.PartnerHandle, call.Id);
                    }
                    break;

                default:
                    Logger.log(TLogLevel.logEverything, "Info: Call status changed to: " + status);
                    break;

            }
        }
开发者ID:flxflx,项目名称:watchasayin,代码行数:35,代码来源:SkypeAPIEventHandler.cs

示例7: MakeHistory

    public static GSMHistory MakeHistory()
    {
        BatteryEnumeration battery = BatteryEnumeration.CreateBattery();
        DisplayEnumeration display = DisplayEnumeration.CreateDisplay();
        GSMHistory phone = GSMProperty.CreatePhone<GSMHistory>(battery, display);
        string info = phone.ToString();
        Console.WriteLine("Phone info:");
        Console.WriteLine(info);
        Console.WriteLine();
        Console.WriteLine("Phone info about iPhone 4S:");
        Console.WriteLine(GSMHistory.IPhone4S);
        Console.WriteLine();
        byte dialing = 0;
        do
        {
            Console.WriteLine("For new dial enter 1, for last dial enter 0");
            dialing = byte.Parse(Console.ReadLine());
            Console.WriteLine("Enter dailed phone number");
            string dialedNumber = Console.ReadLine();
            Call call = new Call(phone, dialedNumber);
            Console.WriteLine("Press enter to finish the call");
            Console.ReadLine();
            call.FinishCall();
            phone.AddCall(call);
        }
        while (dialing == 1);

        return phone;
    }
开发者ID:vasilkrvasilev,项目名称:ObjectOrientedProgramming,代码行数:29,代码来源:History.cs

示例8: Main

        public static void Main()
        {
            GSM myGSM = new GSM(
                    "Asha 205 ",
                    "Nokia",
                    "Nikolay Kostadinov",
                    120m,
                    "Nokia",
                    200,
                    10,
                    4,
                    65000u);
            
            Random rnd = new Random();
            
            for (int i = 1; i < 50; i++)
            {
                Call call = new Call("+359886630111", (uint)rnd.Next(45, 200));
                myGSM.AddCall(call);
            }

            Console.WriteLine(GSM.Iphone4S);

            DisplayCallHistory(myGSM);
            Console.ReadKey();
            DeleteMaxDurationCall(myGSM);
            DisplayCallHistory(myGSM);
        }
开发者ID:NikolayKostadinov,项目名称:Homeworks,代码行数:28,代码来源:GSMCallHistoryTest.cs

示例9: CallHistory

        //Problem 12. Call history test
        //Write a class GSMCallHistoryTest to test the call history functionality of the GSM class.
        //Create an instance of the GSM class.
        //Add few calls.
        //Display the information about the calls.
        //Assuming that the price per minute is 0.37 calculate and print the total price of the calls in the history.
        //Remove the longest call from the history and calculate the total price again.
        //Finally clear the call history and print it.
        public static GSM CallHistory()
        {
            Console.WriteLine(new string('=' , 60));
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Now showing the call history!");
            Console.ResetColor();

            var phone = new GSM("Xperia Z2", "Sony", 1200.99M, "Rocho", new Battery(BatteryType.LiIon), new Display(5.1, 16000000), ColorOfPhones.Black);
            phone.AddCalls(new Call(DateTime.Parse("03/03/2003 12:00:44"), "0888454124", 154));
            phone.AddCalls(new Call(DateTime.Parse("02/04/2003 13:00:44"), "0899975412", 647));
            phone.AddCalls(new Call(DateTime.Parse("06/10/2003 23:40:44"), "0894526475", 345));

            var callMoney = phone.TotalPriceOfCalls();

            Console.WriteLine("Total calls price: {0:F2} лв.", callMoney);

            Call longestCall = new Call(DateTime.Parse("06/10/2003 23:40:44"), "", 0);
            foreach (var call in phone.CallHistory)
            {
                if (call.DurationInSeconds > longestCall.DurationInSeconds)
                {
                    longestCall = call;
                }
            }
            phone.DeleteCalls(longestCall);
            callMoney = phone.TotalPriceOfCalls();
            Console.WriteLine("Total calls price without the longest call: {0:F2} лв.", callMoney);
            phone.ClearCalls();
            Console.WriteLine("Call histroy has been cleared!");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("This test was done on this device:");
            Console.ResetColor();

            return phone;
        }
开发者ID:nikistefanov,项目名称:Telerik-Academy-Homework,代码行数:43,代码来源:GSMCallHistoryTest.cs

示例10: getRequest

 internal static string getRequest(string parentkey, string id, string proc, object[] args, bool connect_as)
 {
     if (proc == "writegroup")
     {
         List<object> newArgs = new List<object>();
         foreach (Dictionary<string, object> dict in args)
         {
             foreach (KeyValuePair<string, object> kvp in dict)
             {
                 object[] formattingArray = new object[2];
                 formattingArray[0] = kvp.Key;
                 formattingArray[1] = kvp.Value;
                 newArgs.Add(formattingArray);
             }
             args[0] = newArgs.ToArray();
         }
     }
     Call call = new Call { id = 1, procedure = proc, arguments = args };
     Call[] calls = new Call[] { call };
     Auth auth;
     if (connect_as)
     {
         auth = new Auth { cik = parentkey, client_id = id };
     }
     else
     {
         auth = new Auth { cik = parentkey, resource_id = id };
     }
     Request req = new Request { auth = auth, calls = calls };
     return JsonConvert.SerializeObject(req, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
 }
开发者ID:exosite-labs,项目名称:clronep,代码行数:31,代码来源:JsonHandler.cs

示例11: Main

        static void Main()
        {
            const decimal PricePerMinute = 0.37m;
            //Array of 5 phones
            GSM[] phones = new GSM[5];
            // Different types of batteries and displays
            Battery battery1 = new Battery(Battery.BatteryType.NiMH, 50, 10);
            Battery battery2 = new Battery(Battery.BatteryType.LiIon, 40, 5);
            Battery battery3 = new Battery(Battery.BatteryType.ZnChl, 100, 40);
            Display display1 = new Display(5.0, 1000000);
            Display display2 = new Display(5.5, 103530050);
            Display display3 = new Display(4, 425324);

            //Some phones created
            phones[0] = new GSM("Samsung Galaxy S4", "Samsung" , 1444.44 , "Pesho Ivanov" , battery: battery1 , display: display1);
            phones[1] = new GSM("iPhone 5", "Apple", 1500, "Bill Gates", battery: battery2, display: display3);
            phones[2] = new GSM("HTC One X", "HTC", 1200, "Someone Else", battery: battery3);
            phones[3] = new GSM("Nokia 3310", "Nokia",null,null,null,display: display2);
            phones[4] = GSM.PIPhone4S;

            //Using the class GSMtest we print all the phones using method
            Console.WriteLine("PHONES:");
            Console.WriteLine();
            GSMTest gsmTestPrint = new GSMTest();
            gsmTestPrint.PrintAllPhones(phones);

            Console.WriteLine("CALLS:");
            Console.WriteLine();
            //For the first phone we create call history
            phones[0].CallHistory = new CallHistory();
            CallHistory history = phones[0].CallHistory;
            //Adding 4 calls with different params
            Call testCall1 = new Call(DateTime.Now.AddHours(2), 450, 532423);
            Call testCall2 = new Call(DateTime.UtcNow, 440, 12532423);
            Call testCall3 = new Call(DateTime.MinValue, 29, 94532423);
            Call testCall4 = new Call(DateTime.MaxValue, 90, 3532423);
            history.AddCall(testCall1);
            history.AddCall(testCall2);
            history.AddCall(testCall3);
            history.AddCall(testCall4);
            //Then we test the history
            GSMCallHistoryTest callHistoryTest = new GSMCallHistoryTest(phones[0].CallHistory);
            //We print the list  and then the first calculated price
            callHistoryTest.PrintList();
            callHistoryTest.PrintCalculatedPrice(PricePerMinute);
            //Then we remove the longest call and print the total price again
            callHistoryTest.RemoveLongestCall();
            callHistoryTest.PrintCalculatedPrice(PricePerMinute);
            //Then we remove a call on position in the list - 1  and print the price we have to pay again
            callHistoryTest.RemoveCallTest(position:1);
            callHistoryTest.PrintCalculatedPrice(PricePerMinute);
            //We print the remaining calls on the list to show it's not empty yet
            Console.WriteLine();
            Console.WriteLine("The remaining items on the call list:");
            callHistoryTest.PrintList();
            //Finally we clear the list and print it
            callHistoryTest.ClearList();
            callHistoryTest.PrintList();
        }
开发者ID:NikolayGenov,项目名称:TelerikAcademy,代码行数:59,代码来源:Tests.cs

示例12: Animate

 public void Animate(Call call, Response response, CallContext context)
 {
     JSON js = new JSON();
     js.serialized = call.GetParameterString("animation");
     lock (queueLock) {
         callQueue.Enqueue(new GuideCall(AvatarGuide.State.ANIMATING, (AvatarAnimation)js.ToJSON("avatarAnimation")));
     }
 }
开发者ID:LBNunes,项目名称:Avatar,代码行数:8,代码来源:GuideDriver.cs

示例13: Main

        static void Main()
        {
            Console.WriteLine("Pres Enter to stop!");
            Call call = new Call(TimeNow);
            Timer time = new Timer(call.Invoke, null, 0, 1000);

            Console.Read();
        }
开发者ID:VelizarIT,项目名称:TelerikAcademy,代码行数:8,代码来源:Tests.cs

示例14: callToolStripMenuItem_Click

 private void callToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Call newMDIChild = new Call();
     // Set the Parent Form of the Child window.
     newMDIChild.MdiParent = this;
     // Display the new form.
     newMDIChild.Show();
 }
开发者ID:h27han,项目名称:Desktop-Communication,代码行数:8,代码来源:Main.cs

示例15: SerializeDeserialize_WithEmptyCall_ShouldWork

        public void SerializeDeserialize_WithEmptyCall_ShouldWork()
        {
            var inputCall = new Call();

            Call outputCall = SerializeDeserialize(inputCall);

            AssertThatCallsAreEqual(outputCall, inputCall);
        }
开发者ID:ebjornset,项目名称:Crasop.Net,代码行数:8,代码来源:SerializationTests.cs


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