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'
}
$ConfigPath = (Get-InstalledModule OCHAutotaskForm).InstalledLocation
$faviconpath = ($ConfigPath + '\favicon.ico').ToString()
$Logopath = ($ConfigPath + '\logo.png').ToString()


#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

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
    }
    
}
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 | 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 =  'Brukernavn: ' + $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()
{
    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 = @{}
    }
        $user = New-AtwsContact @newuserparams @phone @EMailAddress

    if ($user) {
        $label13.Text = 'OK'
    }
    else
    {
        $label13.Text = 'failed'
    }

}


#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 = @()
    $backupinfo = @()
    $sakstype = @()
    $Script:Backup = @()
    $Script:Service = @()
    $Script:Garanti = @()

    #sjekker om knapper er checked
    if("$($radioButton1.Checked)" -eq $true)
    {
        $Script:Service = $true
    }
    else {
        $Script:Service = $false
    }
    if("$($radioButton2.Checked)" -eq $true)
    {
        $Script:Garanti = $true
    }
    else {
        $Script:Garanti = $false
    }
    if("$($checkBox3.CheckState)" -eq "Checked")
    {
        $Script:Backup = $true
    }
    else {
        $Script:Backup = $false
    }

    if ($Script:Service -eq $false -and $Script:Garanti -eq $false)
    {
        Write-Warning "velg en type sak"
        $message =  "Du må velge type sak."
        $messageIcon = [System.Windows.MessageBoxImage]::Error
        [system.Windows.MessageBox]::Show($message,$messageIcon)
        return
    }

    #sjekker om Service og garanti er aktiv.
    if ($Script:Garanti -eq $true -and $Script:Service -eq $true)
    {
        Write-Warning "Ikke velg mer en en type sak | SERVICE | GARANTI"
        $message =  "Ikke velg mer enn en type sak"
        $messageIcon = [System.Windows.MessageBoxImage]::Error
        [system.Windows.MessageBox]::Show($message,$messageIcon)
        return
    }

    #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
    }


    VelgBruker #sørger for å finne contactid på bruker valgt bruker i combobox2 uten å måtte trykke på velg boksen.

    #sjekker om det er backup sak eller ikke
    if($Script:Backup -eq $true)
    {
        $backupinfo = "Det skal tas backup - bruker er informert om pris. <backupja>"
    }
    else {
        $backupinfo = "Backup skal ikke gjennomføres. <backupnei>"
    }

    $description_BR = "
    "

    #sjekker om det er service eller garantisak
    If ($Script:Service -eq $true)
    {
        $sakstype = "service"

    }elseif ($Script:Garanti -eq $true) {
        $sakstype = "garanti"
    }

    #$OCH = Get-AtwsAccount -AccountName 'Office Center Hønefoss AS'
    #$fred = (Get-AtwsResource -UserName Fred).id
    #$bjørn = (Get-AtwsResource -UserName bjorn).id
    #$kenneth = (Get-AtwsResource -UserName kenneth).id
    #$lj = (Get-AtwsResource -UserName larsj).id
    #$Role = Get-AtwsRole -Name Overvåkningskonsulent

    #Endre AssignedResource* til ingenting. Skal ikke bli satt på noen.
    $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 - Teknikere'
        TicketCategory = 'OCH-INNLEVERING'
        TicketType = 'Service Request'
        Status = 'New'
        Priority = 'Medium'
        IssueType = 'Feilretting'
        Source = 'OCH - PowerShell'
        Title = "Serviceskjema - $($richTextBox3.Text) - $($sakstype)"
        Description = "$("Innlevert Utstyr: " + $($description_BR) + $($richTextBox2.Text) + $description_BR + "Feilbeskrivelse:" + $description_BR + $($richTextBox4.Text) + $($description_BR) + $($backupinfo))"
    }
    #$ticket_parameters.Values

    $ticket = New-AtwsTicket @ticket_parameters
    write-output $ticket.TicketNumber

    if ($ticket)
    {
        $textBox1.Text = $Ticket.TicketNumber
        $textBox2.Text = $Ticket.Title

        PrintUtDokument
    }

}#function end
#EndRegion

