【发布时间】:2018-12-24 21:43:15
【问题描述】:
我正在使用 Visual Studio 为我的所有 PowerShell 脚本创建一个 GUI 环境,以创建一个通用平台。我的文本框有一个问题。我想要一个文本框,以便所有结果都出现在那里。现在只有最后一个命令出现在那里。
有什么建议吗?
<TextBox x:Name="Information" HorizontalAlignment="Left" Margin="10,116,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Grid.ColumnSpan="3" Height="255" Width="678"/>
我希望在这个 texbox 上显示以下消息
$WPFMapping.Add_Click({
{
$WPFInformation.Text = " We Will try to map the drives"}
if (((New-Object System.IO.DriveInfo("N:")).DriveType -ne
"NoRootDirectory"))
{
$WPFInformation.Text = " N drive is already mounted and accessible"}
else {
net use /persistent:yes N: "this drive"
Write-Host "mounting"}
if (((New-Object System.IO.DriveInfo("V:")).DriveType -ne
"NoRootDirectory"))
{
$WPFInformation.Text = " V drive is already mounted and accessible"}
else {
$WPFInformation.Text = " V drive mapping in progress"}
net use /persistent:yes V: "this drive"
$WPFInformation.Text = " V drive mapping has been completed"
})
【问题讨论】:
-
有什么代码可以分享吗?
-
没有显示代码的相关部分,我怀疑是否有人能够回答这个问题..
-
我会尝试分享一部分代码但不知道是否有帮助