Public/Start-MainDotPs1.ps1
<#PSScriptInfo
.VERSION 1.0 .GUID 936baf47-0936-4906-be5b-581a123f5d0d .AUTHOR Bjørn Wolstad .COMPANYNAME Office Center Høneffoss AS .COPYRIGHT .TAGS .LICENSEURI .PROJECTURI .ICONURI .EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES .PRIVATEDATA #> #må kanskje fjerne statisk paths til å bruke et parameter. #Lage parameter for å slette filene og prøve pålogging på nytt. <# .DESCRIPTION Gets active Autotask Accounts and stores them as securestrings To start the form run Start-OCHAutotaskForm. It installs and or updated needed modules if run as administrator. Otherwise this function starts the form, but does not check if anything is as it should be before it does. Sources: https://stackoverflow.com/questions/40617800/opening-powershell-script-and-hide-command-prompt-but-not-the-gui https://www.reddit.com/r/PowerShell/comments/7ziv37/print_a_word_document_to_a_specific_printer/ https://foxdeploy.com/2015/05/14/part-iii-using-advanced-gui-elements-in-powershell/ http://serverfixes.com/powershell-radiobuttons #> Function Start-MainDotPs1 ($RunningDir) { #henter inn .net feilmeldingsbokser add-Type -AssemblyName PresentationCore,PresentationFramework Import-Module WordDoc, Autotask #change to module path. <# $imodules = $env:PSModulePath.Split(';') | ForEach-Object{Get-ChildItem $_} if ('OCH' -in ($imodules.Name)) { $path = $imodules.Where({$_.Name -eq 'OCHAutotaskForm'}).FullName Write-Output ('changing dir to {0}' -f $path) Set-Location $path } #> if (!$RunningDir) { set-location 'C:\Temp' } $ochmodule = Get-InstalledModule OCHAutotaskForm -ErrorAction SilentlyContinue $ConfigPath = $ochmodule.InstalledLocation $faviconpath = ($ConfigPath + '\favicon.ico') | Out-String $Logopath = ($ConfigPath + '\logo.png') | Out-String #region egne funksjoner #Region Autentication Write-Output "logger på Autotask" $ATWSuser = Get-Content -Path "C:\Temp\ATWSuser.txt" #| Out-String if (!$ATWSCred) { if (Test-Path -Path "C:\temp\ATWS.txt") { $ATWSpwdtxt = Get-Content "C:\temp\ATWS.txt" $ATWSsecurePwd = $ATWSpwdtxt | ConvertTo-SecureString $ATWSCred = New-Object System.Management.Automation.PSCredential -ArgumentList $ATWSuser, $ATWSsecurePwd } # end if else { $ATWSCred = Get-Credential $secureStringATWS = ConvertFrom-SecureString $ATWSCred.Password Set-Content "C:\temp\ATWS.txt" $secureStringATWS } #end else } #end if # Kopler til Autotask API Connect-AutotaskWebAPI -Credential $ATWSCred # try{ # Connect-AutotaskWebAPI -Credential $ATWSCred -ErrorAction Stop -RefreshCache -Verbose # }catch{ if($Error[0] -match "Invalid username*"){ Write-Warning "Make sure username in C:\temp\ATWSuser.txt is correct" return } if($Error[0] -match "Could not complete a query to Autotask WebAPI.*"){ Write-Warning "Delete C:\temp\ATWS.txt File and try again" return } # Connect-AutotaskWebAPI -Credential $ATWSCred # } Write-Output "logget på" #EndRegion Authentication function UpdateAccountListsCrypt { param ( [Switch]$Delete ) if ($Delete -eq $true) { Update-AccountFiles -Delete $true -Folder $RunningDir # Update-AccountFiles -Delete $true -Folder 'C:\temp' } else { } Update-AccountFiles -Folder $RunningDir # Update-AccountFiles -Folder 'C:\temp' $script:AtwsAccountImport = GetAccountListsCrypt | Sort-Object AccountName } function GetAccountListsCrypt { Get-AccountFiles -Folder $RunningDir # Get-AccountFiles -Folder 'C:\temp' } #Region Oppdater kundeliste Function OppdaterKundelisteFil() { ShowConsole $button8.Text = ('Oppdaterer...') UpdateAccountListsCrypt -Delete $true Wait-Event -Timeout 0.2 OppdaterKundeListeInnhold $button8.Text = ('Oppdater Kundeliste') HideConsole }#end OppdaterKundelisteFilr #OppdaterKundelisteFil #EndRegion #Region Oppdater Brukerlisteinnhold/trigger butten ved combobox 1 Function OppdaterBrukerListeInnhold() { $script:SelectedAccount = $comboBox1.SelectedItem $script:SelectedAccount $combobox2.Text = @() $combobox2.Items.Clear() $id = ($AtwsAccountImport | Where-Object {$_.AccountName -like $script:SelectedAccount}).id $AtwsContatcsListContent = Get-AtwsContact -AccountID $id -Active $true | Sort-Object -Property FirstName Foreach($x in $AtwsContatcsListContent){ $Displayname = $x.FirstName + ' ' + $x.LastName $combobox2.Items.Add($Displayname) } write-output $id write-output '"Function OppdaterBrukerListeInnhold" Ran' $comboBox2.DroppedDown = $true; }#funksjon slutt #EndRegion #Region Hent kundeliste #Region import - kjøres ved oppstart - importerer kunder fra liste. Function OppdaterKundeListeInnhold() { $i = 0 # If(!(Test-Path "$RunningDir\Crypt\0ec.txt") -eq $true) # { # write-output 'oppdaterer kundeliste' # OppdaterKundelisteFil # } # else # { $script:AtwsAccountImport = GetAccountListsCrypt | Sort-Object AccountName $comboBox1.Items.Clear() $ListContent = $script:AtwsAccountImport.AccountName Foreach ($x in $ListContent) { $comboBox1.Items.Add($x) Write-Progress -Activity "Adding to list" -Status "Progress:" -PercentComplete ($i/$ListContent.Count*100) $i++ } write-output 'tried to import' # } } #end region #EndRegion #Region Velg Bruker Function VelgBruker() { $script:SelectedUser = $comboBox2.SelectedItem $script:SelectedUser if ($script:SelectedUser) { $label15.Text = '' $FirstName = $script:SelectedUser.Split(' ')[0] $LastName = $script:SelectedUser.Split(' ')[1] $id = ($AtwsAccountImport | Where-Object {$_.AccountName -like $script:SelectedAccount}).id $Script:Brukerinfo = Get-AtwsContact -AccountID $id | where-object {$_.FirstName -like $FirstName -and $_.LastName -like $LastName} $Displayname = $BrukerInfo.FirstName + ' ' + $BrukerInfo.LastName $PhoneNumber = $BrukerInfo.Phone + ' / ' + $BrukerInfo.phone + ' / ' + $BrukerInfo.AlternatePhone $Email = $BrukerInfo.EMailAddress + ' '+ $BrukerInfo.EMailAddress2 + ' ' + $BrukerInfo.EMailAddress3 $script:BrukerInfoTekstTextboks = $Displayname + ' ' + 'Tlf: ' + $PhoneNumber + ' ' + 'Mobil: ' + ' ' + 'Epost: ' + $Email #$form1.Controls.Add($combobox2) $label15.Text= $script:BrukerInfoTekstTextboks write-output "VelgBruker funksjon kjørt ID ", $BrukerInfo.id } }#Funksjon slutt #EndRegion #Region Ny bruker Function NyBruker() { #Sjekker om det er skrevet nok info om brukeren, og definerer variabler if ($richTextBox5.Text.ToString().Length -ge 2 -and $richTextBox6.Text.ToString().Length -ge 2 -and $comboBox1.Text.ToString().Length -ge 2 ) { $newuserparams = @{ Firstname = $richTextBox5.Text Lastname = $richTextBox6.Text AccountID = "$(($AtwsAccountImport | Select-Object AccountName, id | Where-Object {$_.AccountName -like $comboBox1.SelectedItem}).id)" Active = $true } } else { $newuserparams = @{} $message = "du må skrive noe i følgende felt, Kunde(1.st page), Fornavn og Etternavn!" Write-Warning $message $messageIcon = [System.Windows.MessageBoxImage]::Error [system.Windows.MessageBox]::Show($message,$messageIcon) return } if ($richTextBox7.Text.ToString().Length -ge 2 ) { $phone = @{phone = $richTextBox7.Text} } else { $phone = @{} } if ($richTextBox8.Text.ToString().Length -ge 2 ) { $EMailAddress = @{EMailAddress = $richTextBox5.Text} } else { $EMailAddress = @{} } #Lager brukeren $user = New-AtwsContact @newuserparams @phone @EMailAddress #Sender status til en label i skjemaet if ($user) { $label13.Text = 'OK' $message = "Bruker er opprettet" $messageIcon = [System.Windows.MessageBoxImage]::Hand [system.Windows.MessageBox]::Show($message,$messageIcon) }else{ $label13.Text = 'failed' $message = "Bruker ble ikke opprettet" $messageIcon = [System.Windows.MessageBoxImage]::Error [system.Windows.MessageBox]::Show($message,$messageIcon) } } #Region send inn ticket funksjon Må sjekke FORM objekter Function NyTicket() { #reconnecting to autotask before sending inn #Connect-AutotaskWebAPI -Credential $ATWSCred -RefreshCache -Verbose $ticket_parameters = @() $Script:Backup = @() $Script:Service = @() $Script:Garanti = @() $description_BR = " " #sjekker hva som er fylt ut av info if("$($radioButton1.Checked)" -eq $true) { $Script:Service = $true $serviceUDF = @{Name = 'OCH-SERVICETYPE';Value = 'service'} } else { $Script:Service = $false } if("$($radioButton2.Checked)" -eq $true) { $Script:Garanti = $true $serviceUDF = @{Name = 'OCH-SERVICETYPE';Value = 'garanti'} } else { $Script:Garanti = $false } if("$($checkBox3.CheckState)" -eq "Checked") { $Script:Backup = $true $backupUDF = @{Name = 'OCH-BACKUP';Value = 'JA'} } else { $Script:Backup = $false $backupUDF = @{Name = 'OCH-BACKUP';Value = 'NEI'} } #først sjekke om det er en bruker valgt eller ikke if ($richTextBox2.Text.ToString().Length -le 2 -or $richTextBox3.Text.ToString().Length -le 2 -or $richTextBox4.Text.ToString().Length -le 2 -or $combobox2.Text.ToString().Length -le 2) { $message = "Du må velge kunde og bruker. Skrive inn inn levert utstyr, tittel og feilbeskrivelse." $messageIcon = [System.Windows.MessageBoxImage]::Error [system.Windows.MessageBox]::Show($message,$messageIcon) return } if ($TextBox4.Text.length -ge 1 -and $TextBox5.Text.length -ge 1 -and $TextBox3.Text.length -ge 1) { if ($TextBox4.Text -ne $TextBox5.Text){ $message = "Sak blir ikke sendt inn da passordet i feltene er ikke like" $messageIcon = [System.Windows.MessageBoxImage]::Warning [system.Windows.MessageBox]::Show($message,$messageIcon) return }else{ $PassordInfo = @" Brukernavn: $($TextBox3.Text) Passord: $($TextBox4.Text) "@ } } VelgBruker #sørger for å finne contactid på bruker valgt bruker i combobox2 uten å måtte trykke på velg boksen. #$OCH = Get-AtwsAccount -AccountName 'Office Center Hønefoss AS' | 29684055 #$fred = (Get-AtwsResource -UserName Fred).id #$Role = Get-AtwsRole -Name Overvåkningskonsulent #Endre AssignedResource* til ingenting. Skal ikke bli satt på noen. if($combobox3.text){ $Lastname = $combobox3.text.split(' ')[-1] $firstname = $combobox3.text.Trim($Lastname).trim() $innmeldervar = $Global:Innmeldere.Where({$_.Firstname -eq $firstname -and $_.LastName -eq $Lastname}) if(!$innmeldervar){ $message = "Finner ikke ressurs, endre eller meld ifra til utvikler" $messageIcon = [System.Windows.MessageBoxImage]::Warning [system.Windows.MessageBox]::Show($message,$messageIcon) return } $innmelder_parms = @{ AssignedResourceID = ($innmeldervar).id AssignedResourceRoleID = ($innmeldervar).DefaultServiceDeskRoleID }}else{$innmelder_parms = @()} $ticket_parameters = @{ #AssignedResourceID = $bjørn #AssignedResourceRoleID = $Role.id ContactID = ($Script:Brukerinfo.id) AccountID = "$(($AtwsAccountImport | Select-Object AccountName, id | Where-Object {$_.AccountName -like $comboBox1.SelectedItem}).id)" #SelectedItem/Text DueDateTime = (Get-Date -Hour 12 -Minute 0 -Second 0).AddDays(7) QueueID = 'OCH - Support' TicketCategory = 'OCH-INNLEVERING' TicketType = 'Service Request' Priority = 'Medium' IssueType = 'Feilretting' Source = 'OCH - PowerShell' Title = "Serviceskjema - $($richTextBox3.Text)" Description = "$($richTextBox4.Text)" BusinessDivisionSubdivisionID = '14' } #$ticket_parameters.Values #Sjekker om det er en innmelder, og setter så status til registret om det er det IF($innmelder_parms){$ticket_parms_Status = @{Status = 'Registrert'}}else{$ticket_parms_Status = @{Status = 'Til Fordeling'}} $ticket = New-AtwsTicket @ticket_parameters @innmelder_parms @ticket_parms_Status write-output $ticket.TicketNumber if ($ticket) { #legger til saksinfo i fane nr3 for å kunne skrive ut på nytt ved behov $textBox1.Text = $Ticket.TicketNumber $textBox2.Text = $Ticket.Title #Hvis det er passordinfo blir det lagt til i saken. if ($PassordInfo){ $parms = @{ NoteType = 'Task Summary' Publish = 'Internal Project Team' TicketID = $ticket.id Title = "Brukernavn og passord til kunde" CreatorResourceID = '31395180' #bjørn Description = "$($PassordInfo)" } New-AtwsTicketNote @parms } $ticket | Set-atwsticket -UserDefinedFields $backupUDF $ticket | Set-atwsticket -UserDefinedFields $serviceUDF $ticket | Set-atwsticket -UserDefinedFields @{Name = 'OCH-UTSTYR';Value = "$($richTextBox2.Text)"} PrintUtDokument -TicketNumber $Ticket.TicketNumber #Tømmer felter ResetForm } }#function end #EndRegion function ResourceRoleToList(){ $combobox3.items.Clear() #$global:Innmeldere = Get-AtwsResource -LocationID 'Office Center Hønefoss AS' -Active $true -ResourceType Employee | where{$_.DefaultServiceDeskRoleID -eq 29682834} 3 stk -> = 27 $global:Innmeldere = Get-AtwsResource -LocationID 'Office Center Hønefoss AS' -active $true| where {$_.DefaultServiceDeskRoleID -ne $null} | sort FirstName foreach($x in $Innmeldere){ $Displayitem = $x.FirstName + ' ' + $x.LastName $combobox3.Items.Add($Displayitem) } $comboBox3.DroppedDown = $true; } function UpdateLastTicketTitle(){ $ticketnumber = $textbox1.text $ticket = get-atwsticket -TicketNumber $ticketnumber $textbox2.text = $ticket.Title if(!$ticket){ # $message = "Klarte ikke hente inn sak, den er nok slettet" # $messageIcon = [System.Windows.MessageBoxImage]::hand # [system.Windows.MessageBox]::Show($message,$messageIcon) $textbox2.text = "Fant ikke sak" return } } #Region function printdocument function printdocument { param ( $path ) Start-Process -FilePath $path –Verb Print -WindowStyle Hidden $message = "sak blir printet ut" $messageIcon = [System.Windows.MessageBoxImage]::hand [system.Windows.MessageBox]::Show($message,$messageIcon) } #EndRegion #er ikke brukt lenger. bruker ikke filer for utskrift, men henter info rett fra saken. #Depricated function printdocumentfromdir { $t = (Get-ChildItem ".\Utskrifter" | Sort-Object LastWriteTime | Select-Object -Last 1).ToString() write-output $t $fpath = ".\Utskrifter\$t" printdocument -path $fpath } function PrintUtDokument { param ( [Switch]$FraTicketNummer = $false, [string]$TicketNumber ) if ($FraTicketNummer -eq $true) { $ticket = @() $ticket = Get-AtwsTicket -TicketNumber $textBox1.Text $textBox1.Text = $ticket.TicketNumber $textBox2.Text = $ticket.Title }else{ $ticket = get-atwsticket -TicketNumber $TicketNumber } $doctable1 = @() $doctable2 = @() $doctable3 = @() $Contact = Get-AtwsContact -id $ticket.ContactID # $sakstype = $Ticket.Title.ToString().Substring($Ticket.Title.Length -7) $sakstype = $ticket.'#OCH-SERVICETYPE' if (($Ticket.'#OCH-BACKUP') -eq 'JA') {$Backup = $true}elseif(($Ticket.'#OCH-BACKUP') -eq 'NEI') {$Backup = $false} $description_BR = @" "@ $doctable1 = New-Object -TypeName psobject -Property @{ Firma = ($Script:AtwsAccountImport | Where-Object {$_.id -eq $Ticket.AccountID}).AccountName Kontaktperson = $Contact.FirstName + ' ' + $Contact.LastName Telefon = $Contact.Phone 'E-post' = $Contact.EMailAddress Saksnummer = $ticket.TicketNumber } $doctable2 = $ticket.Description.ToString() #$ticketLastActivityDate = Get-Date -Format g $doctable3 = New-Object -TypeName psobject -Property @{ ('Dato innlevert: {1} {0}' -f $ticket.LastActivityDate,$description_BR) = "Office Center signatur: ______________________" + ($description_BR) + "Kunde signatur:" + ($description_BR) + ($description_BR) ('Dato utlevert:{0}' -f $description_BR) = "Office Center signatur: ______________________" + ($description_BR) + "Kunde signatur: " + ($description_BR) + ($description_BR) } New-WordInstance -Visible $false New-WordDocument Add-WordText -text "Innlevering av utstyr til service" -WDBuiltinStyle wdStyleTitle Add-WordTable $doctable1 -WDTableFormat wdTableFormatSimple2 -WdAutoFitBehavior wdAutoFitWindow -VerticleTable Add-WordText -text "Service: [service] Garantisak: [garanti] Prisoverslag: [prisoverslag]" -Bold Add-WordText -text "Skal OCH ta backup av nødvendige data Ja [backupja] Nei [backupnei] " Add-WordText -text (@" Dette vil bli fakturert etter medgått tid. Ved garanti vil backup bli belastet med 500kr + mva. NB: Garantireparasjoner hvor disk byttes eller operativsystem settes opp på nytt, omfatter ikke garantien overføring av eksisterende data til ny disk eller nyinstallasjon av operativsystem. "@) Add-WordText -text $doctable2 Add-WordBreak -breaktype Paragraph #Add-WordTable $doctable3 -WDTableFormat wdTableFormatClassic1 -WdAutoFitBehavior wdAutoFitWindow -VerticleTable Add-WordTable $doctable3 -WDTableFormat wdTableFormatGrid1 -WdAutoFitBehavior wdAutoFitWindow -VerticleTable $Doc = Get-WordDocument if ($sakstype -eq "service") { ReplaceTag –Document $Doc -FindText '[service]' -replacewithtext "|X|" ReplaceTag –Document $Doc -FindText '[garanti]' -replacewithtext " " } if ($sakstype -eq "garanti") { ReplaceTag –Document $Doc -FindText '[garanti]' -replacewithtext "|X|" ReplaceTag –Document $Doc -FindText '[service]' -replacewithtext " " } ReplaceTag –Document $Doc -FindText '[prisoverslag]' -replacewithtext " " if($Backup -eq $true) { ReplaceTag –Document $Doc -FindText '[backupja]' -replacewithtext "|X|" ReplaceTag –Document $Doc -FindText '[backupnei]' -replacewithtext " " } else { ReplaceTag –Document $Doc -FindText '[backupnei]' -replacewithtext "|X|" ReplaceTag –Document $Doc -FindText '[backupja]' -replacewithtext " " } #bilde må legges til på slutten Add-WordShape -UserPicture $Logopath -left 20 -Top 20 -Width 170 -Height 50 -zorder msoBringInFrontOfText $wd= Get-WordDocument $wd.PrintOut() Close-WordDocument -SaveOptions wdDoNotSaveChanges Close-WordInstance -SaveOptions wdDoNotSaveChanges } Function ResetForm (){ $richTextBox2.Text = "" $richTextBox3.Text = "" $richTextBox4.Text = "" $textBox3.Text = "" $textBox4.Text = "" $textBox5.Text = "" } #Region Word functions Function OpenWordDoc ($Filename) { $Word = New-Object –comobject Word.Application Return $Word.documents.open($Filename) } Function SaveAsWordDoc ($Document, $FileName) { $Document.Saveas([REF]$Filename) $Document.close() } Function ReplaceTag ($Document, $FindText, $ReplaceWithText) { $FindReplace=$Document.ActiveWindow.Selection.Find #Kun 255 Antall karekterer $matchCase = $false; $matchWholeWord = $true; $matchWildCards = $false; $matchSoundsLike = $false; $matchAllWordForms = $false; $forward = $true; $format = $false; $matchKashida = $false; $matchDiacritics = $false; $matchAlefHamza = $false; $matchControl = $false; $read_only = $false; $visible = $true; $replace = 2; $wrap = 1; $FindReplace.Execute($findText, $matchCase, $matchWholeWord, $matchWildCards, $matchSoundsLike, $matchAllWordForms,$forward, $wrap, $format, $replaceWithText, $replace, $matchKashida ,$matchDiacritics, $matchAlefHamza, $matchControl) | Out-Null } #EndRegion #Region Vis og sjul konsollet # .Net methods for hiding/showing the console in the background Add-Type -Name Window -Namespace Console -MemberDefinition ' [DllImport("Kernel32.dll")] public static extern IntPtr GetConsoleWindow(); [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, Int32 nCmdShow); ' function ShowConsole { $consolePtr = [Console.Window]::GetConsoleWindow() # Hide = 0, # ShowNormal = 1, # ShowMinimized = 2, # ShowMaximized = 3, # Maximize = 3, # ShowNormalNoActivate = 4, # Show = 5, # Minimize = 6, # ShowMinNoActivate = 7, # ShowNoActivate = 8, # Restore = 9, # ShowDefault = 10, # ForceMinimized = 11 [Console.Window]::ShowWindow($consolePtr, 4) } function HideConsole { $consolePtr = [Console.Window]::GetConsoleWindow() #0 hide [Console.Window]::ShowWindow($consolePtr, 0) } #EndRegion #Generated Form Function function GenerateForm { ######################################################################## # Code Generated By: SAPIEN Technologies PrimalForms (Community Edition) v1.0.10.0 # Generated On: 27.11.2018 12:13 # Generated By: bjorn ######################################################################## #region Import the Assemblies [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null [reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.VisualBasic") | Out-Null #endregion #region Generated Form Objects $form1 = New-Object System.Windows.Forms.Form $tabControl1 = New-Object System.Windows.Forms.TabControl $tabPage1 = New-Object System.Windows.Forms.TabPage $groupBox2 = New-Object System.Windows.Forms.GroupBox $checkBox3 = New-Object System.Windows.Forms.CheckBox $label3 = New-Object System.Windows.Forms.Label $label23 = New-Object System.Windows.Forms.Label $label22 = New-Object System.Windows.Forms.Label $textBox5 = New-Object System.Windows.Forms.TextBox $textBox4 = New-Object System.Windows.Forms.TextBox $label21 = New-Object System.Windows.Forms.Label $label20 = New-Object System.Windows.Forms.Label $textBox3 = New-Object System.Windows.Forms.TextBox $label19 = New-Object System.Windows.Forms.Label $button9 = New-Object System.Windows.Forms.Button $comboBox3 = New-Object System.Windows.Forms.ComboBox $label15 = New-Object System.Windows.Forms.Label $groupBox1 = New-Object System.Windows.Forms.GroupBox $radioButton2 = New-Object System.Windows.Forms.RadioButton $radioButton1 = New-Object System.Windows.Forms.RadioButton $button8 = New-Object System.Windows.Forms.Button $button5 = New-Object System.Windows.Forms.Button $button4 = New-Object System.Windows.Forms.Button $richTextBox4 = New-Object System.Windows.Forms.RichTextBox $label6 = New-Object System.Windows.Forms.Label $richTextBox3 = New-Object System.Windows.Forms.RichTextBox $label5 = New-Object System.Windows.Forms.Label $richTextBox2 = New-Object System.Windows.Forms.RichTextBox $label4 = New-Object System.Windows.Forms.Label $label14 = New-Object System.Windows.Forms.Label $label11 = New-Object System.Windows.Forms.Label $label1 = New-Object System.Windows.Forms.Label $button3 = New-Object System.Windows.Forms.Button $button2 = New-Object System.Windows.Forms.Button $comboBox2 = New-Object System.Windows.Forms.ComboBox $comboBox1 = New-Object System.Windows.Forms.ComboBox $tabPage2 = New-Object System.Windows.Forms.TabPage $label13 = New-Object System.Windows.Forms.Label $label12 = New-Object System.Windows.Forms.Label $richTextBox8 = New-Object System.Windows.Forms.RichTextBox $richTextBox7 = New-Object System.Windows.Forms.RichTextBox $richTextBox6 = New-Object System.Windows.Forms.RichTextBox $richTextBox5 = New-Object System.Windows.Forms.RichTextBox $button6 = New-Object System.Windows.Forms.Button $label10 = New-Object System.Windows.Forms.Label $label9 = New-Object System.Windows.Forms.Label $label8 = New-Object System.Windows.Forms.Label $label7 = New-Object System.Windows.Forms.Label $tabPage3 = New-Object System.Windows.Forms.TabPage $button7 = New-Object System.Windows.Forms.Button $button1 = New-Object System.Windows.Forms.Button $textBox2 = New-Object System.Windows.Forms.TextBox $label18 = New-Object System.Windows.Forms.Label $label17 = New-Object System.Windows.Forms.Label $label16 = New-Object System.Windows.Forms.Label $textBox1 = New-Object System.Windows.Forms.TextBox $InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState #endregion Generated Form Objects #---------------------------------------------- #Generated Event Script Blocks #---------------------------------------------- #Provide Custom Code for events specified in PrimalForms. $HentSisteSakstittel_MouseUp= { UpdateLastTicketTitle } $velgbruker_button3_MouseUp= { VelgBruker } $viskonsoll_button5_MouseUp= { ShowConsole } $nybruker_button6_MouseUp= { NyBruker } $velgkunde_button2_MouseUp= { OppdaterBrukerListeInnhold } #depricated $skrivutsak_c_MouseUp= { printdocumentfromdir } $newticket_button4_MouseUp= { $message = "Sak blir registrert, felt blir nullstilt" $messageIcon = [System.Windows.MessageBoxImage]::Error [system.Windows.MessageBox]::Show($message,$messageIcon) NyTicket } $OppdaterKundeliste_button8_MouseUp= { OppdaterKundelisteFil } $handler_comboBox3_Click= { $comboBox3.DroppedDown = $true; } $handler_comboBox2_Click= { $comboBox2.DroppedDown = $true; } $handler_comboBox1_Click= { $comboBox1.DroppedDown = $true; } $handler_button1_MouseUp= { PrintUtDokument -FraTicketNummer $True } $HentSaksBehandlere_MouseUp= { ResourceRoleToList } $OnLoadForm_StateCorrection= {#Correct the initial state of the form to prevent the .Net maximized form issue $form1.WindowState = $InitialFormWindowState OppdaterKundeListeInnhold $radioButton1.Checked = $True HideConsole $Label15.Text = " " } #---------------------------------------------- #region Generated Form Code $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 763 $System_Drawing_Size.Width = 646 $form1.ClientSize = $System_Drawing_Size $form1.Cursor = [System.Windows.Forms.Cursors]::Arrow $form1.DataBindings.DefaultDataSourceUpdateMode = 0 $form1.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon("$($faviconpath)") $form1.MaximizeBox = $False $form1.Name = "form1" $form1.StartPosition = 1 $form1.Text = "Serviceskjema - OCH" $tabControl1.Cursor = [System.Windows.Forms.Cursors]::Arrow $tabControl1.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 12 $System_Drawing_Point.Y = 12 $tabControl1.Location = $System_Drawing_Point $tabControl1.Name = "tabControl1" $tabControl1.SelectedIndex = 0 $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 742 $System_Drawing_Size.Width = 629 $tabControl1.Size = $System_Drawing_Size $tabControl1.TabIndex = 0 $form1.Controls.Add($tabControl1) $tabPage1.Cursor = [System.Windows.Forms.Cursors]::Arrow $tabPage1.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 4 $System_Drawing_Point.Y = 22 $tabPage1.Location = $System_Drawing_Point $tabPage1.Name = "tabPage1" $System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding $System_Windows_Forms_Padding.All = 3 $System_Windows_Forms_Padding.Bottom = 3 $System_Windows_Forms_Padding.Left = 3 $System_Windows_Forms_Padding.Right = 3 $System_Windows_Forms_Padding.Top = 3 $tabPage1.Padding = $System_Windows_Forms_Padding $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 716 $System_Drawing_Size.Width = 621 $tabPage1.Size = $System_Drawing_Size $tabPage1.TabIndex = 0 $tabPage1.Text = "Serviceskjema" $tabPage1.UseVisualStyleBackColor = $True $tabControl1.Controls.Add($tabPage1) $groupBox2.DataBindings.DefaultDataSourceUpdateMode = 0 $groupBox2.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 235 $groupBox2.Location = $System_Drawing_Point $groupBox2.Name = "groupBox2" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 80 $System_Drawing_Size.Width = 292 $groupBox2.Size = $System_Drawing_Size $groupBox2.TabIndex = 39 $groupBox2.TabStop = $False $groupBox2.Text = "Ønskes backup?" $tabPage1.Controls.Add($groupBox2) $checkBox3.CheckAlign = 32 $checkBox3.Cursor = [System.Windows.Forms.Cursors]::Arrow $checkBox3.DataBindings.DefaultDataSourceUpdateMode = 0 $checkBox3.FlatAppearance.BorderSize = 3 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 32 $checkBox3.Location = $System_Drawing_Point $checkBox3.Name = "checkBox3" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 31 $System_Drawing_Size.Width = 32 $checkBox3.Size = $System_Drawing_Size $checkBox3.TabIndex = 8 $checkBox3.UseVisualStyleBackColor = $True $groupBox2.Controls.Add($checkBox3) $label3.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 54 $System_Drawing_Point.Y = 22 $label3.Location = $System_Drawing_Point $label3.Name = "label3" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 55 $System_Drawing_Size.Width = 237 $label3.Size = $System_Drawing_Size $label3.TabIndex = 11 $label3.Text = "Backup bli fakturert etter medgått tid. Ved garanti vil backup bli belastet med 500kr + mva." $label3.add_Click($handler_label3_Click) $groupBox2.Controls.Add($label3) $label23.DataBindings.DefaultDataSourceUpdateMode = 0 $label23.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 581 $label23.Location = $System_Drawing_Point $label23.Name = "label23" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 341 $label23.Size = $System_Drawing_Size $label23.TabIndex = 38 $label23.Text = "Brukernavn og passord fylles bare inn ved behov" $tabPage1.Controls.Add($label23) $label22.DataBindings.DefaultDataSourceUpdateMode = 0 $label22.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 428 $System_Drawing_Point.Y = 624 $label22.Location = $System_Drawing_Point $label22.Name = "label22" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 173 $label22.Size = $System_Drawing_Size $label22.TabIndex = 36 $label22.Text = "Skriv inn passord igjen:" $tabPage1.Controls.Add($label22) $textBox5.DataBindings.DefaultDataSourceUpdateMode = 0 $textBox5.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 428 $System_Drawing_Point.Y = 650 $textBox5.Location = $System_Drawing_Point $textBox5.Name = "textBox5" $textBox5.PasswordChar = '•' $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 22 $System_Drawing_Size.Width = 181 $textBox5.Size = $System_Drawing_Size $textBox5.TabIndex = 15 $tabPage1.Controls.Add($textBox5) $textBox4.DataBindings.DefaultDataSourceUpdateMode = 0 $textBox4.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 216 $System_Drawing_Point.Y = 650 $textBox4.Location = $System_Drawing_Point $textBox4.Name = "textBox4" $textBox4.PasswordChar = '•' $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 22 $System_Drawing_Size.Width = 156 $textBox4.Size = $System_Drawing_Size $textBox4.TabIndex = 14 $tabPage1.Controls.Add($textBox4) $label21.DataBindings.DefaultDataSourceUpdateMode = 0 $label21.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 216 $System_Drawing_Point.Y = 627 $label21.Location = $System_Drawing_Point $label21.Name = "label21" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 20 $System_Drawing_Size.Width = 100 $label21.Size = $System_Drawing_Size $label21.TabIndex = 33 $label21.Text = "Passord:" $tabPage1.Controls.Add($label21) $label20.DataBindings.DefaultDataSourceUpdateMode = 0 $label20.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 624 $label20.Location = $System_Drawing_Point $label20.Name = "label20" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 120 $label20.Size = $System_Drawing_Size $label20.TabIndex = 32 $label20.Text = "Brukernavn:" $tabPage1.Controls.Add($label20) $textBox3.DataBindings.DefaultDataSourceUpdateMode = 0 $textBox3.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 650 $textBox3.Location = $System_Drawing_Point $textBox3.Name = "textBox3" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 22 $System_Drawing_Size.Width = 156 $textBox3.Size = $System_Drawing_Size $textBox3.TabIndex = 13 $tabPage1.Controls.Add($textBox3) $label19.DataBindings.DefaultDataSourceUpdateMode = 0 $label19.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 129 $label19.Location = $System_Drawing_Point $label19.Name = "label19" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 100 $label19.Size = $System_Drawing_Size $label19.TabIndex = 30 $label19.Text = "Tekniker:" $tabPage1.Controls.Add($label19) $button9.Cursor = [System.Windows.Forms.Cursors]::Arrow $button9.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 482 $System_Drawing_Point.Y = 131 $button9.Location = $System_Drawing_Point $button9.Name = "button9" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 127 $button9.Size = $System_Drawing_Size $button9.TabIndex = 6 $button9.Text = "Hent Saksbehandlere" $button9.UseVisualStyleBackColor = $True $button9.add_Click($button9_OnClick) $button9.add_MouseUp($HentSaksBehandlere_MouseUp) $button9.add_ $tabPage1.Controls.Add($button9) $comboBox3.Cursor = [System.Windows.Forms.Cursors]::Arrow $comboBox3.DataBindings.DefaultDataSourceUpdateMode = 0 $comboBox3.DropDownHeight = 250 $comboBox3.FormattingEnabled = $True $comboBox3.IntegralHeight = $False $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 136 $System_Drawing_Point.Y = 131 $comboBox3.Location = $System_Drawing_Point $comboBox3.Name = "comboBox3" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 21 $System_Drawing_Size.Width = 339 $comboBox3.Size = $System_Drawing_Size $comboBox3.TabIndex = 5 $comboBox3.add_Click($handler_comboBox3_Click) $tabPage1.Controls.Add($comboBox3) $label15.DataBindings.DefaultDataSourceUpdateMode = 0 $label15.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 135 $System_Drawing_Point.Y = 77 $label15.Location = $System_Drawing_Point $System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding $System_Windows_Forms_Padding.Bottom = 0 $System_Windows_Forms_Padding.Left = 0 $System_Windows_Forms_Padding.Right = 0 $System_Windows_Forms_Padding.Top = 5 $label15.Margin = $System_Windows_Forms_Padding $label15.Name = "label15" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 51 $System_Drawing_Size.Width = 350 $label15.Size = $System_Drawing_Size $label15.TabIndex = 26 $label15.Text = "Kontaktinformasjon" $tabPage1.Controls.Add($label15) $groupBox1.DataBindings.DefaultDataSourceUpdateMode = 0 $groupBox1.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 317 $System_Drawing_Point.Y = 235 $groupBox1.Location = $System_Drawing_Point $groupBox1.Name = "groupBox1" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 80 $System_Drawing_Size.Width = 292 $groupBox1.Size = $System_Drawing_Size $groupBox1.TabIndex = 22 $groupBox1.TabStop = $False $groupBox1.Text = "Sakstype" $groupBox1.add_Enter($handler_groupBox1_Enter) $tabPage1.Controls.Add($groupBox1) $radioButton2.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 119 $System_Drawing_Point.Y = 32 $radioButton2.Location = $System_Drawing_Point $radioButton2.Name = "radioButton2" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 24 $System_Drawing_Size.Width = 84 $radioButton2.Size = $System_Drawing_Size $radioButton2.TabIndex = 10 $radioButton2.TabStop = $True $radioButton2.Text = "Garanti" $radioButton2.UseVisualStyleBackColor = $True $groupBox1.Controls.Add($radioButton2) $radioButton1.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 25 $System_Drawing_Point.Y = 32 $radioButton1.Location = $System_Drawing_Point $radioButton1.Name = "radioButton1" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 24 $System_Drawing_Size.Width = 84 $radioButton1.Size = $System_Drawing_Size $radioButton1.TabIndex = 9 $radioButton1.TabStop = $True $radioButton1.Text = "Service" $radioButton1.UseVisualStyleBackColor = $True $groupBox1.Controls.Add($radioButton1) $button8.Cursor = [System.Windows.Forms.Cursors]::Arrow $button8.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 216 $System_Drawing_Point.Y = 680 $button8.Location = $System_Drawing_Point $button8.Name = "button8" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 156 $button8.Size = $System_Drawing_Size $button8.TabIndex = 17 $button8.Text = "Oppdater kundelister" $button8.UseVisualStyleBackColor = $True $button8.add_Click($button8_OnClick) $button8.add_MouseUp($OppdaterKundeliste_button8_MouseUp) $tabPage1.Controls.Add($button8) $button5.Cursor = [System.Windows.Forms.Cursors]::Arrow $button5.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 428 $System_Drawing_Point.Y = 680 $button5.Location = $System_Drawing_Point $button5.Name = "button5" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 181 $button5.Size = $System_Drawing_Size $button5.TabIndex = 18 $button5.Text = "Vis konsoll" $button5.UseVisualStyleBackColor = $True $button5.add_Click($button5_OnClick) $button5.add_MouseUp($viskonsoll_button5_MouseUp) $tabPage1.Controls.Add($button5) $button4.Cursor = [System.Windows.Forms.Cursors]::Arrow $button4.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 678 $button4.Location = $System_Drawing_Point $button4.Name = "button4" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 155 $button4.Size = $System_Drawing_Size $button4.TabIndex = 16 $button4.Text = "Lagre" $button4.UseVisualStyleBackColor = $True $button4.add_Click($button4_OnClick) $button4.add_MouseUp($newticket_button4_MouseUp) $tabPage1.Controls.Add($button4) $richTextBox4.DataBindings.DefaultDataSourceUpdateMode = 0 $richTextBox4.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 435 $richTextBox4.Location = $System_Drawing_Point $richTextBox4.Name = "richTextBox4" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 143 $System_Drawing_Size.Width = 603 $richTextBox4.Size = $System_Drawing_Size $richTextBox4.TabIndex = 12 $richTextBox4.Text = "" $tabPage1.Controls.Add($richTextBox4) $label6.DataBindings.DefaultDataSourceUpdateMode = 0 $label6.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 409 $label6.Location = $System_Drawing_Point $label6.Name = "label6" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 94 $label6.Size = $System_Drawing_Size $label6.TabIndex = 37 $label6.Text = "Feilbeskrivelse" $tabPage1.Controls.Add($label6) $richTextBox3.DataBindings.DefaultDataSourceUpdateMode = 0 $richTextBox3.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 190 $richTextBox3.Location = $System_Drawing_Point $richTextBox3.Multiline = $False $richTextBox3.Name = "richTextBox3" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 30 $System_Drawing_Size.Width = 603 $richTextBox3.Size = $System_Drawing_Size $richTextBox3.TabIndex = 7 $richTextBox3.Text = "" $tabPage1.Controls.Add($richTextBox3) $label5.DataBindings.DefaultDataSourceUpdateMode = 0 $label5.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 164 $label5.Location = $System_Drawing_Point $label5.Name = "label5" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 97 $label5.Size = $System_Drawing_Size $label5.TabIndex = 14 $label5.Text = "Sakstittel" $tabPage1.Controls.Add($label5) $richTextBox2.DataBindings.DefaultDataSourceUpdateMode = 0 $richTextBox2.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",10,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 357 $richTextBox2.Location = $System_Drawing_Point $richTextBox2.Name = "richTextBox2" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 40 $System_Drawing_Size.Width = 603 $richTextBox2.Size = $System_Drawing_Size $richTextBox2.TabIndex = 11 $richTextBox2.Text = "" $tabPage1.Controls.Add($richTextBox2) $label4.DataBindings.DefaultDataSourceUpdateMode = 0 $label4.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 331 $label4.Location = $System_Drawing_Point $label4.Name = "label4" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 120 $label4.Size = $System_Drawing_Size $label4.TabIndex = 12 $label4.Text = "Innlevert utstyr" $tabPage1.Controls.Add($label4) $label14.DataBindings.DefaultDataSourceUpdateMode = 0 $label14.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 53 $label14.Location = $System_Drawing_Point $label14.Name = "label14" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 120 $label14.Size = $System_Drawing_Size $label14.TabIndex = 25 $label14.Text = "Kontaktperson:" $tabPage1.Controls.Add($label14) $label11.DataBindings.DefaultDataSourceUpdateMode = 0 $label11.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 11 $label11.Location = $System_Drawing_Point $label11.Name = "label11" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 120 $label11.Size = $System_Drawing_Size $label11.TabIndex = 24 $label11.Text = "Kunde:" $tabPage1.Controls.Add($label11) $label1.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 118 $System_Drawing_Point.Y = 534 $label1.Location = $System_Drawing_Point $label1.Name = "label1" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 43 $label1.Size = $System_Drawing_Size $label1.TabIndex = 23 $label1.add_Click($handler_label1_Click) $tabPage1.Controls.Add($label1) $button3.Cursor = [System.Windows.Forms.Cursors]::Arrow $button3.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 481 $System_Drawing_Point.Y = 53 $button3.Location = $System_Drawing_Point $button3.Name = "button3" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 128 $button3.Size = $System_Drawing_Size $button3.TabIndex = 4 $button3.Text = "Hent kontakt info" $button3.UseVisualStyleBackColor = $True $button3.add_Click($button3_OnClick) $button3.add_MouseUp($velgbruker_button3_MouseUp) $tabPage1.Controls.Add($button3) $button2.Cursor = [System.Windows.Forms.Cursors]::Arrow $button2.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 481 $System_Drawing_Point.Y = 12 $button2.Location = $System_Drawing_Point $button2.Name = "button2" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 128 $button2.Size = $System_Drawing_Size $button2.TabIndex = 2 $button2.Text = "Hent kontakter" $button2.UseVisualStyleBackColor = $True $button2.add_Click($button2_OnClick) $button2.add_MouseUp($velgkunde_button2_MouseUp) $tabPage1.Controls.Add($button2) $comboBox2.Cursor = [System.Windows.Forms.Cursors]::Arrow $comboBox2.DataBindings.DefaultDataSourceUpdateMode = 0 $comboBox2.DropDownHeight = 250 $comboBox2.FormattingEnabled = $True $comboBox2.IntegralHeight = $False $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 135 $System_Drawing_Point.Y = 53 $comboBox2.Location = $System_Drawing_Point $comboBox2.Name = "comboBox2" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 21 $System_Drawing_Size.Width = 340 $comboBox2.Size = $System_Drawing_Size $comboBox2.TabIndex = 3 $comboBox2.add_Click($handler_comboBox2_Click) $tabPage1.Controls.Add($comboBox2) $comboBox1.Cursor = [System.Windows.Forms.Cursors]::Arrow $comboBox1.DataBindings.DefaultDataSourceUpdateMode = 0 $comboBox1.DropDownHeight = 250 $comboBox1.FormattingEnabled = $True $comboBox1.IntegralHeight = $False $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 135 $System_Drawing_Point.Y = 12 $comboBox1.Location = $System_Drawing_Point $comboBox1.Name = "comboBox1" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 21 $System_Drawing_Size.Width = 340 $comboBox1.Size = $System_Drawing_Size $comboBox1.TabIndex = 1 $comboBox1.add_Click($handler_comboBox1_Click) $tabPage1.Controls.Add($comboBox1) $tabPage2.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 4 $System_Drawing_Point.Y = 22 $tabPage2.Location = $System_Drawing_Point $tabPage2.Name = "tabPage2" $System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding $System_Windows_Forms_Padding.All = 3 $System_Windows_Forms_Padding.Bottom = 3 $System_Windows_Forms_Padding.Left = 3 $System_Windows_Forms_Padding.Right = 3 $System_Windows_Forms_Padding.Top = 3 $tabPage2.Padding = $System_Windows_Forms_Padding $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 716 $System_Drawing_Size.Width = 621 $tabPage2.Size = $System_Drawing_Size $tabPage2.TabIndex = 1 $tabPage2.Text = "Ny bruker" $tabPage2.UseVisualStyleBackColor = $True $tabControl1.Controls.Add($tabPage2) $label13.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 200 $System_Drawing_Point.Y = 154 $label13.Location = $System_Drawing_Point $label13.Name = "label13" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 113 $label13.Size = $System_Drawing_Size $label13.TabIndex = 13 $label13.Text = "..." $label13.TextAlign = 16 $tabPage2.Controls.Add($label13) $label12.DataBindings.DefaultDataSourceUpdateMode = 0 $label12.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 124 $System_Drawing_Point.Y = 155 $label12.Location = $System_Drawing_Point $label12.Name = "label12" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 56 $label12.Size = $System_Drawing_Size $label12.TabIndex = 12 $label12.Text = "Status:" $label12.TextAlign = 16 $tabPage2.Controls.Add($label12) $richTextBox8.DataBindings.DefaultDataSourceUpdateMode = 0 $richTextBox8.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 109 $richTextBox8.Location = $System_Drawing_Point $richTextBox8.Multiline = $False $richTextBox8.Name = "richTextBox8" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 28 $System_Drawing_Size.Width = 365 $richTextBox8.Size = $System_Drawing_Size $richTextBox8.TabIndex = 19 $richTextBox8.Text = "" $tabPage2.Controls.Add($richTextBox8) $richTextBox7.DataBindings.DefaultDataSourceUpdateMode = 0 $richTextBox7.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 378 $System_Drawing_Point.Y = 35 $richTextBox7.Location = $System_Drawing_Point $richTextBox7.Multiline = $False $richTextBox7.Name = "richTextBox7" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 28 $System_Drawing_Size.Width = 200 $richTextBox7.Size = $System_Drawing_Size $richTextBox7.TabIndex = 18 $richTextBox7.Text = "" $tabPage2.Controls.Add($richTextBox7) $richTextBox6.DataBindings.DefaultDataSourceUpdateMode = 0 $richTextBox6.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 179 $System_Drawing_Point.Y = 35 $richTextBox6.Location = $System_Drawing_Point $richTextBox6.Multiline = $False $richTextBox6.Name = "richTextBox6" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 28 $System_Drawing_Size.Width = 193 $richTextBox6.Size = $System_Drawing_Size $richTextBox6.TabIndex = 17 $richTextBox6.Text = "" $tabPage2.Controls.Add($richTextBox6) $richTextBox5.DataBindings.DefaultDataSourceUpdateMode = 0 $richTextBox5.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 36 $richTextBox5.Location = $System_Drawing_Point $richTextBox5.Multiline = $False $richTextBox5.Name = "richTextBox5" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 27 $System_Drawing_Size.Width = 162 $richTextBox5.Size = $System_Drawing_Size $richTextBox5.TabIndex = 16 $richTextBox5.Text = "" $tabPage2.Controls.Add($richTextBox5) $button6.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 154 $button6.Location = $System_Drawing_Point $button6.Name = "button6" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 112 $button6.Size = $System_Drawing_Size $button6.TabIndex = 20 $button6.Text = "Lagre" $button6.UseVisualStyleBackColor = $True $button6.add_Click($button6_OnClick) $button6.add_MouseUp($nybruker_button6_MouseUp) $tabPage2.Controls.Add($button6) $label10.DataBindings.DefaultDataSourceUpdateMode = 0 $label10.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 83 $label10.Location = $System_Drawing_Point $label10.Name = "label10" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 100 $label10.Size = $System_Drawing_Size $label10.TabIndex = 3 $label10.Text = "E-Post" $tabPage2.Controls.Add($label10) $label9.DataBindings.DefaultDataSourceUpdateMode = 0 $label9.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 378 $System_Drawing_Point.Y = 9 $label9.Location = $System_Drawing_Point $label9.Name = "label9" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 126 $label9.Size = $System_Drawing_Size $label9.TabIndex = 2 $label9.Text = "Telefonnummer" $tabPage2.Controls.Add($label9) $label8.DataBindings.DefaultDataSourceUpdateMode = 0 $label8.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 179 $System_Drawing_Point.Y = 9 $label8.Location = $System_Drawing_Point $label8.Name = "label8" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 100 $label8.Size = $System_Drawing_Size $label8.TabIndex = 1 $label8.Text = "Etternavn" $tabPage2.Controls.Add($label8) $label7.DataBindings.DefaultDataSourceUpdateMode = 0 $label7.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 9 $label7.Location = $System_Drawing_Point $label7.Name = "label7" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 100 $label7.Size = $System_Drawing_Size $label7.TabIndex = 0 $label7.Text = "Fornavn" $tabPage2.Controls.Add($label7) $tabPage3.Cursor = [System.Windows.Forms.Cursors]::Arrow $tabPage3.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 4 $System_Drawing_Point.Y = 22 $tabPage3.Location = $System_Drawing_Point $tabPage3.Name = "tabPage3" $System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding $System_Windows_Forms_Padding.All = 3 $System_Windows_Forms_Padding.Bottom = 3 $System_Windows_Forms_Padding.Left = 3 $System_Windows_Forms_Padding.Right = 3 $System_Windows_Forms_Padding.Top = 3 $tabPage3.Padding = $System_Windows_Forms_Padding $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 716 $System_Drawing_Size.Width = 621 $tabPage3.Size = $System_Drawing_Size $tabPage3.TabIndex = 2 $tabPage3.Text = "Siste utskrift" $tabPage3.UseVisualStyleBackColor = $True $tabControl1.Controls.Add($tabPage3) $button7.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 193 $System_Drawing_Point.Y = 64 $button7.Location = $System_Drawing_Point $button7.Name = "button7" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 422 $button7.Size = $System_Drawing_Size $button7.TabIndex = 29 $button7.Text = "Hent Siste Sakstittel" $button7.UseVisualStyleBackColor = $True $button7.add_Click($button7_OnClick) $button7.add_MouseUp($HentSisteSakstittel_MouseUp) $tabPage3.Controls.Add($button7) $button1.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 64 $button1.Location = $System_Drawing_Point $button1.Name = "button1" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 171 $button1.Size = $System_Drawing_Size $button1.TabIndex = 28 $button1.Text = "Skriv ut skjema fra ticket" $button1.UseVisualStyleBackColor = $True $button1.add_Click($button1_OnClick) $button1.add_MouseUp($handler_button1_MouseUp) $tabPage3.Controls.Add($button1) $textBox2.DataBindings.DefaultDataSourceUpdateMode = 0 $textBox2.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 193 $System_Drawing_Point.Y = 36 $textBox2.Location = $System_Drawing_Point $textBox2.Name = "textBox2" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 22 $System_Drawing_Size.Width = 422 $textBox2.Size = $System_Drawing_Size $textBox2.TabIndex = 4 $tabPage3.Controls.Add($textBox2) $label18.DataBindings.DefaultDataSourceUpdateMode = 0 $label18.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 193 $System_Drawing_Point.Y = 10 $label18.Location = $System_Drawing_Point $label18.Name = "label18" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 304 $label18.Size = $System_Drawing_Size $label18.TabIndex = 3 $label18.Text = "Siste Sakstittel" $tabPage3.Controls.Add($label18) $label17.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = -8 $System_Drawing_Point.Y = -13 $label17.Location = $System_Drawing_Point $label17.Name = "label17" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 100 $label17.Size = $System_Drawing_Size $label17.TabIndex = 2 $label17.Text = "label17" $tabPage3.Controls.Add($label17) $label16.DataBindings.DefaultDataSourceUpdateMode = 0 $label16.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11.25,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 10 $label16.Location = $System_Drawing_Point $label16.Name = "label16" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 $System_Drawing_Size.Width = 150 $label16.Size = $System_Drawing_Size $label16.TabIndex = 1 $label16.Text = "Siste ticketnummer" $tabPage3.Controls.Add($label16) $textBox1.DataBindings.DefaultDataSourceUpdateMode = 0 $textBox1.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,0,3,1) $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 6 $System_Drawing_Point.Y = 36 $textBox1.Location = $System_Drawing_Point $textBox1.Name = "textBox1" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 22 $System_Drawing_Size.Width = 171 $textBox1.Size = $System_Drawing_Size $textBox1.TabIndex = 0 $tabPage3.Controls.Add($textBox1) #endregion Generated Form Code #Save the initial state of the form $InitialFormWindowState = $form1.WindowState #Init the OnLoad event to correct the initial state of the form $form1.add_Load($OnLoadForm_StateCorrection) #Show the Form $form1.ShowDialog()| Out-Null } #End Function #Call the Function GenerateForm } |