小编Ton*_*oni的帖子

Node js,process.env不读取环境变量

尽管我可以看到在 Windows 上创建了环境变量,但process.env始终返回undefined. 我确实设置了所有变量,当我手动检查它们时,它们都出现在提示中,但process.env始终保持未定义状态。

PS 我没有管理员权限,除非我检查process.env.NODE_ENV.

在此输入图像描述

javascript windows json var node.js

7
推荐指数
1
解决办法
1万
查看次数

消息框按钮文本

我环顾四周,似乎所有内容都可以在 MessageBox 中编辑,将按钮上的文本栏(WPF /C#)

MessageBox.Show("Generic Message", "Caption",
    MessageBoxButton.YesNoCancel, MessageBoxImage.Warning)
Run Code Online (Sandbox Code Playgroud)

有没有办法更改“是”、“否”、“取消”文本,或者我是否需要编写一个窗口MessageBox来完成此操作?(这样做没有任何问题;我只是想知道 WPF 中是否有办法)。

c# wpf text messagebox

6
推荐指数
1
解决办法
1万
查看次数

如何使用资源字典中 <Styles.Resources> 中定义的资源

我有一个资源字典,它是在其上定义的数据网格样式以及该数据网格样式内的样式。

<Style TargetType="{x:Type DataGrid}" x:Key="CatalogDataGrid">
    <Style.Resources>
        <Style TargetType="{x:Type DataGridCell}" x:Key="RightAlignedDataGridCell">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                        <Border
                            Padding="5,0"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            SnapsToDevicePixels="True">
                            <ContentPresenter
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            VerticalAlignment="Center"
                            HorizontalAlignment="Right"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Style.Resources>
</Style>
Run Code Online (Sandbox Code Playgroud)

然后在我的 XAML 中我尝试使用RightAlignedDataGridCell以使我的列右对齐。

<DataGrid... Style="{StaticResource CatalogDataGrid}">
    <DataGrid.Columns>
        <DataGridTextColumn Header="Name" Binding="{Binding Name}">
        </DataGridTextColumn>
        <DataGridTextColumn Header="Total" Binding="{Binding Total}"
                            CellStyle="{StaticResource RightAlignedDataGridCell}">
        </DataGridTextColumn>
    </DataGrid.Columns>
</DataGrid>
Run Code Online (Sandbox Code Playgroud)

当我运行我的应用程序时,我收到资源未找到异常。如果我将该样式放在资源字典根上。它可以工作。但我想RightAlignedDataGridCell留在 <Style.Resources>里面CatalogDataGrid。

如何RightAlignedDataGridCell在我的 XAML 上使用它而不将其移动到资源字典根目录?

提前致谢。

wpf xaml resourcedictionary

5
推荐指数
1
解决办法
2万
查看次数

将 powershell 更新到最新版本

我在不同的机器上有两个不同的 PowerShell 版本。本地有以下一种:

主要的 次要的 建造 修订
5 1 17763 1007

虚拟机有以下一个:

主要的 次要的 建造 修订
5 1 17763 771

如您所见,它具有相同的:Major、Minor 和 Build 值,但 Revision 值除外。我不确定它是否是命令失败的原因:

Register-PSRepository -Name $RepoKeyName -SourceLocation $RepoKeyValue
    -PublishLocation $RepoKeyValue -InstallationPolicy Trusted -Verbose
Run Code Online (Sandbox Code Playgroud)

上面的代码片段在本地机器上可以正常工作,但在虚拟机上不能正常工作,并且在虚拟机中失败并出现以下错误:

parameter 'SourceLocation' is an invalid Web Uri. Please ensure that it meets the Web Uri requirements.

这就是我想将虚拟机中的 PowerShell 更新为最新修订值的原因。怎么做?

powershell

5
推荐指数
4
解决办法
1万
查看次数

WPFToolkit DataGrid:突出显示修改的行

有没有办法突出显示 a 上所有修改的行DataGrid?由于网格绑定到 aSystem.Data.DataTable我想我也许能够将每行的颜色绑定到它RowState(下面的示例),但这似乎不起作用。

有任何想法吗?

xmlns:data="clr-namespace:System.Data;assembly=System.Data"
<Style x:Key="DataGridRowStyle" TargetType="{x:Type toolkit:DataGridRow}">
    <Style.Triggers>
        <Trigger Property="IsSelected" Value="true">
            <Setter Property="Background" Value="Blue" />
        </Trigger>
        <DataTrigger Binding="{Binding RowState}"
                     Value="{x:Static data:DataRowState.Modified}">
            <Setter Property="Background" Value="LightYellow" />
        </DataTrigger>
    </Style.Triggers>
</Style>
Run Code Online (Sandbox Code Playgroud)

c# wpf datagrid wpftoolkit

4
推荐指数
1
解决办法
5017
查看次数

如何使用 PnP PowerShell 检索大型 SharePoint 库中的所有列表项

我有一个图书馆,里面有大约 25k 个项目。我有一个 csv,其中有几个文件夹,我想向它们授予项目级别权限。但首先,要做到这一点,我需要从图书馆中检索所有项目。正如预期的那样,我收到有关管理员强制执行的阈值限制的错误。我想知道是否有办法通过 PnP 解决这个问题。

我基本上曾经Get-PnPListItem -List Documents-PageSize 1000尝试限制一次返回的项目数量,但我仍然收到错误消息。我也尝试了下面的代码,但caml query;也不起作用。

$filename = test.docx
Get-PnPListItem -List Documents -Query
"<View><Query><Where><Eq><FieldRef Name='FileLeafRef'/>
<Value Type='File'>' +$filename+ '</Value></Eq></Where></Query></View>"
Run Code Online (Sandbox Code Playgroud)

我只期望显示一个结果,即在文档库中找到文件名时。所以我不确定为什么会显示错误消息。有什么想法吗?

powershell sharepoint-online

3
推荐指数
1
解决办法
1万
查看次数

WPF 关闭除活动子窗口和主窗口之外的所有子窗口

当我打开一个新的子窗体时,我有 C# WinForms 代码如下关闭所有子窗体:

private void CloseAllActiveForms(Form[] MdiChildren)
{
    Form[] childArray = MdiChildren;
    foreach (Form childform in childArray)
    {
        childform.Close();
    }
}
Run Code Online (Sandbox Code Playgroud)

如何在 WPF 窗口中使用?

我尝试了下面的代码,但它会关闭所有窗口,包括父窗口和活动窗口。

private void CloseAllWindows()
{
    for (int intCounter = App.Current.Windows.Count - 1; intCounter >= 0; intCounter--)
    {
        Application.Current.Windows[intCounter].Close();
    }
}
Run Code Online (Sandbox Code Playgroud)

谢谢。

c# wpf

1
推荐指数
2
解决办法
8461
查看次数