Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ref1 #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .vs/AutoFacotrySingleton/v16/.suo
Binary file not shown.
Empty file.
Binary file not shown.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
Binary file added .vs/Ref/v16/.suo
Binary file not shown.
7 changes: 7 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ExpandedNodes": [
"",
"\\HF2"
],
"PreviewInSolutionExplorer": false
}
Binary file added .vs/asd/v16/.suo
Binary file not shown.
Binary file added .vs/slnx.sqlite
Binary file not shown.
Binary file added AutoFacotrySingleton/.DS_Store
Binary file not shown.
39 changes: 39 additions & 0 deletions AutoFacotrySingleton/.vs/AutoFacotrySingleton/xs/UserPrefs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<Properties StartupConfiguration="{5E29C091-67A6-44C5-842F-CFC5A7BA18DE}|Default">
<MonoDevelop.Ide.Workbench ActiveDocument="Main2.cs">
<Files>
<File FileName="Factory/IFacotry.cs" Line="1" Column="1" />
<File FileName="Engine Factory/Engine.cs" Line="1" Column="1" />
<File FileName="Engine Factory/ModelSEngine.cs" Line="1" Column="1" />
<File FileName="Car Body Facotry/ModellSCarBody.cs" Line="1" Column="1" />
<File FileName="Factory/ModelSFacotry.cs" />
<File FileName="Factory/ModelYFactory.cs" Line="1" Column="1" />
<File FileName="Main2.cs" Line="21" Column="10" />
<File FileName="Car Body Facotry/CarBody.cs" Line="1" Column="1" />
</Files>
<Pads>
<Pad Id="ProjectPad">
<State name="__root__">
<Node name="AutoFacotrySingleton" expanded="True">
<Node name="AutoFacotrySingleton" expanded="True">
<Node name="Car" expanded="True" />
<Node name="Car Body Facotry" expanded="True" />
<Node name="Chassis Factory" expanded="True" />
<Node name="Engine Factory" expanded="True" />
<Node name="Factory" expanded="True" />
<Node name="Properties" expanded="True" />
<Node name="SingletonAlert" expanded="True" />
<Node name="Main2.cs" selected="True" />
</Node>
</Node>
</State>
</Pad>
</Pads>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.ItemProperties.AutoFacotrySingleton PreferredExecutionTarget="MonoDevelop.Default" />
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore />
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MultiItemStartupConfigurations />
</Properties>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Format":1,"ProjectReferences":[],"MetadataReferences":[{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/4.7.2-api/Microsoft.CSharp.dll","Aliases":[],"Framework":null},{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/4.7.2-api/mscorlib.dll","Aliases":[],"Framework":null},{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/4.7.2-api/System.Core.dll","Aliases":[],"Framework":null},{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/4.7.2-api/System.Data.DataSetExtensions.dll","Aliases":[],"Framework":null},{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/4.7.2-api/System.Data.dll","Aliases":[],"Framework":null},{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/4.7.2-api/System.dll","Aliases":[],"Framework":null},{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/4.7.2-api/System.Net.Http.dll","Aliases":[],"Framework":null},{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/4.7.2-api/System.Xml.dll","Aliases":[],"Framework":null},{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/4.7.2-api/System.Xml.Linq.dll","Aliases":[],"Framework":null}],"Files":["/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Car Body Facotry/CarBody.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Car Body Facotry/ModellSCarBody.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Car Body Facotry/ModelYCarBody.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Car/ConcreteCar.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Chassis Factory/Chassis.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Chassis Factory/ModelSChassis.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Chassis Factory/ModelYChassis.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Engine Factory/Engine.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Engine Factory/ModelSEngine.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Engine Factory/ModelYEngine.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Factory/ModelSFacotry.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Factory/ModelYFactory.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Properties/AssemblyInfo.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Factory/IFacotry.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Car/Program.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Chassis Factory/RoadsterChassis.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Engine Factory/RoadsterEngine.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Factory/RoadsterFactroy.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Car Body Facotry/RoadsterCarBody.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/SingletonAlert/SingletonAlert.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/Main2.cs","/Users/Dani/Desktop/3.Felev/SztHomeWork/myownrepo/AutoFacotrySingleton/App.config"],"BuildActions":["Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","None"],"Analyzers":[],"AdditionalFiles":[],"EditorConfigFiles":[]}
Empty file.
Binary file not shown.
14 changes: 12 additions & 2 deletions AutoFacotrySingleton/AutoFacotrySingleton.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -53,14 +53,24 @@
<Compile Include="Engine Factory\Engine.cs" />
<Compile Include="Engine Factory\ModelSEngine.cs" />
<Compile Include="Engine Factory\ModelYEngine.cs" />
<Compile Include="Factory\Factory.cs" />
<Compile Include="Factory\ModelSFacotry.cs" />
<Compile Include="Factory\ModelYFactory.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Factory\IFacotry.cs" />
<Compile Include="Car\Program.cs" />
<Compile Include="Chassis Factory\RoadsterChassis.cs" />
<Compile Include="Engine Factory\RoadsterEngine.cs" />
<Compile Include="Factory\RoadsterFactroy.cs" />
<Compile Include="Car Body Facotry\RoadsterCarBody.cs" />
<Compile Include="SingletonAlert\SingletonAlert.cs" />
<Compile Include="Main2.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="SingletonAlert\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
17 changes: 17 additions & 0 deletions AutoFacotrySingleton/AutoFacotrySingleton.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoFacotrySingleton", "AutoFacotrySingleton.csproj", "{5E29C091-67A6-44C5-842F-CFC5A7BA18DE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5E29C091-67A6-44C5-842F-CFC5A7BA18DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E29C091-67A6-44C5-842F-CFC5A7BA18DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E29C091-67A6-44C5-842F-CFC5A7BA18DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E29C091-67A6-44C5-842F-CFC5A7BA18DE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
4 changes: 3 additions & 1 deletion AutoFacotrySingleton/Car Body Facotry/CarBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace AutoFacotrySingleton.Car_Body_Facotry
{
public abstract class CarBody
{

public abstract void CreateHood();
public abstract void CreateFenders();
public abstract void CreateSunRoof();
}
}
16 changes: 13 additions & 3 deletions AutoFacotrySingleton/Car Body Facotry/ModelYCarBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,19 @@ namespace AutoFacotrySingleton.Car_Body_Facotry
{
public class ModelYCarBody:CarBody
{
public ModelYCarBody()
{

public override void CreateFenders()
{
Console.WriteLine("Created Model-Y Fenders");
}

public override void CreateHood()
{
Console.WriteLine("Created Model-Y Hood");
}

public override void CreateSunRoof()
{
Console.WriteLine("Created Model-Y Sunroof");
}
}
}
17 changes: 14 additions & 3 deletions AutoFacotrySingleton/Car Body Facotry/ModellSCarBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,20 @@ namespace AutoFacotrySingleton.Car_Body_Facotry
{
public class ModellSCarBody:CarBody
{
public ModellSCarBody()
{


public override void CreateHood()
{
Console.WriteLine("Created Model-S Hood");
}

public override void CreateFenders()
{
Console.WriteLine("Created Model-S Fenders");
}

public override void CreateSunRoof()
{
Console.WriteLine("Created Model-S Sunroof");
}
}
}
23 changes: 23 additions & 0 deletions AutoFacotrySingleton/Car Body Facotry/RoadsterCarBody.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using AutoFacotrySingleton.Car_Body_Facotry;

namespace AutoFacotrySingleton.Car_Body_Facotry
{
public class RoadsterCarBody : CarBody
{
public override void CreateFenders()
{
Console.WriteLine("Created Roadster Fenders");
}

public override void CreateHood()
{
Console.WriteLine("Crated Roadster Hood");
}

public override void CreateSunRoof()
{
Console.WriteLine("Created Roadster Sunroof");
}
}
}
78 changes: 77 additions & 1 deletion AutoFacotrySingleton/Car/ConcreteCar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,86 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoFacotrySingleton.Car_Body_Facotry;
using AutoFacotrySingleton.Engine_Factory;
using AutoFacotrySingleton.Chassis_Factory;
using AutoFacotrySingleton.Factory;
using AutoFacotrySingleton.SingletonAlert;

namespace AutoFacotrySingleton.Car
{
class ConcreteCar
public class ConcreteCar
{
public CarBody carb;
public Chassis chas;
public Engine engi;
public IFacotry factory;
public List<ConcreteCar> cars = new List<ConcreteCar>();

public ConcreteCar(CarBody carb, Chassis chas,Engine engi)
{
this.carb = carb;
this.chas = chas;
this.engi = engi;
}

public ConcreteCar()
{

}

public void SetFactory(IFacotry fy)
{
factory = fy;
}

public void InitCarElements()
{
chas = factory.CreateChassis();
carb = factory.CreateCarBody();
engi = factory.CreateEngine();
AssembleCars(carb, chas, engi);
}

public void AssembleCars(CarBody c, Chassis ch,Engine e)
{

cars.Add(new ConcreteCar(c, ch, e));
}

public void ShowAssemblingCarParts()
{
carb.CreateFenders();
carb.CreateHood();
carb.CreateSunRoof();
chas.CreatingNeedleBeam();
chas.CreatingRockingArm();
chas.CreatingShockAbsorber();
engi.CreateAirFiller();
engi.CreateGenerator();
engi.CreateOilFiller();
}
public List<ConcreteCar> concreteCars()
{
return cars;
}
public void Diagnostic(CarBody body,Chassis chassis, Engine engine)
{
Console.WriteLine($"Run diagnostic...{body}");
Console.WriteLine($"Run diagnostic...{chassis}");
Console.WriteLine($"Run diagnostic...{engine}");
try
{
if (50>new Random().Next(1,100))
{
throw new Exception("Malfunction");
}
}
catch (Exception ex)
{
SingletonAlert.SingletonAlert.Instance.alert(ex);
}
}

}
}
19 changes: 19 additions & 0 deletions AutoFacotrySingleton/Car/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using AutoFacotrySingleton.Factory;

namespace AutoFacotrySingleton.Car
{
public class Program
{
public static void Main(string[] args)
{
ConcreteCar car = new ConcreteCar();
IFacotry factory;
factory = new ModelSFacotry();
car.SetFactory(factory);
car.InitCarElements();
car.concreteCars();
}
}
}
4 changes: 3 additions & 1 deletion AutoFacotrySingleton/Chassis Factory/Chassis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace AutoFacotrySingleton.Chassis_Factory
{
public abstract class Chassis
{

public abstract void CreatingRockingArm();
public abstract void CreatingNeedleBeam();
public abstract void CreatingShockAbsorber();
}
}
18 changes: 14 additions & 4 deletions AutoFacotrySingleton/Chassis Factory/ModelSChassis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@

namespace AutoFacotrySingleton.Chassis_Factory
{
public class ModelSChassis:Chassis
public class ModelSChassis : Chassis
{
public ModelSChassis()
{

public override void CreatingNeedleBeam()
{
Console.WriteLine("Created Model-S Needle-Beam");
}

public override void CreatingRockingArm()
{
Console.WriteLine("Created Model-S Rocking-Arm");
}

public override void CreatingShockAbsorber()
{
Console.WriteLine("Create Model-S Shock absorber");
}
}
}
17 changes: 13 additions & 4 deletions AutoFacotrySingleton/Chassis Factory/ModelYChassis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ namespace AutoFacotrySingleton.Chassis_Factory
{
public class ModelYChassis:Chassis
{
public ModelYChassis()
{

public override void CreatingNeedleBeam()
{
Console.WriteLine("Created Model-Y Needle-Beam");
}

public override void CreatingRockingArm()
{
Console.WriteLine("Created Model-Y Rocking-Arm");
}

public override void CreatingShockAbsorber()
{
Console.WriteLine("Created Model-Y Shock absorber");
}

}
}
25 changes: 25 additions & 0 deletions AutoFacotrySingleton/Chassis Factory/RoadsterChassis.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using AutoFacotrySingleton.Car_Body_Facotry;
using AutoFacotrySingleton.Chassis_Factory;
using AutoFacotrySingleton.Engine_Factory;

namespace AutoFacotrySingleton.Chassis_Factory
{
public class RoadsterChassis:Chassis
{
public override void CreatingNeedleBeam()
{
Console.WriteLine("Created Roadster Needle-beam");
}

public override void CreatingRockingArm()
{
Console.WriteLine("Created Roadster Rocking-arm");
}

public override void CreatingShockAbsorber()
{
Console.WriteLine("Created Roadster Absorber");
}
}
}
4 changes: 3 additions & 1 deletion AutoFacotrySingleton/Engine Factory/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace AutoFacotrySingleton.Engine_Factory
{
public abstract class Engine
{

public abstract void CreateOilFiller();
public abstract void CreateAirFiller();
public abstract void CreateGenerator();
}
}
Loading