Design done

This commit is contained in:
2025-06-12 13:27:34 +02:00
parent 9b37754aad
commit ac49588b31
2 changed files with 142 additions and 578 deletions

View File

@@ -1,190 +1,151 @@
<Window <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" x:Class="MainWindow"
x:Name="MainWindow" x:Name="MainWindow"
x:Class="MainWindow" TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}" TextElement.FontWeight="Regular"
TextElement.FontWeight="Regular" TextElement.FontSize="13"
TextElement.FontSize="13" TextOptions.TextFormattingMode="Ideal"
TextOptions.TextFormattingMode="Ideal" TextOptions.TextRenderingMode="Auto"
TextOptions.TextRenderingMode="Auto" Background="{DynamicResource MaterialDesignPaper}"
Background="{DynamicResource MaterialDesignPaper}" FontFamily="{DynamicResource MaterialDesignFont}"
FontFamily="{DynamicResource MaterialDesignFont}" mc:Ignorable="d"
mc:Ignorable="d" Title="Dokumentáció készítő"
Title="Dokumentáció készítő" MinWidth="630"
Height="417" MinHeight="250"
Width="614" WindowStyle="None"
FontSize="13" ResizeMode="NoResize"
WindowStyle="None" SizeToContent="WidthAndHeight"
ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Height="283">
WindowStartupLocation="CenterScreen"
SizeToContent="WidthAndHeight"
MinHeight="370"
MaxHeight="370">
<!-- ******** THEME ******** -->
<Window.Resources> <Window.Resources>
<!-- Correct BundledTheme usage --> <materialDesign:BundledTheme BaseTheme="Light"
<materialDesign:BundledTheme PrimaryColor="Teal"
BaseTheme="Light" SecondaryColor="Teal" />
PrimaryColor="Teal"
SecondaryColor="Teal" />
</Window.Resources> </Window.Resources>
<Grid x:Name="MainGrid" HorizontalAlignment="Center" Height="360" VerticalAlignment="Top" Width="614"> <!-- ******** ROOT LAYOUT (DockPanel) ******** -->
<Grid.RowDefinitions> <DockPanel Margin="0,0,0,-18">
<RowDefinition Height="14*"/>
<RowDefinition Height="173*"/>
</Grid.RowDefinitions>
<Label Content="Dokumentáció készítő" Height="22" VerticalAlignment="Top" FontSize="14" MouseDown="Label_MouseDown" HorizontalAlignment="Left" Width="462"/> <!-- === TITLE BAR (VS Code-like) === -->
<Grid DockPanel.Dock="Top" Height="30"
Background="{DynamicResource PrimaryHueMidBrush}"
MouseDown="Label_MouseDown">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TabControl Style="{StaticResource MaterialDesignTabControl}" Margin="0,27,0,2" HorizontalAlignment="Left" Width="600" Grid.RowSpan="2"> <TextBlock Text="Dokumentáció készítő"
<TabControl.Background> VerticalAlignment="Center"
<ImageBrush/> Margin="10,0,0,0"
</TabControl.Background> Foreground="White"
FontWeight="SemiBold"/>
<TabItem Header="DOKSI készítő" FontSize="13" Width="140"> <!-- Window-control buttons -->
<Grid HorizontalAlignment="Left" Width="600" Margin="0,0,0,-6" Height="325" VerticalAlignment="Top"> <StackPanel Grid.Column="1" Orientation="Horizontal">
<Button x:Name="CreateDocument" Content="Dokumentáció készítése" HorizontalAlignment="Left" Margin="434,222,0,0" VerticalAlignment="Top" Width="156" RenderTransformOrigin="0.785,1.101"/> <Button x:Name="CloseButton"
<ListBox x:Name="ListBox1" Height="52" Margin="542,176,-396,0" VerticalAlignment="Top" Background="{x:Null}" BorderThickness="2" BorderBrush="#FFECE0E0"/> Click="ExitButton_Click"
<StackPanel Margin="10,10,0,0" HorizontalAlignment="Left" Width="180"> Style="{StaticResource MaterialDesignFlatButton}"
<GroupBox Header="Dokumentáció típusa" Padding="5"> FontFamily="Segoe MDL2 Assets"
<StackPanel> Content="&#xE8BB;"
<CheckBox x:Name="PDFCheckBox" Content="PDF"/> Width="45" Height="30"
<CheckBox x:Name="DXFCheckBox" Content="DXF"/> Foreground="DarkRed"/>
<CheckBox x:Name="XLSCheckbox" Content="XLS"/> </StackPanel>
<CheckBox x:Name="TIFFCheckbox" Content="TIFF"/> </Grid>
</StackPanel>
</GroupBox> <!-- === MAIN CONTENT AREA === -->
</StackPanel> <Grid x:Name="MainGrid"
<StackPanel Margin="0,10,215,243" HorizontalAlignment="Right" Width="180"> Margin="10" Height="261">
<GroupBox Header="Dokumentáció" Padding="5">
<StackPanel> <Grid Width="600" HorizontalAlignment="Center" Margin="0,0,0,-81">
<RadioButton x:Name="NamingSyntaxStefani" Content="Stefani"/>
<RadioButton x:Name="NamingSyntaxAudi" Content="Audi"/> <!-- Dokumentáció készítése gomb -->
</StackPanel> <Button x:Name="CreateDocument"
</GroupBox> Content="Dokumentáció készítése"
</StackPanel> HorizontalAlignment="Left"
<StackPanel Margin="10,126,0,71" HorizontalAlignment="Left" Width="250"> Margin="434,206,0,0"
<GroupBox Header="Egyéb" Padding="5"> VerticalAlignment="Top"
<StackPanel> Width="156" />
<CheckBox x:Name="AutomaticFolderSelect" Content="Automatikus mappa választás"/>
<CheckBox x:Name="PDFOsszeCheckBox" Content="PDF összefűzése"/> <!-- listbox placeholder -->
</StackPanel> <ListBox x:Name="ListBox1"
</GroupBox> Margin="265,126,10,0"
</StackPanel> Background="{x:Null}"
<GroupBox Header="Rajz használat módja" Margin="390,10,0,0" Width="200" HorizontalAlignment="Left" VerticalAlignment="Top" Padding="5"> BorderThickness="2"
BorderBrush="#FFECE0E0" Height="70" VerticalAlignment="Top"/>
<!-- BAL OLDALI CSOPORTOK -->
<StackPanel Margin="10,10,0,0" HorizontalAlignment="Left" Width="180">
<GroupBox Header="Dokumentáció típusa" Padding="5">
<StackPanel> <StackPanel>
<RadioButton x:Name="MaterialRadioButton3" Content="Aktív rajz használata"/> <CheckBox x:Name="PDFCheckBox" Content="PDF"/>
<RadioButton x:Name="KulonAloRajzok" Content="Különálló rajzok használata"/> <CheckBox x:Name="DXFCheckBox" Content="DXF"/>
<CheckBox x:Name="XLSCheckbox" Content="XLS"/>
<CheckBox x:Name="TIFFCheckbox" Content="TIFF"/>
</StackPanel> </StackPanel>
</GroupBox> </GroupBox>
<Button x:Name="Files_Browse" Content="Böngészés" HorizontalAlignment="Left" Margin="390,87,0,0" VerticalAlignment="Top" Width="200" RenderTransformOrigin="0.785,1.101" Height="30" FontSize="8"/> </StackPanel>
<Grid HorizontalAlignment="Left" Height="32" Margin="10,222,0,0" VerticalAlignment="Top" Width="419">
<Grid.ColumnDefinitions> <StackPanel Margin="0,10,215,252" HorizontalAlignment="Right" Width="190">
<ColumnDefinition Width="308*"/> <GroupBox Header="Dokumentáció " Padding="5" Height="73">
<ColumnDefinition Width="111*"/> <StackPanel>
</Grid.ColumnDefinitions> <RadioButton x:Name="NamingSyntaxStefani" Content="Robotizálunk"/>
<ProgressBar x:Name="Progressbar" HorizontalAlignment="Left" Height="32" VerticalAlignment="Center" Width="419" Grid.ColumnSpan="2" /> <RadioButton x:Name="NamingSyntaxAudi" Content="Audi"/>
<Label x:Name="ProgressText" Content="" HorizontalAlignment="Left" VerticalAlignment="Center" Height="22" Margin="206,0,0,0"/> </StackPanel>
</Grid> </GroupBox>
<CheckBox x:Name="DWGCheckBox" HorizontalAlignment="Left" Margin="109,55,0,0" VerticalAlignment="Top" Content="DWG" RenderTransformOrigin="0.763,0.741"/> </StackPanel>
<StackPanel Margin="10,126,0,71" HorizontalAlignment="Left" Width="250">
<GroupBox Header="Egyéb" Padding="5">
<StackPanel>
<CheckBox x:Name="AutomaticFolderSelect" Content="Automatikus mappa választás"/>
<CheckBox x:Name="PDFOsszeCheckBox" Content="PDF összefűzése"/>
</StackPanel>
</GroupBox>
</StackPanel>
<!-- Rajz használat módja -->
<GroupBox Header="Rajz használat módja"
Margin="390,10,0,235" Width="200" HorizontalAlignment="Left" Padding="5">
<StackPanel>
<RadioButton x:Name="MaterialRadioButton3" Content="Aktív rajz használata"/>
<RadioButton x:Name="KulonAloRajzok" Content="Különálló rajzok használata"/>
</StackPanel>
</GroupBox>
<!-- Böngészés gomb -->
<Button x:Name="Files_Browse"
Content="Böngészés"
HorizontalAlignment="Left"
Margin="390,87,0,0"
VerticalAlignment="Top"
Width="200" Height="30"
FontSize="10"/>
<!-- Progress bar -->
<Grid HorizontalAlignment="Left" Height="32" Margin="8,206,0,0" VerticalAlignment="Top" Width="420">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="241*"/>
<ColumnDefinition Width="68*"/>
<ColumnDefinition Width="111"/>
</Grid.ColumnDefinitions>
<ProgressBar x:Name="Progressbar" Height="32" Width="419" Grid.ColumnSpan="3" Margin="0,0,1,0"/>
<Label x:Name="ProgressText" Height="22" Margin="50,0,72,0"
VerticalAlignment="Center" Grid.ColumnSpan="3"/>
</Grid> </Grid>
</TabItem>
<TabItem Header="Egyéb" IsEnabled="False"> <!-- DWG jelölő négyzet -->
<Grid> <CheckBox x:Name="DWGCheckBox" Content="DWG"
<TabControl HorizontalAlignment="Right" Width="500" Height="297" VerticalAlignment="Top" Background="{x:Null}" IsEnabled="False"> HorizontalAlignment="Left"
<TabItem Header="Drw osztó"> Margin="100,56,0,0"
<TabItem.RenderTransform> VerticalAlignment="Top"/>
<TransformGroup> </Grid>
<ScaleTransform/> </Grid>
<SkewTransform AngleY="-0.415"/> </DockPanel>
<RotateTransform/>
<TranslateTransform Y="0.326"/>
</TransformGroup>
</TabItem.RenderTransform>
<Grid Margin="0,0,0,-1">
<Grid.RowDefinitions>
<RowDefinition Height="33*"/>
<RowDefinition Height="8*"/>
</Grid.RowDefinitions>
<Button x:Name="drwSplitButton" Content="Split" HorizontalAlignment="Left" Margin="10,54,0,0" VerticalAlignment="Top" Width="91" RenderTransformOrigin="0.785,1.101"/>
<CheckBox x:Name="AktualisRajzRadioButton" HorizontalAlignment="Left" Margin="10,91,0,0" VerticalAlignment="Top" Content="Aktuális rajz mentése" Width="156"/>
<Button x:Name="test" Content="Split" HorizontalAlignment="Left" Margin="393,54,0,0" VerticalAlignment="Top" Width="91" RenderTransformOrigin="0.785,1.101"/>
<CheckBox x:Name="RajzCsereRadioButton" HorizontalAlignment="Left" Margin="328,91,0,0" VerticalAlignment="Top" Content="Rajz csere" Width="156"/>
</Grid>
</TabItem>
<TabItem Header="Purge">
<Grid>
<CheckBox x:Name="PRTCheckBox" HorizontalAlignment="Left" Margin="10,104,0,0" VerticalAlignment="Top" Content="PRT" RenderTransformOrigin="-0.023,5.167"/>
<CheckBox x:Name="ASMCheckBox" HorizontalAlignment="Left" Margin="114,104,0,0" VerticalAlignment="Top" Content="ASM"/>
<CheckBox x:Name="DRWCheckBox" HorizontalAlignment="Left" Margin="58,104,0,0" VerticalAlignment="Top" Content="DRW"/>
<Button x:Name="FixNamesButton" Content="Fix names" HorizontalAlignment="Left" Margin="124,67,0,0" VerticalAlignment="Top" Width="94" RenderTransformOrigin="0.785,1.101"/>
<Button x:Name="PurgeBongeszesButton" Content="Böngészés" HorizontalAlignment="Left" Margin="10,67,0,0" VerticalAlignment="Top" Width="109" RenderTransformOrigin="0.785,1.101"/>
<CheckBox x:Name="subdirctories" HorizontalAlignment="Left" Margin="179,104,0,0" VerticalAlignment="Top" Content="ASM"/>
</Grid>
</TabItem>
<TabItem Header="Translator">
<Grid Height="287" VerticalAlignment="Top" Margin="0,0,2,0">
<Button x:Name="Button1" Content="Button" HorizontalAlignment="Left" Margin="10,137,0,0" VerticalAlignment="Top" Width="75"/>
<CheckBox x:Name="PromtTranslateCBOX" Content="CheckBox" HorizontalAlignment="Left" Margin="10,174,0,0" VerticalAlignment="Top"/>
</Grid>
</TabItem>
</TabControl>
</Grid>
</TabItem>
<TabItem Header="Nényjegy" Width="124" IsEnabled="False">
<Grid>
<Image HorizontalAlignment="Center" Height="98" Margin="46,70,48,129" VerticalAlignment="Center" Width="406" Source="logo.png" Stretch="Fill"/>
</Grid>
</TabItem>
<Image Height="100" Width="100"/>
</TabControl>
<Button
HorizontalAlignment="Right"
VerticalAlignment="Top"
Width="40"
Height="40"
Click="Button_Click"
Background="Transparent"
BorderBrush="DarkRed"
BorderThickness="1"
ToolTip="Exit" Grid.RowSpan="2">
<Button.Content>
<TextBlock
Text="✕"
FontSize="32"
Foreground="DarkRed"
HorizontalAlignment="Center"
VerticalAlignment="Center"
TextAlignment="Center"
/>
</Button.Content>
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="DarkRed" />
<Setter Property="BorderThickness" Value="1" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#30FF0000" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#50FF0000" />
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</Grid>
</Window> </Window>

