forked from abishekaditya/DesignPatterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDvdPlayer.cs
More file actions
30 lines (24 loc) · 679 Bytes
/
DvdPlayer.cs
File metadata and controls
30 lines (24 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
namespace FacadePattern
{
public class DvdPlayer
{
private Dvd _dvd;
private int _time = 0;
public void On() => Console.WriteLine("DVD Player powered on");
public void Insert(Dvd dvd)
{
_dvd = dvd;
Console.WriteLine($"Inserting {dvd.Movie}");
}
public void Play() => Console.WriteLine($"Playing {_dvd.Movie}");
public void Pause()
{
Console.WriteLine($"Pausing at {_time = (new Random()).Next(_time, _time + 120)}");
}
public void Resume()
{
Console.WriteLine($"Resuming from {_time}");
}
}
}