示例#1
0
文件: Classes.cs 项目: Szuhi/Uni_200
 void ReceiveCall(Telephone source)
 {
     if (observer != null)
     {
         observer.IncomingCall(this, source.number);
     }
 }
示例#2
0
文件: Classes.cs 项目: Szuhi/Uni_200
 public void Calling(Telephone dest)
 {
     if (observer != null)
     {
         observer.OutgoingCall(this, dest.number);
     }
     if (account >= CHARGE)
     {
         dest.ReceiveCall(this);
         account -= CHARGE;
     }
 }
示例#3
0
文件: Program.cs 项目: Szuhi/Uni_200
        static void Main(string[] args)
        {
            Telephone   t1 = new Telephone("1"), t2 = new Telephone("2");
            CallJournal n = new CallJournal();

            t1.ObserveRegister(n);
            t2.ObserveRegister(new FileJournal());
            t1.UploadAccount(500);
            t1.Calling(t2);
            t1.Calling(t2);
            t2.Calling(t1);
            t2.Calling(t1);
            t1.Calling(t2);
            t1.Calling(t2);
            t2.Calling(t1);

            Console.ReadLine();
        }
示例#4
0
文件: Classes.cs 项目: Szuhi/Uni_200
 public void OutgoingCall(Telephone sender, string dest_number)
 {
     System.IO.File.AppendAllText("journal.log", "Outgoing call: " + sender + ", source: " + dest_number + "\r\n");
 }
示例#5
0
文件: Classes.cs 项目: Szuhi/Uni_200
 public void IncomingCall(Telephone sender, string source_number)
 {
     System.IO.File.AppendAllText("journal.log", "Incoming call: " + sender + ", source: " + source_number + "\r\n");
 }
示例#6
0
文件: Classes.cs 项目: Szuhi/Uni_200
 public void OutgoingCall(Telephone sender, string dest_number)
 {
     Console.WriteLine("Outgoing call: " + sender + ", destination: " + dest_number);
 }
示例#7
0
文件: Classes.cs 项目: Szuhi/Uni_200
 public void IncomingCall(Telephone sender, string source_number)
 {
     Console.WriteLine("Incoming call: " + sender + ", source: " + source_number);
 }