Neuerstellung

This commit is contained in:
maier_S
2021-12-10 12:53:51 +01:00
parent c764d8e8be
commit ae442b53eb
9 changed files with 258 additions and 0 deletions

View File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31321.278
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FSI.SIE.Starter.Csv.Exporter", "FSI.SIE.Starter.Csv.Exporter\FSI.SIE.Starter.Csv.Exporter.csproj", "{87F11CF4-50B7-42D5-832F-64B7FFA7B37C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{87F11CF4-50B7-42D5-832F-64B7FFA7B37C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87F11CF4-50B7-42D5-832F-64B7FFA7B37C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87F11CF4-50B7-42D5-832F-64B7FFA7B37C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87F11CF4-50B7-42D5-832F-64B7FFA7B37C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E4DC042D-285D-4EA6-A2A4-DF8C5AA0CF2F}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,9 @@
<Application x:Class="FSI.SIE.Starter.Csv.Exporter.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FSI.SIE.Starter.Csv.Exporter"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace FSI.SIE.Starter.Csv.Exporter
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<ItemGroup>
<None Remove="Icons\FondiumU.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\FondiumU.ico" />
</ItemGroup>
<ItemGroup>
<None Update="Convert_SINAMICS_trace_CSV.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -0,0 +1,50 @@
<Window x:Class="FSI.SIE.Starter.Csv.Exporter.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FSI.SIE.Starter.Csv.Exporter"
mc:Ignorable="d"
Title="FSI Siemens Starter Trace Csv-Exporter"
SizeToContent="WidthAndHeight"
Height="Auto"
Width="Auto"
Icon="Icons/FondiumU.ico">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel
Orientation="Horizontal">
<TextBlock Text="Datei:"
Margin="5 5 5 5" />
<TextBox x:Name="tbSrcFile"
Width="600"
Margin="5 5 5 5"
AllowDrop="True"
TextChanged="TbSrcFile_TextChanged"
PreviewDragEnter="TbSrcFile_PreviewDragEnter"
PreviewDragOver="TbSrcFile_PreviewDragOver"
Drop="TbSrcFile_Drop"/>
<Button x:Name="btnSlctSrcFile"
Content="..."
Width="30"
Margin="5 5 5 5"
Click="BtnSlctSrcFile_Click" />
</StackPanel>
<StackPanel Grid.Row="1">
<Button x:Name="btnStart"
Content="Start"
Margin="5 5 5 5"
IsEnabled="False"
Click="BtnStart_Click" />
</StackPanel>
</Grid>
</Window>

View File

@@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using System.Collections.Specialized;
namespace FSI.SIE.Starter.Csv.Exporter
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void BtnSlctSrcFile_Click(object sender, RoutedEventArgs e)
{
using OpenFileDialog dlg = new()
{
Filter = "Trace (*.trc)|*.trc|alle Dateien (*:*)|*.*"
};
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
tbSrcFile.Text = dlg.FileName;
}
}
private void BtnStart_Click(object sender, RoutedEventArgs e)
{
string[] tbEntries = tbSrcFile.Text.Split("\n");
foreach (string tbEntry in tbEntries)
{
if (!string.IsNullOrEmpty(tbEntry))
{
Process p = new Process();
p.StartInfo.FileName = Directory.GetCurrentDirectory() + "\\" + "Convert_SINAMICS_trace_CSV.exe";
p.StartInfo.Arguments = "\"" + tbEntry + "\"";
p.Start();
p.WaitForExit();
}
}
tbSrcFile.Text = string.Empty;
}
private void TbSrcFile_PreviewDragEnter(object sender, System.Windows.DragEventArgs e)
{
if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop))
{
e.Effects = System.Windows.DragDropEffects.Copy;
}
else
{
e.Effects = System.Windows.DragDropEffects.None;
}
}
private void TbSrcFile_PreviewDragOver(object sender, System.Windows.DragEventArgs e)
{
e.Handled = true;
}
private void TbSrcFile_Drop(object sender, System.Windows.DragEventArgs e)
{
// Get data object
var dataObject = e.Data as System.Windows.DataObject;
// Check for file list
if (dataObject.ContainsFileDropList())
{
// Clear values
tbSrcFile.Text = string.Empty;
// Process file names
StringCollection fileNames = dataObject.GetFileDropList();
StringBuilder bd = new();
foreach (string fileName in fileNames)
{
if (fileName.EndsWith(".trc"))
{
bd.Append(fileName + "\n");
}
}
// Set text
tbSrcFile.Text = bd.ToString();
}
}
private void TbSrcFile_TextChanged(object sender, TextChangedEventArgs e)
{
if (!string.IsNullOrEmpty(tbSrcFile.Text))
{
btnStart.IsEnabled = true;
}
else
{
btnStart.IsEnabled = false;
}
}
}
}