System.Windows.Forms.ComboBoxStyle 无法找到类型 | Powershell

huangapple go评论77阅读模式
英文:

System.Windows.Forms.ComboBoxStyle Unable to find type | Powershell

问题

I'm currently creating a tool for my IT department in PowerShell.
I'm new to programming so I google and ask AI sometimes (I already asked AI and googled about this issue but neither could help).

My problem is about System.Windows.Forms.ComboBoxStyle being marked red even though the System.Windows.Forms is imported at the top. But all normal GUI components (which also need System.Windows.Forms) work. When I try to run it I also get an error saying

ParserError: Just some file path\LeihgeraeteManager\LeihgeraeteManager.ps1:175:45
Line |
 175 |  … eDropdown.DropDownStyle = [System.Windows.Forms.ComboBoxStyle]::DropD …
     |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to find type [System.Windows.Forms.ComboBoxStyle].

The weird thing is that when I run the line

Add-Type -AssemblyName System.Windows.Forms

at the top of the script manually (select and F8 in Visual Studio Code), it works after that. When I restart Visual Studio Code it won't work again until I do that.

I already tried it in the normal PowerShell ISE Editor but I get the same results there.

I use PowerShell Version 7.3.6 btw.

Here is the full code I've written so far if it helps (It's not finished yet + I've censored some file paths and Names due to data protection of internal stuff):

#############################################################
$FilePath = "Example" #Change this if the CSV Path changed
$ScriptVersion = 0.1.0.0 #Change this if it's a new version
#############################################################

Add-Type -AssemblyName System.Windows.Forms

function Write-Log($Message, $Path = $PSScriptRoot + "\", $Debug = $true, $reset = $false) {
    if ($reset -eq $True) {
        if (Test-Path -Path ($Path + "log.txt")) { # Check if File already exists
            Remove-Item -Path ($Path + "log.txt")
            return #Exit function
        }
    }

    if ($Debug) {Write-Debug $Message} # Write Debug
    $Path = $Path + "log.txt" # Add Filename to Text
    if (Test-Path -Path $Path) { # Check if File already exists
    } else {
        New-Item -Path $Path -ItemType File -Force | Out-Null #Creating new File
        Add-Content -Path $Path -Value "[dd-MM HH:mm:ss]" #Adding first line
    }
    $CurrentDate = Get-Date -Format "dd-MM HH:mm:ss" #Getting date
    $LogMessage = "[$CurrentDate] $Message" #Adding Date and message together
    Add-Content -Path $Path -Value $LogMessage #Adding the Message to the log file
}

function PopUpWindow ($WindowTitle, $WindowText, $WindowWidth = 250, $WindowHeight = 200) { 

    <#
    .SYNOPSIS
    Simple function for creating 
    #>


    $PopUp = New-Object System.Windows.Forms.Form
    $PopUp.Width = $WindowWidth
    $PopUp.Height = $WindowHeight
    $PopUp.Text = "$WindowTitle"
    $PopUp.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedSingle #Locking window size
    $PopUp.MaximizeBox = $false #Disabling Maximize Button
    $PopUp.MinimizeBox = $false #Disabling Minimize Button

    $PopUpText = New-Object System.Windows.Forms.Label
    $PopUpText.Location = New-Object System.Drawing.Point(10,10)
    $PopUpText.AutoSize = $true
    $PopUpText.Text = "$($WindowText)"

    $PopUp.Controls.Add($PopUpText)

    $ButtonLocationWidth = (($WindowWidth - 65) / 2)
    $ButtonLocationHeight = ($WindowHeight - 70)

    $PopupCancelButton = new-object System.Windows.Forms.Button   # Creating the "Start" button
    $PopupCancelButton.Location = New-Object System.Drawing.Point($ButtonLocationWidth, $ButtonLocationHeight)
    $PopupCancelButton.Size = New-Object System.Drawing.Size(60, 25)
    $PopupCancelButton.Text = 'Close'
    $PopupCancelButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
    $PopUp.AcceptButton = $PopupCancelButton

    $PopUp.Controls.Add($PopupCancelButton)

    [void]$PopUp.ShowDialog()
}