View File

@@ -117,10 +117,6 @@ Public Class MainWindow
XLSCheckbox.IsChecked = True XLSCheckbox.IsChecked = True
NamingSyntaxStefani.IsChecked = True NamingSyntaxStefani.IsChecked = True
namingsyntax = "stefani" namingsyntax = "stefani"
AktualisRajzRadioButton.IsChecked = True
If params.Contains("-arg") Then If params.Contains("-arg") Then
Try Try
@@ -379,51 +375,10 @@ Public Class MainWindow
conn.Disconnect(1) conn.Disconnect(1)
End Sub End Sub
Private Sub PurgeBongeszesButton_Click(sender As Object, e As EventArgs) Handles PurgeBongeszesButton.Click
Dim mydig As New Ookii.Dialogs.Wpf.VistaFolderBrowserDialog
mydig.ShowDialog()
Dim PurgeSelectedPath = mydig.SelectedPath() + "\"
Try
My.Computer.FileSystem.DeleteFile(Path.GetTempPath() + "FilesDeletedRenamed.txt")
Catch ex As Exception
End Try
Dim TempTxtFile As String = Path.GetTempPath() + "FilesDeletedRenamed.txt"
Dim fs As FileStream = File.Create(TempTxtFile)
fs.Close()
Dim allDirectories = System.IO.Directory.EnumerateDirectories(PurgeSelectedPath, "*", System.IO.SearchOption.AllDirectories)
'Dim allDirectoriesList As String()
For Each DirD In allDirectories
' MsgBox(DirD)
If PRTCheckBox.IsChecked = True Then
Purge.Purge(DirD, 1, ".prt", True, False, TempTxtFile)
End If
If ASMCheckBox.IsChecked = True Then
Purge.Purge(DirD, 1, ".asm", True, False, TempTxtFile)
End If
If DRWCheckBox.IsChecked = True Then
Purge.Purge(DirD, 1, ".drw", True, False, TempTxtFile)
End If
Next
Process.Start(Path.GetTempPath() + "FilesDeletedRenamed.txt")
End Sub
Private Sub drwSplitButton_Click_1(sender As Object, e As EventArgs) Handles drwSplitButton.Click
TakeAway()
End Sub
'Radio Buttons 'Radio Buttons
Private Sub MaterialRadioButton4_CheckedChanged(sender As Object, e As EventArgs) Private Sub MaterialRadioButton4_CheckedChanged(sender As Object, e As EventArgs)
@@ -657,7 +612,7 @@ Public Class MainWindow
'Handles sheets on drw 'Handles sheets on drw
ParamaterChecker(model1)
' ChangeSheets(model1, session, Drawing) ' ChangeSheets(model1, session, Drawing)
@@ -1523,175 +1478,7 @@ Public Class MainWindow
iParamValueStr = iParamValue.StringValue iParamValueStr = iParamValue.StringValue
End Sub End Sub
'drw Split sub 'drw Split sub
Private Sub TakeAway()
Dim session As IpfcBaseSession = Nothing
Dim conn As IpfcAsyncConnection = Nothing
Connect(session, conn)
Dim model1 As IpfcModel
Dim sheetowner As IpfcSheetOwner = Nothing
Dim Drawing As IpfcDrawing = Nothing
Dim model2d As IpfcModel2D
Dim cmodels As CpfcModels
Dim oModelDescriptor As IpfcModelDescriptor = Nothing
Dim oModelDescriptorCreate As New CCpfcModelDescriptor
Dim options As IpfcRetrieveModelOptions = Nothing
Dim NewWorkingDir As String
Dim OldWorkDir As String
Dim model2 As IpfcModel = Nothing
' Dim copyins As New CopyInstructions
model1 = session.CurrentModel
Dim model1name As String = model1.FileName
sheetowner = model1
Dim numberorsheets As Integer = sheetowner.NumberOfSheets
Dim oPath As String = Path.GetDirectoryName(model1.Origin)
Dim mydig As New Ookii.Dialogs.Wpf.VistaFolderBrowserDialog
mydig.ShowDialog()
NewWorkingDir = mydig.SelectedPath() + "\"
OldWorkDir = session.GetCurrentDirectory
session.ChangeDirectory(NewWorkingDir)
For k = 1 To numberorsheets
sheetowner = model1
If Not AktualisRajzRadioButton.IsChecked = True Then
sheetowner.CurrentSheetNumber = k
Else
End If
Dim h As Integer = 1
Dim numberofsheetsforloop As Integer
If k = 1 And AktualisRajzRadioButton.IsChecked = False Then
numberofsheetsforloop = numberorsheets
Else
numberofsheetsforloop = numberorsheets - 1
End If
For j = 1 To numberofsheetsforloop
If Not sheetowner.CurrentSheetNumber = h Then
sheetowner.DeleteSheet(h)
End If
If Not h = sheetowner.CurrentSheetNumber Then
h = h - 1
End If
h = h + 1
Next
model2d = model1
cmodels = model2d.ListModels()
For i = 0 To cmodels.Count - 1
Try
model2d.DeleteModel(cmodels.Item(i))
Catch ex As Exception
End Try
Next
Dim FileNameMod As String
namingsyntax = "stefani"
FileNameMod = model1.FileName
FileNames.Add(FileNameMod)
HandleNames(FileNameMod, 0, 0, ".DRW", model1)
Console.WriteLine(FileNameMod)
Dim savedName As String = Strings.Left(Path.GetFileName(FileNameMod), Path.GetFileName(FileNameMod).Length - 4)
Dim fname As String = "r_" + Strings.Left(Path.GetFileName(FileNameMod), Path.GetFileName(FileNameMod).Length - 4)
Try
model1.Copy(savedName, Nothing)
Catch ex As Exception
model1.Copy(fname, Nothing)
End Try
options = (New CCpfcRetrieveModelOptions).Create
options.AskUserAboutReps = False
MsgBox(FileNameMod)
Dim oModelDescriptor2 As IpfcModelDescriptor
oModelDescriptor2 = oModelDescriptorCreate.Create(EpfcModelType.EpfcMDL_PART, FileNameMod, "")
oModelDescriptor2.Path = oPath
model2 = session.RetrieveModelWithOpts(oModelDescriptor2, options)
oModelDescriptor = oModelDescriptorCreate.Create(EpfcModelType.EpfcMDL_PART, NewWorkingDir, "")
model2.Backup(oModelDescriptor)
Dim iWindow As IpfcWindow
iWindow = session.CurrentWindow
iWindow.Close()
model1name = model1.FileName
model1.Erase()
options = (New CCpfcRetrieveModelOptions).Create
options.AskUserAboutReps = False
oModelDescriptor = oModelDescriptorCreate.Create(EpfcModelType.EpfcMDL_DRAWING, Strings.Left(model1name, model1name.Length - 4), "")
oModelDescriptor.Path = oPath
Try
model1 = session.RetrieveModelWithOpts(oModelDescriptor, options)
Catch ex As Exception
MsgBox("Nem megefelelő munkakönyvtár?")
Exit Sub
End Try
model1 = session.RetrieveModelWithOpts(oModelDescriptor, options)
iWindow = session.OpenFile(oModelDescriptor)
iWindow.Activate()
If AktualisRajzRadioButton.IsChecked = True Then
Exit For
End If
Next
Dim iWindows As IpfcWindows
iWindows = session.ListWindows
For Each iWindow As IpfcWindow In iWindows
iWindow.Close()
Next
Dim model3 As IpfcModel
Dim model4 As IpfcModel
Dim modelToRetrive As String = model2.InstanceName
oModelDescriptor = oModelDescriptorCreate.Create(EpfcModelType.EpfcMDL_DRAWING, modelToRetrive, "")
session.EraseUndisplayedModels()
model3 = session.RetrieveModel(oModelDescriptor)
Dim newModelName As String
newModelName = InputBox("Eneter new model name", "New model name", "")
model3.Rename(newModelName, False)
oModelDescriptor = oModelDescriptorCreate.Create(EpfcModelType.EpfcMDL_PART, modelToRetrive, "")
model4 = session.RetrieveModel(oModelDescriptor)
model4.Rename(newModelName, False)
model3.Save()
session.EraseUndisplayedModels()
session.ChangeDirectory(OldWorkDir)
conn.Disconnect(1)
FileNames.Clear()
End Sub
'Don't know wtf this is atm
Private Sub AutomatedFolderPick(ByVal session As IpfcBaseSession) Private Sub AutomatedFolderPick(ByVal session As IpfcBaseSession)
'WTF is this? 'WTF is this?
Dim WorkingDir As String Dim WorkingDir As String
@@ -2048,153 +1835,6 @@ Public Class MainWindow
End Function End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim session As IpfcBaseSession = Nothing
Dim conn As IpfcAsyncConnection = Nothing
Dim fs As New FileStream("Serialized.ser", FileMode.Open)
Dim MyFormatter As New BinaryFormatter()
dict = MyFormatter.Deserialize(fs)
fs.Close()
Try
Connect(session, conn)
Catch ex As Exception
If ex.Message = "pfcExceptions::XToolkitAmbiguous" Then
MsgBox("Egynél több Creo fut, kérlezk zárd be az egyiket.")
End If
Exit Sub
End Try
Dim WorkingDir As String
WorkingDir = session.GetCurrentDirectory()
Dim strFileSize As String = ""
Dim di As New IO.DirectoryInfo(WorkingDir)
Dim aryFi As IO.FileInfo() = di.GetFiles("SHM-*.prt*")
Dim options As IpfcRetrieveModelOptions = Nothing
Dim model1 As IpfcModel = Nothing
Dim oWindow As IpfcWindow
For Each fi In aryFi
strFileSize = (Math.Round(fi.Length / 1024)).ToString()
Console.WriteLine("File Name: {0}", fi.FullName)
Next
'Clean up list
Dim PrtList As New List(Of String) 'prt list with duplicates
'remove version number from
For Each fi In aryFi
PrtList.Add(Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(fi.Name)))
Next
Dim result As List(Of String) = PrtList.Distinct().ToList 'prtlist without duplicates
Dim MyFile As New FileStream("Serialized.ser", FileMode.Create, FileAccess.Write, FileShare.None)
Try
For Each Strss In result
Dim oModelDescriptor As IpfcModelDescriptor = Nothing
Dim oModelDescriptorCreate As New CCpfcModelDescriptor
Dim PrtNaneWE As String = Strss
oModelDescriptor = oModelDescriptorCreate.Create(EpfcModelType.EpfcMDL_PART, PrtNaneWE, "")
options = (New CCpfcRetrieveModelOptions).Create
options.AskUserAboutReps = False
oModelDescriptor.Path = WorkingDir
model1 = session.RetrieveModelWithOpts(oModelDescriptor, options)
oWindow = session.OpenFile(oModelDescriptor)
oWindow.Activate()
Dim ParamValueR As String = ""
Try
ReadParam(model1, "MEGNEVEZES_1", ParamValueR)
Catch ex As Exception
ParamValueR = "Nem létezik a paraméter"
End Try
Dim form5window As New Form5
form5window.NemetMegnevezes.Text = ParamValueR
Dim ParamValueW As String = ""
If dict.TryGetValue(ParamValueR, ParamValueW) = True Then
form5window.MaterialLabel4.Background = Brushes.Green
form5window.MaterialLabel4.Content = "Megtaláható a szótárban!"
Else
'form5window.MaterialLabel4.Background = SystemColors.ButtonFace
form5window.MaterialLabel4.Content = ""
ParamValueW = gtranslate(ParamValueR, "de", "hu")
End If
form5window.MagyarMegnevezes.Text = ParamValueW
If Not PromtTranslateCBOX.IsChecked = True And dict.TryGetValue(ParamValueR, ParamValueW) = True Then
form5window.WWClicked = "OK"
Else
form5window.ShowDialog()
End If
ParamValueW = form5window.MagyarMegnevezes.Text
If form5window.WWClicked = "OK" Then
WriteParam(model1, ParamValueW, "Megnevezes_1")
If ParamValueR = form5window.NemetMegnevezes.Text Then
Else
' WriteParam(model1, Form5.NemetMegnevezes.Text, "Megnevezes_1")
End If
Dim TestForChange As String = ""
If dict.TryGetValue(ParamValueR, TestForChange) = True Then
If Not TestForChange = ParamValueW Then
dict(ParamValueR) = ParamValueW
End If
Else
dict.Add(ParamValueR, ParamValueW)
End If
ElseIf form5window.WWClicked = "FB" Then
MyFormatter.Serialize(MyFile, dict)
MyFile.Close()
conn.Disconnect(1)
Exit Sub
End If
oWindow.Close()
Next
Catch ex As Exception
End Try
MyFormatter.Serialize(MyFile, dict)
MyFile.Close()
conn.Disconnect(1)
End Sub
@@ -2430,9 +2070,6 @@ Public Class MainWindow
End Sub End Sub
Private Sub Button1_Click_1(sender As Object, e As RoutedEventArgs) Handles Button1.Click
End Sub
Private Sub KulonAloRajzok_Checked(sender As Object, e As RoutedEventArgs) Handles KulonAloRajzok.Checked Private Sub KulonAloRajzok_Checked(sender As Object, e As RoutedEventArgs) Handles KulonAloRajzok.Checked
If KulonAloRajzok.IsChecked = True Then If KulonAloRajzok.IsChecked = True Then
@@ -2450,8 +2087,9 @@ Public Class MainWindow
End If End If
End Sub End Sub
Private Sub Button_Click(sender As Object, e As RoutedEventArgs) Private Sub ExitButton_Click(sender As Object, e As RoutedEventArgs)
Environment.Exit(0) Environment.Exit(0)
End Sub End Sub
Private Sub AutomaticFolderSelect_Checked(sender As Object, e As RoutedEventArgs) Handles AutomaticFolderSelect.Checked Private Sub AutomaticFolderSelect_Checked(sender As Object, e As RoutedEventArgs) Handles AutomaticFolderSelect.Checked
@@ -2465,29 +2103,9 @@ Public Class MainWindow
Private Sub Subdirctories_Checked(sender As Object, e As RoutedEventArgs) Handles subdirctories.Checked
End Sub
Private Sub ParamaterChecker(model1 As IpfcModel)
Dim ParamValueDef As String
ParamNameD = "OA_MEGNEVEZES_1"
ParamValueDef = "Focsoport"
ReadParam(model1, ParamNameD, ParamValueD)
If ParamValueD = ParamValueDef Then
' MsgBox(sresult)
NewWindow.ShowDialog()
End If
If Form2.ans = "ok" Then
WriteParam(model1, Form2.NewParamValue, ParamNameD)
End If
End Sub
Private Sub BackgroundWorker3_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker3.DoWork Private Sub BackgroundWorker3_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker3.DoWork
@@ -2528,20 +2146,5 @@ Public Class MainWindow
End Sub End Sub
Private Sub Test_Click(sender As Object, e As RoutedEventArgs) Handles test.Click
Dim session As IpfcBaseSession = Nothing
Dim conn As IpfcAsyncConnection = Nothing
Connect(session, conn)
Dim iWindows As IpfcWindows
iWindows = session.ListWindows
For Each iWindow As IpfcWindow In iWindows
iWindow.Close()
Next
session.EraseUndisplayedModels()
conn.Disconnect(1)
End Sub
End Class End Class