1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531
| Imports System.IO
Imports Microsoft.Office
Public Class SelectionDialog
'Klassen
Dim funcs As DAPOfficeAddInFunctions.XMLFileFunctions
Dim basefuncs As DAPOfficeAddInFunctions.GeneralFunctions
'Variablen
Public m_iSection As Integer
Public m_sSectionName As String
Public m_sLanguage(14, 1) As String
Public m_sFiles(50, 1) As String '50 Files, Name und File
Public m_sActLang As String
Public m_sActFolder As String
Public m_iActButton As Integer
Public m_iActFileCount As Integer
Public m_sActDocument As String
Public m_sLocalPath As String
Public m_sNetworkPath As String
Public m_sServer As String
Public m_iPingTime As Integer
Public m_dBandWidth As Double
Public m_sIniFile As String 'Path IniFile
Public m_sDocFile As String 'Path Document-Ini-File
Public m_sLogFile As String 'Path Log-File
Public m_iDebugLevel As Integer
Public m_bIsLocal As Boolean
Public m_bIsOnline As Boolean
Public Function Init(ByVal Section As Integer, ByVal SecName As String) As Boolean
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Init()", m_iDebugLevel, 10)
m_iSection = Section
m_sSectionName = SecName
'Default 1. Button anwählen
m_iActButton = 1
m_sLanguage(0, 0) = "Chinesisch"
m_sLanguage(0, 1) = "zs"
m_sLanguage(1, 0) = "Deutsch"
m_sLanguage(1, 1) = "de"
m_sLanguage(2, 0) = "Englisch"
m_sLanguage(2, 1) = "en"
m_sLanguage(3, 0) = "Finnisch"
m_sLanguage(3, 1) = "fi"
m_sLanguage(4, 0) = "Französisch"
m_sLanguage(4, 1) = "fr"
m_sLanguage(5, 0) = "Italienisch"
m_sLanguage(5, 1) = "it"
m_sLanguage(6, 0) = "Niederländisch"
m_sLanguage(6, 1) = "nl"
m_sLanguage(7, 0) = "Persisch"
m_sLanguage(7, 1) = "fa"
m_sLanguage(8, 0) = "Polnisch"
m_sLanguage(8, 1) = "pl"
m_sLanguage(9, 0) = "Rumänisch"
m_sLanguage(9, 1) = "ro"
m_sLanguage(10, 0) = "Russisch"
m_sLanguage(10, 1) = "ru"
m_sLanguage(11, 0) = "Slowakisch"
m_sLanguage(11, 1) = "sk"
m_sLanguage(12, 0) = "Spanisch"
m_sLanguage(12, 1) = "es"
m_sLanguage(13, 0) = "Türkisch"
m_sLanguage(13, 1) = "tr"
m_sLanguage(14, 0) = "Tschechisch"
m_sLanguage(14, 1) = "cs"
funcs = New DAPOfficeAddInFunctions.XMLFileFunctions
funcs.m_sLogFile = m_sLogFile
If funcs Is Nothing Then
DAPOfficeAddInFunctions.GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Init() XMLFileFunctions NULL Pointer", m_iDebugLevel, 1)
Return False
End If
basefuncs = New DAPOfficeAddInFunctions.GeneralFunctions
basefuncs.m_sLogFile = m_sLogFile
basefuncs.m_iDebuglevel = m_iDebugLevel
If basefuncs Is Nothing Then
DAPOfficeAddInFunctions.GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Init() GeneralFunctions NULL Pointer", m_iDebugLevel, 1)
Return False
End If
'Modus auslesen
If funcs.GetMode(m_sIniFile) = "Local" Then
m_bIsLocal = True
Else
m_bIsLocal = False
End If
'Einstellungen auslesen
m_sLocalPath = funcs.GetLocalPath(m_sIniFile)
If m_sLocalPath.EndsWith("\") = False Then
m_sLocalPath = m_sLocalPath + "\"
End If
m_sNetworkPath = funcs.GetNetworkPath(m_sIniFile)
If m_sNetworkPath.EndsWith("\") = False Then
m_sNetworkPath = m_sNetworkPath + "\"
End If
m_sServer = funcs.GetServer(m_sIniFile)
m_iPingTime = funcs.GetPingTime(m_sIniFile)
m_dBandWidth = funcs.GetBandWidth(m_sIniFile)
'Verbindungstest zu Server
If basefuncs.IsServerConnected(m_sServer) < m_iPingTime Then
m_bIsOnline = True
End If
Return True
End Function
Private Sub SelectionDialog_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::SelectionDialog_Load()", m_iDebugLevel, 10)
Dim i As Integer
'Titel
If m_bIsLocal Then
Text = m_sSectionName + "(Lokale Installation)"
Else
Text = m_sSectionName + "(Netzwerk-Installation)"
End If
'Sprachen eintragen
For i = 0 To 14
Combo_Lang.Items.Add(m_sLanguage(i, 0))
Next
Combo_Lang.SelectedIndex = 1
m_sActLang = "de"
'Button - Text
If funcs IsNot Nothing Then
Button_01.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 1)
Button_02.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 2)
Button_03.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 3)
Button_04.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 4)
Button_05.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 5)
Button_06.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 6)
Button_07.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 7)
Button_08.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 8)
Button_09.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 9)
Button_10.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 10)
Button_11.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 11)
Button_12.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 12)
Button_13.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 13)
Button_14.Text = funcs.GetButtonName(m_sDocFile, m_iSection, 14)
End If
'Sichtbar schalten
If Button_01.Text = "" Then
Button_01.Visible = False
End If
If Button_02.Text = "" Then
Button_02.Visible = False
End If
If Button_03.Text = "" Then
Button_03.Visible = False
End If
If Button_04.Text = "" Then
Button_04.Visible = False
End If
If Button_05.Text = "" Then
Button_05.Visible = False
End If
If Button_06.Text = "" Then
Button_06.Visible = False
End If
If Button_07.Text = "" Then
Button_07.Visible = False
End If
If Button_08.Text = "" Then
Button_08.Visible = False
End If
If Button_09.Text = "" Then
Button_09.Visible = False
End If
If Button_10.Text = "" Then
Button_10.Visible = False
End If
If Button_11.Text = "" Then
Button_11.Visible = False
End If
If Button_12.Text = "" Then
Button_12.Visible = False
End If
If Button_13.Text = "" Then
Button_13.Visible = False
End If
If Button_14.Text = "" Then
Button_14.Visible = False
End If
'Default 1. Button anwählen
TxtLabel.Text = Button_01.Text
End Sub
Private Sub Combo_Lang_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Combo_Lang.SelectedIndexChanged
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Combo_Lang_SelectedIndexChanged()", m_iDebugLevel, 10)
For k = 0 To 14
If Combo_Lang.SelectedItem = m_sLanguage(k, 0) Then
m_sActLang = m_sLanguage(k, 1)
End If
Next
FillFileList()
End Sub
Private Sub List_Files_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles List_Files.SelectedIndexChanged
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::List_Files_SelectedIndexChanged()", m_iDebugLevel, 10)
Dim i As Integer
For i = 0 To List_Files.Items.Count - 1
List_Files.SetItemChecked(i, False)
Next
List_Files.SetItemChecked(List_Files.SelectedIndex, True)
End Sub
Private Sub Button_01_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_01.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_01_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_01.Text
m_iActButton = 1
FillFileList()
End Sub
Private Sub Button_02_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_02.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_02_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_02.Text
m_iActButton = 2
FillFileList()
End Sub
Private Sub Button_03_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_03.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_03_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_03.Text
m_iActButton = 3
FillFileList()
End Sub
Private Sub Button_04_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_04.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_04_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_04.Text
m_iActButton = 4
FillFileList()
End Sub
Private Sub Button_05_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_05.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_05_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_05.Text
m_iActButton = 5
FillFileList()
End Sub
Private Sub Button_06_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_06.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_06_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_06.Text
m_iActButton = 6
FillFileList()
End Sub
Private Sub Button_07_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_07.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_07_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_07.Text
m_iActButton = 7
FillFileList()
End Sub
Private Sub Button_08_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_08.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_08_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_08.Text
m_iActButton = 8
FillFileList()
End Sub
Private Sub Button_09_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_09.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_09_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_09.Text
m_iActButton = 9
FillFileList()
End Sub
Private Sub Button_10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_10.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_10_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_10.Text
m_iActButton = 10
FillFileList()
End Sub
Private Sub Button_11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_11.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_11_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_11.Text
m_iActButton = 11
FillFileList()
End Sub
Private Sub Button_12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_12.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_12_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_12.Text
m_iActButton = 12
FillFileList()
End Sub
Private Sub Button_13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_13.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_13_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_13.Text
m_iActButton = 13
FillFileList()
End Sub
Private Sub Button_14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_14.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_14_Click()", m_iDebugLevel, 10)
TxtLabel.Text = Button_14.Text
m_iActButton = 14
FillFileList()
End Sub
'Überprüft Aktualität und startet das Dokument
Private Sub Button_Create_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Create.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_Create_Click()", m_iDebugLevel, 10)
Dim sDateiTyp As String
Dim sLocalFile As String
Dim sNetFile As String
Dim sLogString As String
Me.Hide()
m_sActDocument = m_sFiles(List_Files.SelectedIndex, 1)
sLocalFile = m_sLocalPath + m_sActFolder + "\" + m_sActDocument
sNetFile = m_sNetworkPath + m_sActFolder + "\" + m_sActDocument
'ist File aktuell ??
If m_bIsOnline Then
If basefuncs.IsFileUptoDate(sNetFile, sLocalFile) = 0 Then
basefuncs.MakeDirectory(m_sLocalPath)
basefuncs.MakeDirectory(m_sLocalPath + m_sActFolder)
basefuncs.CopyFile(sNetFile, sLocalFile)
End If
End If
sLogString = "Open File " + m_sActDocument
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_Create_Click() " + sLogString, m_iDebugLevel, 8)
' welcher Dateityp ist angewählt
sDateiTyp = Path.GetExtension(m_sActDocument)
Select Case sDateiTyp
Case ".dot", ".dotx", ".dotm"
Dim oAw As Interop.Word.Application
Dim oDoc As Interop.Word.Document
oAw = New Interop.Word.Application
oAw.Visible = True
oAw.WindowState = Interop.Word.WdWindowState.wdWindowStateMinimize
oDoc = oAw.Documents.Add(sLocalFile, Visible:=True)
oDoc.Activate()
AppActivate(oDoc.ActiveWindow.Caption)
oAw.WindowState = Interop.Word.WdWindowState.wdWindowStateMaximize
oAw.Visible = True
Case ".xlt", ".xltx", ".xltm"
Dim oAx As Interop.Excel.Application
Dim oWob As Interop.Excel.Workbook
oAx = New Interop.Excel.Application
oAx.Visible = True
oAx.WindowState = Interop.Excel.XlWindowState.xlMinimized
oWob = oAx.Workbooks.Add(sLocalFile)
AppActivate(oAx.Caption)
oAx.WindowState = Interop.Excel.XlWindowState.xlMaximized
oAx.Visible = True
Case ".pot", ".potx", ".potm"
Dim oApp As Interop.PowerPoint.Application
Dim oPres As Interop.PowerPoint.Presentation
'Start Powerpoint and make its window visible but minimized.
oApp = New Interop.PowerPoint.Application
oApp.Visible = Core.MsoTriState.msoTrue
oApp.WindowState = Interop.PowerPoint.PpWindowState.ppWindowMinimized
'Create a new presentation based on the specified template.
oPres = oApp.Presentations.Open(sLocalFile, Core.MsoTriState.msoFalse, Core.MsoTriState.msoTrue, Core.MsoTriState.msoTrue)
oApp.Activate()
AppActivate(oApp.ActiveWindow.Caption)
oApp.WindowState = Interop.PowerPoint.PpWindowState.ppWindowMaximized
'oApp.ActivePresentation.Application.Activate()
oApp.Visible = True
Case ".zdp"
' ShellExecute(0, "open", m_sLocalPath & "\" & m_sDocument, 0&, 6, SW_SHOWNORMAL)
End Select
End Sub
Private Sub Button_Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Cancel.Click
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::Button_Cancel_Click()", m_iDebugLevel, 10)
Me.Hide()
End Sub
Private Sub List_Files_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles List_Files.DoubleClick
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::List_Files_DoubleClick()", m_iDebugLevel, 10)
Button_Create_Click(sender, e)
End Sub
'TODO List File Klick setzt entsprechende Häkchen
Private Sub List_Files_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles List_Files.Click
End Sub
'Erstellt Listeneinträge lauf Document-Ini-File
Private Function FillFileList()
GeneralFunctions.WriteToLogFile(m_sLogFile, "SelectionDialog::FillFileList()", m_iDebugLevel, 10)
Dim i As Integer
m_sActFolder = funcs.GetFolderName(m_sDocFile, m_iSection, m_iActButton)
Array.Clear(m_sFiles, 0, m_sFiles.Length)
If funcs IsNot Nothing Then
m_iActFileCount = funcs.GetDocNames(m_sDocFile, m_iSection, m_iActButton, m_sActLang, m_sFiles)
End If
'Visu
List_Files.Items.Clear()
If m_iActFileCount > 0 Then
For i = 0 To m_iActFileCount - 1
List_Files.Items.Add(m_sFiles(i, 0))
Next
End If
Return 0
End Function
End Class |
Partager