forked from LucasCancio/design-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e555b2
commit dd44f69
Showing
8 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
|
||
namespace Bridge | ||
{ | ||
public class Culinaria : ICanal | ||
{ | ||
public string Canal() | ||
{ | ||
return "Sintonizado no Canal de Culinária"; | ||
} | ||
|
||
public string Status() | ||
{ | ||
return "Você está assitindo - Receita de Bolo de Chocolate"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
|
||
namespace Bridge | ||
{ | ||
public class Documentario : ICanal | ||
{ | ||
public string Canal() | ||
{ | ||
return "Sintonizado no Canal de Documentários"; | ||
} | ||
|
||
public string Status() | ||
{ | ||
return "Você está assitindo - A origem de TUDO"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
|
||
namespace Bridge | ||
{ | ||
public class Filme : ICanal | ||
{ | ||
public string Canal() | ||
{ | ||
return "Sintonizado no Canal de Filmes"; | ||
} | ||
|
||
public string Status() | ||
{ | ||
return "Você está assitindo - Os Vingadores"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
|
||
namespace Bridge | ||
{ | ||
public interface ICanal | ||
{ | ||
string Canal(); | ||
string Status(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
|
||
namespace Bridge | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
SmartTv minhaTv = new SmartTv(); | ||
Console.WriteLine("SELECIONE UM CANAL"); | ||
Console.WriteLine("1- Filmes\n2- Documentários\n3- Culunária"); | ||
|
||
ConsoleKeyInfo input = Console.ReadKey(); | ||
|
||
switch (input.KeyChar) | ||
{ | ||
case '1': | ||
minhaTv.canal_atual = new Filme(); | ||
break; | ||
case '2': | ||
minhaTv.canal_atual = new Documentario(); | ||
break; | ||
case '3': | ||
minhaTv.canal_atual = new Culinaria(); | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
Console.WriteLine(); | ||
|
||
minhaTv.ExibeCanalSintonizado(); | ||
minhaTv.PlayTv(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
|
||
namespace Bridge | ||
{ | ||
public class SmartTv | ||
{ | ||
// Bridge | ||
public ICanal canal_atual { get; set; } | ||
|
||
public void ExibeCanalSintonizado() | ||
{ | ||
if (canal_atual != null) | ||
{ | ||
Console.WriteLine(canal_atual.Canal()); | ||
} | ||
else | ||
{ | ||
Console.WriteLine("Por favor, selecione um canal!"); | ||
} | ||
} | ||
|
||
public void PlayTv() | ||
{ | ||
if (canal_atual != null) | ||
{ | ||
Console.WriteLine(canal_atual.Status()); | ||
} | ||
else | ||
{ | ||
Console.WriteLine("Por favor, selecione um canal, para assistir algo!"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters