小编din*_*rca的帖子

对目录文件进行排序并获取最高文件名

我有一个40个文件的目录,名称从0到39(例如),我试图获取其名称中最大数字的文件(这意味着我需要得到"39")我试图对目录进行排序..我尝试过使用以下主题:

如何检索目录中的文件列表,按名称排序

在C#中对Directory.GetFiles的结果进行排序

没有什么对我有用..我尝试了每种方法 - 使用Linq和其他...我不知道为什么..

我得到以下排序结果(见下图): 在此输入图像描述

谢谢您的帮助,

Din Bracha.

c# sorting wpf file

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

如何检查.Net Framework是否已安装[C#/ WPF]

在开始我的应用程序之前(在表单加载上)我想检查并确保在机器上安装.NET框架(3.5或更高版本) - 如果不是我想提示用户下载并安装它(带有INTERNET的简单MessageBox)链接到Microsoft WebPage会是最好的想法吗?)所以,这实际上需要两个问题......

a)如何安装.NET FrameWork 3.5或更高版本,如何确定?(我不信任或者只想找C:\ Program Files\Microsoft.NET文件夹,看起来容易出错吗?)看到这是非常关键的,必须有一个很好的方法在C#中确定什么版本用户在他的机器上运行的.NET?我只是不知道如何..

b)如何在MessageBox中粘贴INTERNET LINK(超链接?)?因此,如果用户没有安装.NET框架(1.1或2.0),我可以让他们只需点击链接即可下载吗?

任何帮助/提示将不胜感激.

谢谢,丁

c# wpf .net-4.0 .net-3.5

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

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

WPF工具包 - 在DataGrid控件中有问题绑定

嘿伙计们,首先我必须说,这可能看起来很多代码,但它很容易阅读.我试图绑定一些东西,我得到这个结果:

http://img694.imageshack.us/f/28475988.jpg/

正如您所看到的那样,数字,描述,行和列似乎是重复的.

在我的主表单设计师我有:

<Window x:Class="Visual_Command_Line.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Visual_Command_Line"
    xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"
    Title="Visual Command Line" MinHeight="750" MinWidth="900" Loaded="Window_Loaded" Icon="/Visual_Command_Line;component/Resources/icon16x16.ico" WindowStartupLocation="CenterScreen" WindowState="Maximized" Closing="Window_Closing">
<Window.Resources>
    <local:ErrorListCollection x:Key="ErrorList" />
</Window.Resources>
                        <dg:DataGrid Name="DataGrid_ErrorList" IsReadOnly="True" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" CanUserSortColumns="False" ItemsSource="{Binding Source={StaticResource ErrorList}}">
                            <dg:DataGrid.Columns>
                                <dg:DataGridTextColumn Binding="{Binding Path=GetNumber}" Header="" />
                                <dg:DataGridTextColumn Binding="{Binding Path=GetDescription}" Header="Description" Width="10*" />
                                <dg:DataGridTextColumn Binding="{Binding Path=GetLine}" Header="Line" Width="*" />
                                <dg:DataGridTextColumn Binding="{Binding Path=GetColumn}" Header="Column" Width="*" />
                            </dg:DataGrid.Columns>
                        </dg:DataGrid>
</Grid>
Run Code Online (Sandbox Code Playgroud)

当主表单加载我做:

((ErrorListCollection)this.FindResource("ErrorList")).RenewErrorList(((TabDocument)dockManager.ActiveDocument).currentAnalizedLine);
Run Code Online (Sandbox Code Playgroud)

这是ErrorListCollection类:

class ErrorListCollection : ObservableCollection<DebugError>
{
    public ErrorListCollection()
    {
    }

    public void RenewErrorList(AnalizedLine al) //also all …
Run Code Online (Sandbox Code Playgroud)

c# binding datagrid wpftoolkit

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

CSS - 哪些代码渲染速度更快,效率更高?

我想知道以下哪些代码渲染速度更快,效率更高:

这个 -

body{background:#ddd;font-family:verdana;font-size:12px;color:#808080;}
a{color:#808080;outline:0;text-decoration:none;}
input{margin:0;padding:0;font-family:verdana;color:#808080;}
ul{padding:0;margin:0;}
Run Code Online (Sandbox Code Playgroud)

或这个 -

body,input{font-family:verdana}
body,input,a{color:#808080;}
body{background:#ddd;;font-size:12px;}
a{outline:0;text-decoration:none;}
input,ul{margin:0;padding:0;}
Run Code Online (Sandbox Code Playgroud)

css performance

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

有人可以给我一个jQuery动画函数的独立代码

最近我问过这个问题: 想了解Animate功能(计算和步进) ,我得到了答案.

我试图删除不必要的jQuery代码,只留下jQuery动画函数.

如果有人能为我提供具有其他技术的jQuery动画功能 - 我将非常感激.

jquery animation

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

以编程方式将子菜单添加到菜单项 - Android

我试图以编程方式将一个SubMenu添加到我的MenuItem,我该怎么做?到目前为止这是我的代码:

    @Override
public boolean onCreateOptionsMenu(Menu menu) {

    menu.add(Menu.NONE, R.id.extra_options, Menu.NONE, "Menu1")
    .setIcon(Config.chooseActionBarIcon(
            MainActivity.this, "ic_actionbar_font"))
    .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    SubMenu themeMenu = menu.findItem(R.id.extra_options).getSubMenu();
    themeMenu.clear();
    themeMenu.add(0, R.id.theme_auto, Menu.NONE, "Automatic");
    themeMenu.add(0, R.id.theme_day, Menu.NONE, "Default");
    themeMenu.add(0, R.id.theme_night, Menu.NONE, "Night");
    themeMenu.add(0, R.id.theme_batsave, Menu.NONE, "Battery Saving");


    return super.onCreateOptionsMenu(menu);
}
Run Code Online (Sandbox Code Playgroud)

R.id.extra_options是在"ids.xml"资源文件中定义的ID;

<item type="id" name="extra_options" />
Run Code Online (Sandbox Code Playgroud)

使用getSubMenu()获取SubMenu似乎没问题,但是当我尝试将项添加到SubMenu时,我收到错误"NullPointerException"

任何人都知道代码有什么问题?

android menu submenu

3
推荐指数
2
解决办法
6625
查看次数

C# - 自用户打开程序以来已打开哪些程序

我需要知道自用户打开程序以来打开了哪些程序 - 一个程序活动监视器.

我怎样才能做到这一点?

.net c#

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

我应该创建另一个变量而不是3个显式强制转换吗?

这是速度问题.我有以下代码:

if (MyXMLReader.SearchForValue(command, new List<string>() { "/Command/Descriptions/Description/System" }, ((TabDocument)dockManager.ActiveDocument).version))
{
    txtBox_desc.Text = MyXMLReader.GetValue(command, "/Command/Descriptions/Description[" + MyXMLReader.SearchForValue_Int(command, new List<string>() { "/Command/Descriptions/Description/System" }, ((TabDocument)dockManager.ActiveDocument).version) + "]/Content");
}
if (MyXMLReader.SearchForValue(command, new List<string>() { "/Command/Uses/Use/System" }, ((TabDocument)dockManager.ActiveDocument).version))
{
    txtBox_use.Text = MyXMLReader.GetValue(command, "/Command/Uses/Use[" + MyXMLReader.SearchForValue_Int(command, new List<string>() { "/Command/Uses/Use/System" }, ((TabDocument)dockManager.ActiveDocument).version) + "]/Content");
}
if (MyXMLReader.SearchForValue(command, new List<string>() { "/Command/Notes/Note/System" }, ((TabDocument)dockManager.ActiveDocument).version))
{
    txtBox_notes.Text = MyXMLReader.GetValue(command, "/Command/Notes/Note[" + MyXMLReader.SearchForValue_Int(command, new List<string>() { "/Command/Notes/Note/System" }, ((TabDocument)dockManager.ActiveDocument).version) + "]/Content");
}
Run Code Online (Sandbox Code Playgroud)

我应该创建一个新string变量来保存

((TabDocument)dockManager.ActiveDocument).version?
Run Code Online (Sandbox Code Playgroud)

这会有更快的速度和响应能力吗?这会是坏事还是好事?

c# coding-style

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

我应该推送已编译的JavaScript还是忽略它们?

在新的Angular 2中,我们引入了TypeScript,它主要提供可选的静态类型,类和接口。

用TypeScript编写后,我们需要将代码编译为JavaScript才能运行程序

问题是我应该将带有打字稿文件的已编译javascript推送到服务器,还是应该忽略javascript文件.gitignore并直接npm start在将要编译文件的服务器上运行?

git typescript angular

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

尝试将窗口的宽度和高度设置为自动

我试图使窗口的宽度和高度为auto,这意味着它将具有所有子控件的宽度和高度组合:

我的代码:

<Window x:Class="Read_360.ToastPopup"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ToastPopup" Width="Auto" Height="68">
<Window.Resources>
    <ControlTemplate x:Key="MyErrorMessage"
                     TargetType="{x:Type Label}">
        <StackPanel Orientation="Horizontal"
                    Name="ErrorMessage" Width="Auto" Height="Auto">
            <Border CornerRadius="4" Width="Auto"
                    BorderThickness="0"
                    VerticalAlignment="Center"
                    Margin="4,0"
                    Background="#FF404040"
                    BorderBrush="Transparent">
                <Label Foreground="White"
                       VerticalAlignment="Center"
                       Padding="4,2"
                       Margin="4"
                       FontWeight="Bold" FontSize="15"
                       Name="Part1" Width="Auto" Height="Auto"
                       Visibility="Visible" HorizontalAlignment="Center" Content="{Binding Message}" />
            </Border>
        </StackPanel>
    </ControlTemplate>
</Window.Resources>
<StackPanel Orientation="Vertical">
    <Label Template="{StaticResource MyErrorMessage}" Name="Label1" Width="Auto" Height="Auto"></Label>
</StackPanel>
Run Code Online (Sandbox Code Playgroud)

我需要宽度和高度与ControlTemplate内的Label相同

提前致谢,

声浪.

wpf height xaml width

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