#Region function printdocument
function printdocument {
    param (
        $path
    )
    Start-Process -FilePath $path â€“Verb Print -WindowStyle Hidden

}
#EndRegion

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
    )

    if ($FraTicketNummer -eq $true)
    {
        $ticket = @()
        $ticket = Get-AtwsTicket -TicketNumber $textBox1.Text
        $textBox1.Text = $ticket.TicketNumber
        $textBox2.Text = $ticket.Title
    }
    $doctable1 = @()
    $doctable2 = @()
    $doctable3 = @()
        $Contact = Get-AtwsContact -id $ticket.ContactID
        $sakstype = $Ticket.Title.ToString().Substring($Ticket.Title.Length -7)
        if (($Ticket.Description.ToString().Substring($Ticket.Description.ToString().Length -10))-eq '<backupja>') {$Backup = $true}
        if (($Ticket.Description.ToString().Substring($Ticket.Description.ToString().Length -11))-eq '<backupnei>') {$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) + "______________________"
        }


        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
}


#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
    #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
$pictureBox1 = New-Object System.Windows.Forms.PictureBox
$label15 = 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
$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
$button7 = 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
$label3 = New-Object System.Windows.Forms.Label
$checkBox3 = New-Object System.Windows.Forms.CheckBox
$label2 = 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
$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.
$velgbruker_button3_MouseUp=
{
    VelgBruker

}

$viskonsoll_button5_MouseUp=
{
    ShowConsole

}

$nybruker_button6_MouseUp=
{
    NyBruker

}

$velgkunde_button2_MouseUp=
{
    OppdaterBrukerListeInnhold

}

$skrivutsak_button7_MouseUp=
{
    printdocumentfromdir

}

$newticket_button4_MouseUp=
{
    NyTicket

}

$OppdaterKundeliste_button8_MouseUp=
{
    OppdaterKundelisteFil

}

$handler_comboBox2_Click=
{
     $comboBox2.DroppedDown = $true;

}

$handler_comboBox1_Click=
{
    $comboBox1.DroppedDown = $true;

}

$handler_button1_MouseUp=
{
    PrintUtDokument -FraTicketNummer $True

}

$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 = 618
$System_Drawing_Size.Width = 789
$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]::Hand
$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 = 594
$System_Drawing_Size.Width = 765
$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 = 568
$System_Drawing_Size.Width = 757
$tabPage1.Size = $System_Drawing_Size
$tabPage1.TabIndex = 0
$tabPage1.Text = "Serviceskjema"
$tabPage1.UseVisualStyleBackColor = $True

$tabControl1.Controls.Add($tabPage1)
$pictureBox1.BackColor = [System.Drawing.Color]::FromArgb(255,220,220,220)

$pictureBox1.BackgroundImageLayout = 0
$pictureBox1.BorderStyle = 1
$pictureBox1.DataBindings.DefaultDataSourceUpdateMode = 0

$pictureBox1.Image = [System.Drawing.Image]::FromFile("$($Logopath)")

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 192
$System_Drawing_Point.Y = 514
$pictureBox1.Location = $System_Drawing_Point
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 100
$System_Drawing_Size.Width = 200
$pictureBox1.MaximumSize = $System_Drawing_Size
$pictureBox1.Name = "pictureBox1"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 43
$System_Drawing_Size.Width = 119
$pictureBox1.Size = $System_Drawing_Size
$pictureBox1.SizeMode = 4
$pictureBox1.TabIndex = 27
$pictureBox1.TabStop = $False

$tabPage1.Controls.Add($pictureBox1)

$label15.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 135
$System_Drawing_Point.Y = 90
$label15.Location = $System_Drawing_Point
$label15.Name = "label15"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 24
$System_Drawing_Size.Width = 473
$label15.Size = $System_Drawing_Size
$label15.TabIndex = 26
$label15.Text = "Her vises kontaktinfo"

$tabPage1.Controls.Add($label15)

$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 = 116
$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 = 116
$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)


$groupBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 400
$System_Drawing_Point.Y = 128
$groupBox1.Location = $System_Drawing_Point
$groupBox1.Name = "groupBox1"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 52
$System_Drawing_Size.Width = 208
$groupBox1.Size = $System_Drawing_Size
$groupBox1.TabIndex = 22
$groupBox1.TabStop = $False
$groupBox1.Text = "Sakstype"

$tabPage1.Controls.Add($groupBox1)

$radioButton2.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 101
$System_Drawing_Point.Y = 20
$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 = 104
$radioButton2.Size = $System_Drawing_Size
$radioButton2.TabIndex = 1
$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 = 7
$System_Drawing_Point.Y = 20
$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 = 104
$radioButton1.Size = $System_Drawing_Size
$radioButton1.TabIndex = 0
$radioButton1.TabStop = $True
$radioButton1.Text = "Service"
$radioButton1.UseVisualStyleBackColor = $True

$groupBox1.Controls.Add($radioButton1)



$button8.Cursor = [System.Windows.Forms.Cursors]::Hand
$button8.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 400
$System_Drawing_Point.Y = 534
$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 = 122
$button8.Size = $System_Drawing_Size
$button8.TabIndex = 21
$button8.Text = "Oppdater kundelister"
$button8.UseVisualStyleBackColor = $True
$button8.add_Click($button8_OnClick)
$button8.add_MouseUp($OppdaterKundeliste_button8_MouseUp)

$tabPage1.Controls.Add($button8)


$button7.Cursor = [System.Windows.Forms.Cursors]::Hand
$button7.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 632
$System_Drawing_Point.Y = 534
$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 = 107
$button7.Size = $System_Drawing_Size
$button7.TabIndex = 20
$button7.Text = "Skriv ut siste sak"
$button7.UseVisualStyleBackColor = $True
$button7.add_Click($button7_OnClick)
$button7.add_MouseUp($skrivutsak_button7_MouseUp)

$tabPage1.Controls.Add($button7)


$button5.Cursor = [System.Windows.Forms.Cursors]::Hand
$button5.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 532
$System_Drawing_Point.Y = 534
$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 = 73
$button5.Size = $System_Drawing_Size
$button5.TabIndex = 19
$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]::Hand
$button4.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 6
$System_Drawing_Point.Y = 534
$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 = 94
$button4.Size = $System_Drawing_Size
$button4.TabIndex = 18
$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 = 363
$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 = 602
$richTextBox4.Size = $System_Drawing_Size
$richTextBox4.TabIndex = 17
$richTextBox4.Text = ""

$tabPage1.Controls.Add($richTextBox4)

$label6.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 3
$System_Drawing_Point.Y = 337
$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 = 16
$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 = 291
$richTextBox3.Location = $System_Drawing_Point
$richTextBox3.Name = "richTextBox3"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 30
$System_Drawing_Size.Width = 599
$richTextBox3.Size = $System_Drawing_Size
$richTextBox3.TabIndex = 15
$richTextBox3.Text = ""

$tabPage1.Controls.Add($richTextBox3)

$label5.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 6
$System_Drawing_Point.Y = 265
$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 = 209
$richTextBox2.Location = $System_Drawing_Point
$richTextBox2.Name = "richTextBox2"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 41
$System_Drawing_Size.Width = 602
$richTextBox2.Size = $System_Drawing_Size
$richTextBox2.TabIndex = 13
$richTextBox2.Text = ""

$tabPage1.Controls.Add($richTextBox2)

$label4.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 3
$System_Drawing_Point.Y = 183
$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)

$label3.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 135
$System_Drawing_Point.Y = 128
$label3.Location = $System_Drawing_Point
$label3.Name = "label3"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 52
$System_Drawing_Size.Width = 176
$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."

$tabPage1.Controls.Add($label3)


$checkBox3.Cursor = [System.Windows.Forms.Cursors]::Hand
$checkBox3.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 99
$System_Drawing_Point.Y = 128
$checkBox3.Location = $System_Drawing_Point
$checkBox3.Name = "checkBox3"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 24
$System_Drawing_Size.Width = 30
$checkBox3.Size = $System_Drawing_Size
$checkBox3.TabIndex = 10
$checkBox3.UseVisualStyleBackColor = $True

