This commit is contained in:
2025-07-20 13:10:52 +02:00
parent f3d8163708
commit b43e595ea4
21 changed files with 202 additions and 107 deletions
Binary file not shown.
@@ -0,0 +1,74 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\Henrik Rentz\\source\\repos\\S71200---C--WPF-Programm\\C# WPF Test Siemens\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{E776B153-011B-4159-8D83-0EB61B7E9488}|C# WPF Test Siemens.csproj|c:\\users\\henrik rentz\\source\\repos\\s71200---c--wpf-programm\\c# wpf test siemens\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{E776B153-011B-4159-8D83-0EB61B7E9488}|C# WPF Test Siemens.csproj|solutionrelative:mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{E776B153-011B-4159-8D83-0EB61B7E9488}|C# WPF Test Siemens.csproj|c:\\users\\henrik rentz\\source\\repos\\s71200---c--wpf-programm\\c# wpf test siemens\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{E776B153-011B-4159-8D83-0EB61B7E9488}|C# WPF Test Siemens.csproj|solutionrelative:mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{E776B153-011B-4159-8D83-0EB61B7E9488}|C# WPF Test Siemens.csproj|c:\\users\\henrik rentz\\source\\repos\\s71200---c--wpf-programm\\c# wpf test siemens\\properties\\assemblyinfo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{E776B153-011B-4159-8D83-0EB61B7E9488}|C# WPF Test Siemens.csproj|solutionrelative:properties\\assemblyinfo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 3,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "MainWindow.xaml.cs",
"DocumentMoniker": "C:\\Users\\Henrik Rentz\\source\\repos\\S71200---C--WPF-Programm\\C# WPF Test Siemens\\MainWindow.xaml.cs",
"RelativeDocumentMoniker": "MainWindow.xaml.cs",
"ToolTip": "C:\\Users\\Henrik Rentz\\source\\repos\\S71200---C--WPF-Programm\\C# WPF Test Siemens\\MainWindow.xaml.cs",
"RelativeToolTip": "MainWindow.xaml.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABgAAAAfAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-07-20T11:02:37.336Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "AssemblyInfo.cs",
"DocumentMoniker": "C:\\Users\\Henrik Rentz\\source\\repos\\S71200---C--WPF-Programm\\C# WPF Test Siemens\\Properties\\AssemblyInfo.cs",
"RelativeDocumentMoniker": "Properties\\AssemblyInfo.cs",
"ToolTip": "C:\\Users\\Henrik Rentz\\source\\repos\\S71200---C--WPF-Programm\\C# WPF Test Siemens\\Properties\\AssemblyInfo.cs",
"RelativeToolTip": "Properties\\AssemblyInfo.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-07-20T11:02:23.55Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "MainWindow.xaml",
"DocumentMoniker": "C:\\Users\\Henrik Rentz\\source\\repos\\S71200---C--WPF-Programm\\C# WPF Test Siemens\\MainWindow.xaml",
"RelativeDocumentMoniker": "MainWindow.xaml",
"ToolTip": "C:\\Users\\Henrik Rentz\\source\\repos\\S71200---C--WPF-Programm\\C# WPF Test Siemens\\MainWindow.xaml*",
"RelativeToolTip": "MainWindow.xaml*",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2025-07-20T10:58:39.057Z",
"EditorCaption": ""
}
]
}
]
}
]
}
@@ -0,0 +1,27 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\Henrik Rentz\\source\\repos\\S71200---C--WPF-Programm\\C# WPF Test Siemens\\",
"Documents": [],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": -1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
}
]
}
]
}
]
}
@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36310.24 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C# WPF Test Siemens", "C# WPF Test Siemens.csproj", "{E776B153-011B-4159-8D83-0EB61B7E9488}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E776B153-011B-4159-8D83-0EB61B7E9488}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E776B153-011B-4159-8D83-0EB61B7E9488}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E776B153-011B-4159-8D83-0EB61B7E9488}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E776B153-011B-4159-8D83-0EB61B7E9488}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AC0DBE89-1266-42D7-A1AA-DC1A1FF4A42E}
EndGlobalSection
EndGlobal
+10 -43
View File
@@ -1,47 +1,14 @@
<Window x:Class="ZeiterfassungMerz.MainWindow"
<Window x:Class="SiemensWriteApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Zeiterfassung MERZ" Height="600" Width="800"
Background="#1A1A2E" FontFamily="Segoe UI" Foreground="White">
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Logo und Maschinennummer -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Image Source="merz_logo.png" Width="80" Height="80" Margin="0,0,20,0"/>
<StackPanel Orientation="Vertical">
<TextBlock Text="Maschinennummer:" FontSize="14" Margin="0,10,0,0"/>
<TextBox x:Name="MaschinenNummerBox" Width="200" Height="25" Margin="0,5,0,0"/>
</StackPanel>
</StackPanel>
<!-- Start Button -->
<Button Grid.Row="1" Content="Start" Width="120" Height="35" Margin="0,10,0,10"
HorizontalAlignment="Left" Background="#3A3A5D" BorderThickness="0"
Cursor="Hand"/>
<!-- Logs -->
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto" Margin="0,10,0,10">
<TextBlock x:Name="LogTextBlock" TextWrapping="Wrap" FontSize="13" FontFamily="Consolas"/>
</ScrollViewer>
<!-- Untere Buttons -->
<StackPanel Grid.Row="3" Orientation="Vertical" HorizontalAlignment="Center" Margin="0,20,0,0" >
<Button Content="Stop mit Kommentar" Width="180" Height="35" Margin="5" Background="#3A3A5D" BorderThickness="0" Cursor="Hand"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Content="Exportieren als TXT" Width="160" Height="30" Margin="5" Background="#3A3A5D" BorderThickness="0" Cursor="Hand"/>
<Button Content="Exportieren als Excel" Width="160" Height="30" Margin="5" Background="#3A3A5D" BorderThickness="0" Cursor="Hand"/>
</StackPanel>
<Button Content="🌐 Theme wechseln" Width="180" Height="30" Margin="5" Background="#3A3A5D" BorderThickness="0" Cursor="Hand"/>
<Button Content="Zurücksetzen" Width="180" Height="30" Margin="5" Background="#3A3A5D" BorderThickness="0" Cursor="Hand"/>
</StackPanel>
Title="SPS Datenaustausch" Height="200" Width="300">
<Grid>
<Button
Content="Start"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="100"
Click="StartButton_Click"
/>
</Grid>
</Window>
+33 -3
View File
@@ -12,17 +12,47 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using S7.Net;
namespace C__WPF_Test_Siemens
{
/// <summary>
/// Interaktionslogik für MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private Plc _plc;
public MainWindow()
{
InitializeComponent();
// Verbindung zur SPS aufbauen
_plc = new Plc(CpuType.S71500, "192.168.0.1", 0, 1); // IP, Rack, Slot
}
private void StartButton_Click(object sender, RoutedEventArgs e)
{
try
{
_plc.Open();
if (_plc.IsConnected)
{
// Beispiel: schreibe die Ganzzahl 1 in Datenbaustein 1, DBW 0
_plc.Write("DB1.DBW0", (short)1);
MessageBox.Show("Wert wurde erfolgreich geschrieben!", "Erfolg", MessageBoxButton.OK, MessageBoxImage.Information);
}
else
{
MessageBox.Show("Verbindung fehlgeschlagen!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
catch (Exception ex)
{
MessageBox.Show("Fehler: " + ex.Message);
}
finally
{
_plc.Close();
}
}
}
}
@@ -0,0 +1 @@
d3259becb9e6880a444993b93c1e277a5010376a643b538f382c3934a6616f03
@@ -0,0 +1,9 @@
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Debug\C# WPF Test Siemens.csproj.AssemblyReference.cache
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Debug\MainWindow.baml
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Debug\MainWindow.g.cs
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Debug\App.g.cs
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Debug\C# WPF Test Siemens_MarkupCompile.cache
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Debug\C# WPF Test Siemens.g.resources
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Debug\C__WPF_Test_Siemens.Properties.Resources.resources
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Debug\C# WPF Test Siemens.csproj.GenerateResource.cache
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Debug\C# WPF Test Siemens.csproj.CoreCompileInputs.cache
@@ -4,12 +4,12 @@
winexe
C#
.cs
C:\Users\Henrik Rentz\Source\Repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Debug\
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Debug\
C__WPF_Test_Siemens
none
false
DEBUG;TRACE
C:\Users\Henrik Rentz\Source\Repos\S71200---C--WPF-Programm\C# WPF Test Siemens\App.xaml
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\App.xaml
1219584333
51579654133
@@ -16,5 +16,5 @@ C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\
13-1310406943
MainWindow.xaml;
True
False
@@ -1,4 +0,0 @@
FC:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\MainWindow.xaml;;
Binary file not shown.
+2 -27
View File
@@ -1,4 +1,4 @@
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "2EEFF56C8447EA430AC5DAC22CDB7C4AB7EF44FEDCBA12F7DAA76A9992514122"
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "E87D47DFCF83732DEB93EF6221ACB98FF9B283F84E1464CB308F47C4E8DB883C"
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
@@ -31,7 +31,7 @@ using System.Windows.Shapes;
using System.Windows.Shell;
namespace ZeiterfassungMerz {
namespace SiemensWriteApp {
/// <summary>
@@ -39,22 +39,6 @@ namespace ZeiterfassungMerz {
/// </summary>
public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
#line 20 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox MaschinenNummerBox;
#line default
#line hidden
#line 31 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBlock LogTextBlock;
#line default
#line hidden
private bool _contentLoaded;
/// <summary>
@@ -83,15 +67,6 @@ namespace ZeiterfassungMerz {
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.MaschinenNummerBox = ((System.Windows.Controls.TextBox)(target));
return;
case 2:
this.LogTextBlock = ((System.Windows.Controls.TextBlock)(target));
return;
}
this._contentLoaded = true;
}
}
+16 -25
View File
@@ -1,5 +1,4 @@
// Updated by XamlIntelliSenseFileGenerator 20.07.2025 12:42:06
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "EDCECE4CE2254483B762E17F8996BF041536CA0DCD8A33B94B78229A7AA695F8"
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "E87D47DFCF83732DEB93EF6221ACB98FF9B283F84E1464CB308F47C4E8DB883C"
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
@@ -10,7 +9,6 @@
// </auto-generated>
//------------------------------------------------------------------------------
using C__WPF_Test_Siemens;
using System;
using System.Diagnostics;
using System.Windows;
@@ -33,51 +31,44 @@ using System.Windows.Shapes;
using System.Windows.Shell;
namespace ZeiterfassungMerz
{
namespace SiemensWriteApp {
/// <summary>
/// MainWindow
/// </summary>
public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector
{
public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
private bool _contentLoaded;
/// <summary>
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent()
{
if (_contentLoaded)
{
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/C# WPF Test Siemens;component/mainwindow.xaml", System.UriKind.Relative);
#line 1 "..\..\MainWindow.xaml"
#line 1 "..\..\MainWindow.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
#line default
#line hidden
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
{
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
this._contentLoaded = true;
}
internal System.Windows.Controls.TextBox MaschinenNummerBox;
internal System.Windows.Controls.TextBlock LogTextBlock;
}
}
@@ -4,12 +4,12 @@
winexe
C#
.cs
C:\Users\Henrik Rentz\Source\Repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Release\
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\obj\Release\
C__WPF_Test_Siemens
none
false
TRACE
C:\Users\Henrik Rentz\Source\Repos\S71200---C--WPF-Programm\C# WPF Test Siemens\App.xaml
C:\Users\Henrik Rentz\source\repos\S71200---C--WPF-Programm\C# WPF Test Siemens\App.xaml
1219584333
51579654133