Squashed 'FSI.Lib/' content from commit dceb500
git-subtree-dir: FSI.Lib git-subtree-split: dceb5008a2176c2b8ab5e55a73b1c25d31a7f841
This commit is contained in:
Binary file not shown.
54
FSI.Lib/Guis/SieStarterCsvExporter/FrmMain.xaml
Normal file
54
FSI.Lib/Guis/SieStarterCsvExporter/FrmMain.xaml
Normal file
@@ -0,0 +1,54 @@
|
||||
<Window x:Class="FSI.Lib.Guis.SieStarterCsvExporter.FrmMain"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
Title="FSI Siemens Starter Trace Csv-Exporter"
|
||||
SizeToContent="WidthAndHeight"
|
||||
Height="Auto"
|
||||
Width="Auto"
|
||||
Icon="../../Icons/FondiumU.ico"
|
||||
WindowStyle="ToolWindow">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<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>
|
||||
|
||||
<StatusBar Grid.Row="2">
|
||||
<StatusBarItem HorizontalAlignment="Right">
|
||||
<TextBlock Text="{Binding CurrentTime}" />
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
116
FSI.Lib/Guis/SieStarterCsvExporter/FrmMain.xaml.cs
Normal file
116
FSI.Lib/Guis/SieStarterCsvExporter/FrmMain.xaml.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
using Microsoft.Win32;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace FSI.Lib.Guis.SieStarterCsvExporter
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für frmMain.xaml
|
||||
/// </summary>
|
||||
public partial class FrmMain : Window
|
||||
{
|
||||
public FrmMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new MVVM.ViewModel.CurrentTimeViewModel();
|
||||
}
|
||||
private void BtnSlctSrcFile_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog dlg = new()
|
||||
{
|
||||
Filter = "Trace (*.trc)|*.trc|alle Dateien (*:*)|*.*"
|
||||
};
|
||||
|
||||
if ((bool)dlg.ShowDialog())
|
||||
{
|
||||
tbSrcFile.Text = dlg.FileName;
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStart_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string[] tbEntries = tbSrcFile.Text.Split("\n");
|
||||
|
||||
string test = GetType().Namespace;
|
||||
|
||||
var test2 = Assembly.GetExecutingAssembly;
|
||||
|
||||
|
||||
foreach (string tbEntry in tbEntries)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tbEntry))
|
||||
{
|
||||
Process process= new Process();
|
||||
process.StartInfo.FileName = Directory.GetCurrentDirectory() + @"\Guis\SieStarterCsvExporter\" + "Convert_SINAMICS_trace_CSV.exe";
|
||||
process.StartInfo.Arguments = "\"" + tbEntry + "\"";
|
||||
|
||||
process.Start();
|
||||
process.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user