$tabPage1.Controls.Add($checkBox3)

$label2.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 3
$System_Drawing_Point.Y = 133
$label2.Location = $System_Drawing_Point
$label2.Name = "label2"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 32
$System_Drawing_Size.Width = 100
$label2.Size = $System_Drawing_Size
$label2.TabIndex = 9
$label2.Text = "Ønskes backup?"

$tabPage1.Controls.Add($label2)


$button3.Cursor = [System.Windows.Forms.Cursors]::Hand
$button3.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 632
$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 = 107
$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]::Hand
$button2.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 632
$System_Drawing_Point.Y = 10
$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 = 105
$button2.Size = $System_Drawing_Size
$button2.TabIndex = 3
$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]::Hand
$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 = 473
$comboBox2.Size = $System_Drawing_Size
$comboBox2.TabIndex = 2
$comboBox2.add_SelectedIndexChanged($handler_comboBox2_SelectedIndexChanged)
$comboBox2.add_Click($handler_comboBox2_Click)

$tabPage1.Controls.Add($comboBox2)

$comboBox1.Cursor = [System.Windows.Forms.Cursors]::Hand
$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 = 473
$comboBox1.Size = $System_Drawing_Size
$comboBox1.TabIndex = 1
$comboBox1.add_Click($handler_comboBox1_Click)

$tabPage1.Controls.Add($comboBox1)


$tabPage2.Cursor = [System.Windows.Forms.Cursors]::Arrow
$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 = 568
$System_Drawing_Size.Width = 757
$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 = 179
$System_Drawing_Point.Y = 155
$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

$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 = 44
$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.Name = "richTextBox8"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 39
$System_Drawing_Size.Width = 365
$richTextBox8.Size = $System_Drawing_Size
$richTextBox8.TabIndex = 10
$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 = 29
$richTextBox7.Location = $System_Drawing_Point
$richTextBox7.Name = "richTextBox7"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 39
$System_Drawing_Size.Width = 200
$richTextBox7.Size = $System_Drawing_Size
$richTextBox7.TabIndex = 9
$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 = 29
$richTextBox6.Location = $System_Drawing_Point
$richTextBox6.Name = "richTextBox6"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 39
$System_Drawing_Size.Width = 193
$richTextBox6.Size = $System_Drawing_Size
$richTextBox6.TabIndex = 8
$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 = 30
$richTextBox5.Location = $System_Drawing_Point
$richTextBox5.Name = "richTextBox5"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 38
$System_Drawing_Size.Width = 162
$richTextBox5.Size = $System_Drawing_Size
$richTextBox5.TabIndex = 7
$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 = 6
$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

$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

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 377
$System_Drawing_Point.Y = 3
$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 = 100
$label9.Size = $System_Drawing_Size
$label9.TabIndex = 2
$label9.Text = "Telefonnummer"

$tabPage2.Controls.Add($label9)

$label8.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 179
$System_Drawing_Point.Y = 3
$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 = "Ëtternavn"

$tabPage2.Controls.Add($label8)

$label7.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 6
$System_Drawing_Point.Y = 3
$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 = 568
$System_Drawing_Size.Width = 757
$tabPage3.Size = $System_Drawing_Size
$tabPage3.TabIndex = 2
$tabPage3.Text = "Siste utskrift"
$tabPage3.UseVisualStyleBackColor = $True

$tabControl1.Controls.Add($tabPage3)

$button1.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 6
$System_Drawing_Point.Y = 81
$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 = 198
$button1.Size = $System_Drawing_Size
$button1.TabIndex = 5
$button1.Text = "Skriv ut skjema fra ticketnummer"
$button1.UseVisualStyleBackColor = $True
$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,0)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 210
$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 = 260
$textBox2.Size = $System_Drawing_Size
$textBox2.TabIndex = 4

$tabPage3.Controls.Add($textBox2)

$label18.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 210
$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 = 100
$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

$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 = 100
$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,0)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 6
$System_Drawing_Point.Y = 37
$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 = 137
$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
}