function Get-FileAvailable($Path){

    if (Test-Path -Path $Path) { # If file exists...
        $IsAvail = $true # ... set variable to true
    } else {$IsAvail = $false} # If not then set to false

    return $IsAvail # Return the result
}

Write-Log -reset $true # Deleting old Log file if there is one
Write-Log "Started script and set functions" #Log
class Manager{ # Manager is saving all of the device objects and has all important Functions
    hidden [array]$Devices #Device Array

    AddDevice() { # This function simply creates a new device with the given data
        Write-Log "Starting AddWindow GUI creation..."
        $AddWindow = New-Object System.Windows.Forms.Form
        $AddWindow.Width = 1000
        $AddWindow.Height = 1000
        $AddWindow.Text = "Enter Information"
        Write-Log "Defined Window"

        #Computer Name
        $AddWindowTextCN = New-Object System.Windows.Forms.Label
        $AddWindowTextCN.Location = New-Object System.Drawing.Point(50,30)
        $AddWindowTextCN.Size = New-Object System.Drawing.Size(200,15)
        $AddWindowTextCN.Text = "Enter Device Name:"

        $AddWindowBoxCN = New-Object System.Windows.Forms.TextBox 
        $AddWindowBoxCN.Location = New-Object System.Drawing.Point(50,50)
        $AddWindowBoxCN.Size = New-Object System.Drawing.Size(260,20)
        $AddWindowBoxCN.Text = "NBW03"

        $AddWindow.Controls.Add($AddWindowTextCN)
        $AddWindow.Controls.Add($AddWindowBoxCN)

        #Model
        $AddWindowTextM = New-Object System.Windows.Forms.Label
        $AddWindowTextM.Location = New-Object System.Drawing.Point(50,80)
        $AddWindowTextM.Size = New-Object System.Drawing.Size(200,15)
        $AddWindowTextM.Text = "Enter Device Model:"

        $AddWindowBoxM = New-Object System.Windows.Forms.TextBox
        $AddWindowBoxM.Location = New-Object System.Drawing.Point(50,100)
        $AddWindowBoxM.Size = New-Object System.Drawing.Size(260,20)
        $AddWindowBoxM.Text = ""

        $AddWindow.Controls.Add($AddWindowTextM)
        $AddWindow.Controls.Add($AddWindowBoxM)

        #Serial Number
        $AddWindowTextSN = New-Object System.Windows.Forms.Label
        $AddWindowTextSN.Location = New-Object System.Drawing.Point(50,130)
        $AddWindowTextSN.Size = New-Object System.Drawing.Size(200,15)
        $AddWindowTextSN.Text = "Enter Serial Number:"

        $AddWindow

<details>
<summary>英文:</summary>

I&#39;m currently creating a tool for my IT department in PowerShell.
I&#39;m new to programming so I google and ask AI sometimes (I already asked AI and googled about this issue but neither could help).

My problem is about System.Windows.Forms.ComboBoxStyle being marked red even though the System.Windows.Forms is imported at the top. But all normal GUI components (which also need System.Windows.Forms) work. When I try to run it I also get an error saying 

ParserError: Just some file path\LeihgeraeteManager\LeihgeraeteManager.ps1:175:45
Line |
175 | … eDropdown.DropDownStyle = [System.Windows.Forms.ComboBoxStyle]::DropD …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to find type [System.Windows.Forms.ComboBoxStyle].


The weird thing is that when I run the line 

Add-Type -AssemblyName System.Windows.Forms

at the top of the script manually (select and F8 in Visual Studio Code), it works after that.
When I restart Visual Studio Code it won&#39;t work again until I do that.
I already tried it in the normal PowerShell ISE Editor but I get the same results there.
I use PowerShell Version 7.3.6 btw.
Here is the full code I&#39;ve written so far if it helps (It&#39;s not finished yet + I&#39;ve censored some file paths and Names due to data protection of internal stuff): 

#############################################################
$FilePath = "Example" #Change this if the CSV Path changed
$ScriptVersion = 0.1.0.0 #Change this if it's a new version
#############################################################

Add-Type -AssemblyName System.Windows.Forms

function Write-Log($Message, $Path = $PSScriptRoot + "&quot;, $Debug = $true, $reset = $false) {
if ($reset -eq $True) {
if (Test-Path -Path ($Path + "log.txt")) { # Check if File already exists
Remove-Item -Path ($Path + "log.txt")
return #Exit function
}
}

if ($Debug) {Write-Debug $Message} # Write Debug
$Path = $Path + &quot;log.txt&quot; # Add Filename to Text
if (Test-Path -Path $Path) { # Check if File already exists
} else {
New-Item -Path $Path -ItemType File -Force | Out-Null #Creating new File
Add-Content -Path $Path -Value &quot;[dd-MM HH:mm:ss]&quot; #Adding first line
}
$CurrentDate = Get-Date -Format &quot;dd-MM HH:mm:ss&quot; #Getting date
$LogMessage = &quot;[$CurrentDate] $Message&quot; #Adding Date and message together
Add-Content -Path $Path -Value $LogMessage #Adding the Message to the log file

}

function PopUpWindow ($WindowTitle, $WindowText, $WindowWidth = 250, $WindowHeight = 200) {

&lt;#
.SYNOPSIS
Simple function for creating 
#&gt;
$PopUp = New-Object System.Windows.Forms.Form
$PopUp.Width = $WindowWidth
$PopUp.Height = $WindowHeight
$PopUp.Text = &quot;$WindowTitle&quot;
$PopUp.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedSingle #Locking window size
$PopUp.MaximizeBox = $false #Disabling Maximize Button
$PopUp.MinimizeBox = $false #Disabling Minimize Button
$PopUpText = New-Object System.Windows.Forms.Label
$PopUpText.Location = New-Object System.Drawing.Point(10,10)
$PopUpText.AutoSize = $true
$PopUpText.Text = &quot;$($WindowText)&quot;
$PopUp.Controls.Add($PopUpText)
$ButtonLocationWidth = (($WindowWidth - 65) / 2)
$ButtonLocationHeight = ($WindowHeight - 70)
$PopupCancelButton = new-object System.Windows.Forms.Button   # Creating the &quot;Start&quot; button
$PopupCancelButton.Location = New-Object System.Drawing.Point($ButtonLocationWidth, $ButtonLocationHeight)
$PopupCancelButton.Size = New-Object System.Drawing.Size(60, 25)
$PopupCancelButton.Text = &#39;Close&#39;
$PopupCancelButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
$PopUp.AcceptButton = $PopupCancelButton
$PopUp.Controls.Add($PopupCancelButton)
[void]$PopUp.ShowDialog()

}

function Get-FileAvailable($Path){

if (Test-Path -Path $Path) { # If file exists...
$IsAvail = $true # ... set variable to true
} else {$IsAvail = $false} # If not then set to false
return $IsAvail # Return the result

}

Write-Log -reset $true # Deleting old Log file if there is one
Write-Log "Started script and set functions" #Log
class Manager{ # Manager is saving all of the device objects and has all important Fuctions
hidden [array]$Devices #Device Array

AddDevice() { # This function simply creates a new device with the given data
Write-Log &quot;Starting AddWindow GUI creation...&quot;
$AddWindow = New-Object System.Windows.Forms.Form
$AddWindow.Width = 1000
$AddWindow.Height = 1000
$AddWindow.Text = &quot;Enter Information&quot;
Write-Log &quot;Defined Window&quot;
#Computer Name
$AddWindowTextCN = New-Object System.Windows.Forms.Label
$AddWindowTextCN.Location = New-Object System.Drawing.Point(50,30)
$AddWindowTextCN.Size = New-Object System.Drawing.Size(200,15)
$AddWindowTextCN.Text = &quot;Enter Device Name:&quot;
$AddWindowBoxCN = New-Object System.Windows.Forms.TextBox 
$AddWindowBoxCN.Location = New-Object System.Drawing.Point(50,50)
$AddWindowBoxCN.Size = New-Object System.Drawing.Size(260,20)
$AddWindowBoxCN.Text = &quot;NBW03&quot;
$AddWindow.Controls.Add($AddWindowTextCN)
$AddWindow.Controls.Add($AddWindowBoxCN)
#Model
$AddWindowTextM = New-Object System.Windows.Forms.Label
$AddWindowTextM.Location = New-Object System.Drawing.Point(50,80)
$AddWindowTextM.Size = New-Object System.Drawing.Size(200,15)
$AddWindowTextM.Text = &quot;Enter Device Model:&quot;
$AddWindowBoxM = New-Object System.Windows.Forms.TextBox
$AddWindowBoxM.Location = New-Object System.Drawing.Point(50,100)
$AddWindowBoxM.Size = New-Object System.Drawing.Size(260,20)
$AddWindowBoxM.Text = &quot;&quot;
$AddWindow.Controls.Add($AddWindowTextM)
$AddWindow.Controls.Add($AddWindowBoxM)
#Serial Number
$AddWindowTextSN = New-Object System.Windows.Forms.Label
$AddWindowTextSN.Location = New-Object System.Drawing.Point(50,130)
$AddWindowTextSN.Size = New-Object System.Drawing.Size(200,15)
$AddWindowTextSN.Text = &quot;Enter Serial Number:&quot;
$AddWindowBoxSN = New-Object System.Windows.Forms.TextBox
$AddWindowBoxSN.Location = New-Object System.Drawing.Point(50,150)
$AddWindowBoxSN.Size = New-Object System.Drawing.Size(260,20)
$AddWindowBoxSN.Text = &quot;&quot;
$AddWindow.Controls.Add($AddWindowTextSN)
$AddWindow.Controls.Add($AddWindowBoxSN)
#Owner
$AddWindowTextO = New-Object System.Windows.Forms.Label
$AddWindowTextO.Location = New-Object System.Drawing.Point(50,130)
$AddWindowTextO.Size = New-Object System.Drawing.Size(200,15)
$AddWindowTextO.Text = &quot;Enter Manager of Device:&quot;
$AddWindowBoxO = New-Object System.Windows.Forms.TextBox
$AddWindowBoxO.Location = New-Object System.Drawing.Point(50,50)
$AddWindowBoxO.Size = New-Object System.Drawing.Size(260,20)
$AddWindowBoxO.Text = &quot;&quot;
$AddWindow.Controls.Add($AddWindowTextO)
$AddWindow.Controls.Add($AddWindowBoxO)
$AddWindow.ShowDialog()
#$newDevice = [Leihgeraete]::new($ComputerName, $Model, $SerialNumber, $Owner, $InstallHinweis)
Write-Log &quot;Adding new Device&quot; #Log
#$this.Devices += $newDevice # Adds the new device to array
Write-Log &quot;Added new device to device array&quot; #Log
}
RemoveDevice(){
Write-Log &quot;Starting RemoveWindow GUI creation...&quot; #Log
$RemoveWindow = New-Object System.Windows.Forms.Form #Window to choose the device
$RemoveWindow.Width = 475
$RemoveWindow.Height = 200
$RemoveWindow.Text = &quot;Choose Device&quot;
Write-Log &quot;Defined Window&quot; #Log
$ChooseRemDevText = New-Object System.Windows.Forms.Label # New Text for the Window
$ChooseRemDevText.Location = New-Object System.Drawing.Point(50,30)
$ChooseRemDevText.Size = New-Object System.Drawing.Size(400,15)
$ChooseRemDevText.Text = &quot;Choose Computer to delete:&quot;
Write-Log &quot;Added Text&quot; #Log
$RemoveWindow.Controls.Add($ChooseRemDevText) # Adding Text to the window
$RemDeviceDropdown = New-Object System.Windows.Forms.ComboBox # Creating the dropdown menu to choose device
$RemDeviceDropdown.Location = New-Object System.Drawing.Point(50,50)
$RemDeviceDropdown.Width = 340
$RemDeviceDropdown.DropDownStyle = [System.Windows.Forms.ComboBoxStyle]::DropDownList # Setting Style so User can&#39;t enter custom things
$RemDeviceDropdown.Items.Add(&quot;&lt;None&gt;&quot;) # Adding Default Choice
foreach ($device in $this.Devices) { # Adding all Names to menu that are in devices array
$RemDeviceDropdown.Items.Add($device.ComputerName)
}
$RemDeviceDropdown.SelectedIndex = 0 # Setting &lt;None&gt; to default
$RemoveWindow.Controls.Add($RemDeviceDropdown)
Write-Log &quot;Added and filled Dropdown Menu&quot; #Log
Write-Log &quot;Creating Buttons...&quot; #Log
$DeleteButton = new-object System.Windows.Forms.Button   # Creating the &quot;Delete&quot; button
$DeleteButton.Location = &#39;90, 100&#39;
$DeleteButton.Size = &#39;100, 40&#39;
$DeleteButton.Text = &#39;Delete&#39;
$DeleteButton.Add_Click({ #Runs when button is clicked
Write-Log &quot;Delete button pressed&quot; #Log
[string]$selectedDeviceDel = $RemDeviceDropdown.SelectedItem # Saving selected device
if ($selectedDeviceDel -ne &quot;&lt;None&gt;&quot;) {
Write-Log &quot;Selected device is not &lt;None&gt;&quot; #Log
$RemoveWindowConf = New-Object System.Windows.Forms.Form #Window to confirm the deletion
$RemoveWindowConf.Width = 350
$RemoveWindowConf.Height = 200
$RemoveWindowConf.Text = &quot;Confirm&quot;
Write-Log &quot;Created new confirmation Window&quot; #Log
$ConfText = New-Object System.Windows.Forms.Label # Confirm Text
$ConfText.Location = New-Object System.Drawing.Point(50, 30)
$ConfText.Size = New-Object System.Drawing.Size(160, 15)
$ConfText.Text = &quot;Do you really want to delete &quot;
Write-Log &quot;Added Text&quot; #Log
$SelectedDeviceDelText = New-Object System.Windows.Forms.Label # Adding Computer Name in Bold for better reading
$SelectedDeviceDelText.Location = New-Object System.Drawing.Point(210, 30)
$SelectedDeviceDelText.Size = New-Object System.Drawing.Size(50, 15)
$SelectedDeviceDelText.Text = $selectedDeviceDel
$SelectedDeviceDelText.Font = [System.Drawing.Font]::new($SelectedDeviceDelText.Font, [System.Drawing.FontStyle]::Bold)
Write-Log &quot;Added Device Name&quot; #Log
$RemoveWindowConf.Controls.Add($ConfText)
$RemoveWindowConf.Controls.Add($SelectedDeviceDelText)
$ConfButtonY = new-object System.Windows.Forms.Button   # Creating the &quot;YES&quot; button
$ConfButtonY.Location = &#39;50, 80&#39;
$ConfButtonY.Size = &#39;100, 40&#39;
$ConfButtonY.Text = &#39;YES&#39;
Write-Log &quot;Creating Buttons&quot; #Log
$ConfButtonY.Add_Click({ # When click Yes the run the deletion process
Write-Log &quot;Clicked on Yes on confirm Window&quot; #Log
$updatedDevices = @()
$deviceRemoved = $false
foreach ($device in $Manager.Devices) { #Check if chosen device is in the array and deletes it after that
[string]$StrDev = $device.ComputerName # Converting Name to string
if ($StrDev -ne $selectedDeviceDel) {
$updatedDevices += $device
Write-Log &quot;Added $device to new temporary array&quot; #Log
} else {
$deviceRemoved = $true
Write-Log &quot;Not added $device to new temporary array because it has the same value as the selected Device&quot; #Log
}
}
if ($deviceRemoved) {
$Manager.Devices = $updatedDevices # Writing updated array in the original one
Write-Log &quot;Replaced array in Manager class&quot; #Log
}
$RemoveWindowConf.Close() # Closing Windows
$RemoveWindow.Close()
})
$ConfButtonN = new-object System.Windows.Forms.Button # Creating &quot;no&quot; button
$ConfButtonN.Location = &#39;180, 80&#39;
$ConfButtonN.Size = &#39;100, 40&#39;
$ConfButtonN.Text = &#39;NO&#39;
$ConfButtonN.Add_Click({
$RemoveWindowConf.Close()
Write-Log &quot;Canceled Confirmation for Deletion&quot; #Log
})
$RemoveWindowConf.Controls.Add($ConfButtonY)
$RemoveWindowConf.Controls.Add($ConfButtonN)
$RemoveWindowConf.ShowDialog()
} else {
Write-Host &quot;Please choose a Computer from the List!&quot; # Informing user if they haven&#39;t changed from &quot;&lt;None&gt;&quot;
Write-Log &quot;Selected device is &lt;None&gt;&quot; #Log
}
})
$RemoveWindow.AcceptButton = $DeleteButton #Pressing enter will be the same as clicking on &quot;Delete&quot;
$RemoveWindow.Controls.Add($DeleteButton)  #Adding the button to the Window
Write-Log &quot;Creating Cancel Button for Main Delete Window&quot; #Log
$DelCancelButton = new-object System.Windows.Forms.Button # Pressing Button that will close the deletion window
$DelCancelButton.Location = &#39;220, 100&#39;
$DelCancelButton.Size = &#39;100, 40&#39;
$DelCancelButton.Text = &#39;Cancel&#39;
$DelCancelButton.Add_Click({ #Runs when button is clicked
$RemoveWindow.Close()
})
$RemoveWindow.Controls.Add($DelCancelButton)
Write-Log &quot;Showing Window...&quot; #Log
$RemoveWindow.ShowDialog()
}

}

class Leihgeraete{ #Examples
[string]$ComputerName #Example
[datetime]$SinceWhen #1.1.2023
[datetime]$UntilWhen #2.2.2023
[string]$Model #Example
[bool]$InUse #true or false
[string]$UsedBy #Example
[string]$SerialNumber #SNRAD9012
[string]$Owner #Example
[string]$InstallHinweis #Example
[string]$BookHinweis #Praktikant

Leihgeraete($ComputerName, $Model, $SerialNumber, $Owner, $InstallHinweis){ # Function for creating new Leihgeraete Object
$this.ComputerName = $ComputerName
$this.Model = $Model
$this.SerialNumber = $SerialNumber
$this.Owner = $Owner
$this.InstallHinweis = $InstallHinweis
Write-Log &quot;[Class:Leihgeraete] Created new Leihgeraet&quot; #Log
}

}

$Manager = [Manager]::new() # Creating Manager
Write-Log "Created Manager" #Log

Test

$Manager.AddDevice("Name","Model","SN","Own","Hinw")
$Manager.AddDevice("Namea","Modeaal","SNa","Owan","Hinwa")


I tried using different ways but none of them was fitting for my needs.
I also tried starting an extra job for adding the System.Windows.Forms but this resulted in my GUI elements also not working.
</details>
# 答案1
**得分**: 0
这是PowerShell中的一个错误:https://github.com/PowerShell/PowerShell/issues/2074
在那里的点源解决方法对我有效,但仅适用于ISE,而不适用于VS Code,所以如果使用ISE而不是VS Code可以的话,你可以使用它。
所以你可以创建另一个脚本文件,其中只包含以下内容:
Add-Type -AssemblyName 'System.Windows.Forms'
然后将该文件点源到你的类方法的顶部,如下所示:
AddDevice() { # 这个函数只是使用给定的数据创建一个新设备
. .\AddType.ps1
Write-Log "Starting AddWindow GUI creation..."
$AddWindow = New-Object System.Windows.Forms.Form
方法的其余部分.......
这目前只在当前目录下有效,但你可以将那个点源文件放在任何你想要的地方。
<details>
<summary>英文:</summary>
This is a bug in PowerShell: https://github.com/PowerShell/PowerShell/issues/2074
The workaround on there for dot sourcing worked for me, but only in ISE, not VS code, so you could use that, if using ISE instead of VS Code is ok.
So you create another script file with literally just this in it:
Add-Type -AssemblyName &#39;System.Windows.Forms&#39;
then add that file dot sourced to the top of your class methods like:
AddDevice() { # This function simply creates a new device with the given data
. .\AddType.ps1
Write-Log &quot;Starting AddWindow GUI creation...&quot;
$AddWindow = New-Object System.Windows.Forms.Form
rest of method.......
That currently just works off the current directory, but you could keep that dot sourced file where ever you want.
</details>

huangapple
  • 本文由 发表于 2023年7月27日 19:59:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76779520.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定