Skip to content

Commit

Permalink
Bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasCancio committed Jan 13, 2021
1 parent 6e555b2 commit dd44f69
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 0 deletions.
8 changes: 8 additions & 0 deletions PatternsEstruturais/Bridge/Bridge.csproj
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>
17 changes: 17 additions & 0 deletions PatternsEstruturais/Bridge/Culinaria.cs
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";
}
}
}
17 changes: 17 additions & 0 deletions PatternsEstruturais/Bridge/Documentario.cs
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";
}
}
}
17 changes: 17 additions & 0 deletions PatternsEstruturais/Bridge/Filme.cs
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";
}
}
}
10 changes: 10 additions & 0 deletions PatternsEstruturais/Bridge/ICanal.cs
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();
}
}
36 changes: 36 additions & 0 deletions PatternsEstruturais/Bridge/Program.cs
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();
}
}
}
34 changes: 34 additions & 0 deletions PatternsEstruturais/Bridge/SmartTv.cs
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!");
}
}
}
}
6 changes: 6 additions & 0 deletions PatternsEstruturais/PatternsEstruturais.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.30804.86
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adapter", "Adapter\Adapter.csproj", "{55F89ED5-E95B-4392-8320-C47E32B860B7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bridge", "Bridge\Bridge.csproj", "{02D55463-CDED-468F-9139-94FA89E255FA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +17,10 @@ Global
{55F89ED5-E95B-4392-8320-C47E32B860B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{55F89ED5-E95B-4392-8320-C47E32B860B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{55F89ED5-E95B-4392-8320-C47E32B860B7}.Release|Any CPU.Build.0 = Release|Any CPU
{02D55463-CDED-468F-9139-94FA89E255FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{02D55463-CDED-468F-9139-94FA89E255FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{02D55463-CDED-468F-9139-94FA89E255FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{02D55463-CDED-468F-9139-94FA89E255FA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit dd44f69

Please sign in to comment.