C# Prog
This commit is contained in:
parent
38456527d9
commit
d4fd23bab2
20
Matomat.sln
Normal file
20
Matomat.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Matomat", "Matomat\Matomat.csproj", "{A8987ACE-466A-4F03-865E-B2E2494360D7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A8987ACE-466A-4F03-865E-B2E2494360D7}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{A8987ACE-466A-4F03-865E-B2E2494360D7}.Debug|x86.Build.0 = Debug|x86
|
||||
{A8987ACE-466A-4F03-865E-B2E2494360D7}.Release|x86.ActiveCfg = Release|x86
|
||||
{A8987ACE-466A-4F03-865E-B2E2494360D7}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
24
Matomat/Automat.cs
Normal file
24
Matomat/Automat.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Matomat
|
||||
{
|
||||
class Automat
|
||||
{
|
||||
private User user;
|
||||
internal void doJob(int userId, long codeId)
|
||||
{
|
||||
user = findUser(userId);
|
||||
if (!user.vaild())
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
private User findUser(int userId)
|
||||
{
|
||||
return new User(userId);
|
||||
}
|
||||
}
|
||||
}
|
15
Matomat/BarcodeReader.cs
Normal file
15
Matomat/BarcodeReader.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Matomat
|
||||
{
|
||||
class BarcodeReader
|
||||
{
|
||||
internal long getCodeID()
|
||||
{
|
||||
return 1234567890123;
|
||||
}
|
||||
}
|
||||
}
|
20
Matomat/LCDDisplay.cs
Normal file
20
Matomat/LCDDisplay.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Matomat
|
||||
{
|
||||
class LCDDisplay
|
||||
{
|
||||
internal static void print(string text)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
internal static void print(string text, int time)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
63
Matomat/Matomat.csproj
Normal file
63
Matomat/Matomat.csproj
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{A8987ACE-466A-4F03-865E-B2E2494360D7}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Matomat</RootNamespace>
|
||||
<AssemblyName>Matomat</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Automat.cs" />
|
||||
<Compile Include="BarcodeReader.cs" />
|
||||
<Compile Include="LCDDisplay.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RFIDReader.cs" />
|
||||
<Compile Include="User.cs" />
|
||||
<Compile Include="Worker.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
27
Matomat/Program.cs
Normal file
27
Matomat/Program.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace Matomat
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Worker workerObject = new Worker();
|
||||
Thread workerThread = new Thread(workerObject.DoWork);
|
||||
|
||||
workerThread.Start();
|
||||
|
||||
while (!workerThread.IsAlive) ;
|
||||
|
||||
while (workerThread.ThreadState == ThreadState.Running)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
Console.WriteLine("main thread: Worker thread has terminated.");
|
||||
}
|
||||
}
|
||||
}
|
36
Matomat/Properties/AssemblyInfo.cs
Normal file
36
Matomat/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die mit einer Assembly verknüpft sind.
|
||||
[assembly: AssemblyTitle("Matomat")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Matomat")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
|
||||
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("64099dca-753a-49a9-9d66-aee9575ad258")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
15
Matomat/RFIDReader.cs
Normal file
15
Matomat/RFIDReader.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Matomat
|
||||
{
|
||||
class RFIDReader
|
||||
{
|
||||
internal int getCardID()
|
||||
{
|
||||
return 0x1234;
|
||||
}
|
||||
}
|
||||
}
|
36
Matomat/User.cs
Normal file
36
Matomat/User.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Matomat
|
||||
{
|
||||
class User
|
||||
{
|
||||
private int userId;
|
||||
private bool found;
|
||||
|
||||
public User(int userId)
|
||||
{
|
||||
// TODO: Complete member initialization
|
||||
this.userId = userId;
|
||||
load();
|
||||
}
|
||||
|
||||
private void load()
|
||||
{
|
||||
if (true)
|
||||
this.found = false;
|
||||
}
|
||||
|
||||
internal bool vaild()
|
||||
{
|
||||
if (!found)
|
||||
{
|
||||
LCDDisplay.print("User wurde nich gefunden",5);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
39
Matomat/Worker.cs
Normal file
39
Matomat/Worker.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Matomat
|
||||
{
|
||||
class Worker
|
||||
{
|
||||
private volatile bool _shouldStop;
|
||||
private RFIDReader rfid;
|
||||
private BarcodeReader barcode;
|
||||
private Automat automat;
|
||||
public Worker()
|
||||
{
|
||||
rfid = new RFIDReader();
|
||||
barcode = new BarcodeReader();
|
||||
automat = new Automat();
|
||||
}
|
||||
public void DoWork()
|
||||
{
|
||||
while (!_shouldStop)
|
||||
{
|
||||
LCDDisplay.print("Bitte Sudierendenausweis über den RFID Leser halten.");
|
||||
int userId = rfid.getCardID();
|
||||
LCDDisplay.print("Bitte Produkt / Code über den Barcodeleser halten.");
|
||||
long codeId = barcode.getCodeID();
|
||||
automat.doJob(userId, codeId);
|
||||
|
||||
}
|
||||
Console.WriteLine("worker thread: terminating gracefully.");
|
||||
}
|
||||
public void RequestStop()
|
||||
{
|
||||
_shouldStop = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user