Made GUI Changes
This commit is contained in:
parent
38f5793883
commit
69d132300d
33
MainForm.ps1
33
MainForm.ps1
@ -11,7 +11,7 @@ Import-Module Microsoft.Graph.Files
|
||||
# Create main form
|
||||
$form = New-Object System.Windows.Forms.Form
|
||||
$form.Text = "SharePoint XLS Converter"
|
||||
$form.Size = New-Object System.Drawing.Size(800, 600) # Increased form size
|
||||
$form.Size = New-Object System.Drawing.Size(800, 600)
|
||||
|
||||
# Set AutoScaleMode to Dpi
|
||||
$form.AutoScaleMode = [System.Windows.Forms.AutoScaleMode]::Dpi
|
||||
@ -25,13 +25,15 @@ $form.Controls.Add($lblConfig)
|
||||
|
||||
$txtSiteUrl = New-Object System.Windows.Forms.TextBox
|
||||
$txtSiteUrl.Location = New-Object System.Drawing.Point(20, 40)
|
||||
$txtSiteUrl.Size = New-Object System.Drawing.Size(200, 20)
|
||||
$txtSiteUrl.Size = New-Object System.Drawing.Size(300, 20)
|
||||
$txtSiteUrl.PlaceholderText = "Site URL"
|
||||
$txtSiteUrl.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
|
||||
|
||||
$txtProdLib = New-Object System.Windows.Forms.TextBox
|
||||
$txtProdLib.Location = New-Object System.Drawing.Point(20, 70)
|
||||
$txtProdLib.Size = New-Object System.Drawing.Size(200, 20)
|
||||
$txtProdLib.Size = New-Object System.Drawing.Size(300, 20)
|
||||
$txtProdLib.PlaceholderText = "Production Library"
|
||||
$txtProdLib.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
|
||||
|
||||
$txtTempLib = New-Object System.Windows.Forms.TextBox
|
||||
$txtTempLib.Location = New-Object System.Drawing.Point(20, 100)
|
||||
@ -40,13 +42,15 @@ $txtTempLib.PlaceholderText = "Temp Library"
|
||||
|
||||
$txtFolder = New-Object System.Windows.Forms.TextBox
|
||||
$txtFolder.Location = New-Object System.Drawing.Point(20, 130)
|
||||
$txtFolder.Size = New-Object System.Drawing.Size(200, 20)
|
||||
$txtFolder.Size = New-Object System.Drawing.Size(220, 20)
|
||||
$txtFolder.PlaceholderText = "Folder Path (optional)"
|
||||
$txtFolder.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
|
||||
|
||||
$btnBrowse = New-Object System.Windows.Forms.Button
|
||||
$btnBrowse.Location = New-Object System.Drawing.Point(230, 130)
|
||||
$btnBrowse.Location = New-Object System.Drawing.Point(250, 130)
|
||||
$btnBrowse.Size = New-Object System.Drawing.Size(80, 20)
|
||||
$btnBrowse.Text = "Browse"
|
||||
$btnBrowse.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Left
|
||||
|
||||
$btnList = New-Object System.Windows.Forms.Button
|
||||
$btnList.Location = New-Object System.Drawing.Point(20, 170)
|
||||
@ -55,29 +59,26 @@ $btnList.Text = "List XLS Files"
|
||||
$form.Controls.Add($btnList)
|
||||
|
||||
$btnConvert = New-Object System.Windows.Forms.Button
|
||||
$btnConvert.Location = New-Object System.Drawing.Point(160, 170)
|
||||
$btnConvert.Location = New-Object System.Drawing.Point(150, 170)
|
||||
$btnConvert.Size = New-Object System.Drawing.Size(120, 30)
|
||||
$btnConvert.Text = "Convert to XLSX"
|
||||
$form.Controls.Add($btnConvert)
|
||||
|
||||
# Create Status TextBox (Top Right)
|
||||
$txtStatus = New-Object System.Windows.Forms.TextBox
|
||||
$txtStatus.Location = New-Object System.Drawing.Point(450, 20) # Top Right Corner
|
||||
$txtStatus.Size = New-Object System.Drawing.Size(330, 180) # Adjusted size
|
||||
$txtStatus.Location = New-Object System.Drawing.Point(350, 20)
|
||||
$txtStatus.Size = New-Object System.Drawing.Size(430, 180)
|
||||
$txtStatus.Multiline = $true
|
||||
$txtStatus.WordWrap = $true
|
||||
$txtStatus.ScrollBars = "Vertical"
|
||||
$txtStatus.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor `
|
||||
[System.Windows.Forms.AnchorStyles]::Right
|
||||
$txtStatus.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Right -bor [System.Windows.Forms.AnchorStyles]::Left
|
||||
$form.Controls.Add($txtStatus)
|
||||
|
||||
# Create DataGridView (Lower 2/3)
|
||||
$dataGridView = New-Object System.Windows.Forms.DataGridView
|
||||
$dataGridView.Location = New-Object System.Drawing.Point(20, 230)
|
||||
$dataGridView.Size = New-Object System.Drawing.Size(760, 320) # Lower 2/3 of the form
|
||||
$dataGridView.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor `
|
||||
[System.Windows.Forms.AnchorStyles]::Left -bor `
|
||||
[System.Windows.Forms.AnchorStyles]::Right -bor `
|
||||
[System.Windows.Forms.AnchorStyles]::Top
|
||||
$dataGridView.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Right -bor [System.Windows.Forms.AnchorStyles]::Top
|
||||
$dataGridView.AutoSizeColumnsMode = [System.Windows.Forms.DataGridViewAutoSizeColumnsMode]::Fill
|
||||
$form.Controls.Add($dataGridView)
|
||||
|
||||
@ -88,7 +89,7 @@ $dataGridView.Columns[1].Name = "Original File Name"
|
||||
|
||||
# Add Save Config button
|
||||
$btnSaveConfig = New-Object System.Windows.Forms.Button
|
||||
$btnSaveConfig.Location = New-Object System.Drawing.Point(230, 40)
|
||||
$btnSaveConfig.Location = New-Object System.Drawing.Point(20, 100)
|
||||
$btnSaveConfig.Size = New-Object System.Drawing.Size(80, 20)
|
||||
$btnSaveConfig.Text = "Save Config"
|
||||
$btnSaveConfig.Add_Click({
|
||||
@ -98,7 +99,7 @@ $btnSaveConfig.Add_Click({
|
||||
|
||||
# Add Connect button
|
||||
$btnConnect = New-Object System.Windows.Forms.Button
|
||||
$btnConnect.Location = New-Object System.Drawing.Point(320, 40)
|
||||
$btnConnect.Location = New-Object System.Drawing.Point(110, 100)
|
||||
$btnConnect.Size = New-Object System.Drawing.Size(80, 20)
|
||||
$btnConnect.Text = "Connect"
|
||||
$btnConnect.Add_Click({
|
||||
|
||||
@ -820,3 +820,15 @@ function Move-Files {
|
||||
$script:txtStatus.Text += "Stack Trace: $($_.Exception.StackTrace)`n"
|
||||
}
|
||||
}
|
||||
|
||||
# Update the status text box with proper newline handling
|
||||
function Update-StatusText {
|
||||
param (
|
||||
[string]$Message
|
||||
)
|
||||
|
||||
if ($script:txtStatus) {
|
||||
$script:txtStatus.AppendText("$Message`r`n")
|
||||
$script:txtStatus.ScrollToCaret()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user