WPF 中获取系统信息

首先添加 mscorlib assembly的命名空间引用

  xmlns:r="clr-namespace:System;assembly=mscorlib"

 XAML代码

<TextBlock>
<Label Content="Operating System Version : "></Label>
<Label Content="{x:Static r:Environment.OSVersion}"></Label>
<LineBreak></LineBreak>
<Label Content="Dot NET Version : "></Label>
<Label Content="{x:Static r:Environment.Version}"></Label>
<LineBreak></LineBreak>
<Label Content="Machine Name : "></Label>
<Label Content="{x:Static r:Environment.MachineName}"></Label>
<LineBreak></LineBreak>
<Label Content="User Name : "></Label>
<Label Content="{x:Static r:Environment.UserName}"></Label>

<LineBreak></LineBreak>
<Label Content="User Domain Name : "></Label>
<Label Content="{x:Static r:Environment.UserDomainName}"></Label>
<LineBreak></LineBreak>
<Label Content="System Directory : "></Label>
<Label Content="{x:Static r:Environment.SystemDirectory}"></Label>

</TextBlock>

 

 

 

posted @ 2010-06-12 06:45  i'm zjz  阅读(1547)  评论(0编辑  收藏  举报