NumericUpDown ValueChanged事件会立即产生影响吗?(NumericUpDown ValueChanged event with immediate consequences?)
我正在用C#(.NET 4.0)编写一个小应用程序。 我想在numericUpDown中值更改时触发事件,但似乎当控件失去焦点或有多个更改时,numericUpDown ValueChanged将触发。
详细说明:我使用对象的属性绑定(OnPropertyChanged)numericUpDown,以便立即反映更改。 但我还需要使用这个新更改的numericUpDown值来计算某些内容(全局/与对象无关)。 但是如果我使用ValueChanged事件,那就太晚了。
简短的介绍:
我需要一个与OnPropertyChanged具有类似功能的事件。
我能做什么?
编辑:在ValueChanged事件处理程序中,我对对象进行了一些计算,但是已更改的值尚未提交给object属性,因此我认为ValueChanged事件滞后。
感谢您的帮助。
I'm writing a small application in C# (.NET 4.0). I want to fire an event when value changes in numericUpDown, but it seems that numericUpDown ValueChanged fires when control loses focus or when there are multiple changes.
Long description: I am binding (OnPropertyChanged) numericUpDown with a property of an object, so that the changes are reflected immediately. But I also need to calculate something (global / not related to object) using this newly changed value of numericUpDown. But if I use ValueChanged event, it fires too late.
Short description:
I need an event with similar functionality to OnPropertyChanged.
What can I do?
EDIT: In ValueChanged event handler I did some calculations on the objects, but the value that has changed wasn't yet committed to the object property, thus I thought that the ValueChanged event was lagging behind.
Thank you for your help.
原文:https://stackoverflow.com/questions/11168922
最满意答案
如果我正确理解你的问题,那么这样的事情可能有效:
for %%i in ( "D:\Folder4\subfolder1\*.bat" "D:\Folder4\subfolder2\*.bat" "D:\Folder4\subfolder3\*.bat" "D:\Folder4\subfolder4\*.bat" "D:\Folder4\subfolder5\*.bat" "D:\Folder4\subfolder6\*.bat" ) do XCOPY /U /Y "C:\folder1\*.bat" "%%i"
基本上
XCOPY
命令有我认为你需要的选项。编辑
我的理解在增长:P ......这可能更符合您的要求:
@echo off for /r D:\Folder4\ %%i in (*.bat) do ( for /r C:\folder\ %%j in (*.bat) do ( if %%~ni == %%~nj XCOPY /U /Y "%%j" "%%i" ) ) pause
If I'm understanding your question correctly, then something like this may work:
for %%i in ( "D:\Folder4\subfolder1\*.bat" "D:\Folder4\subfolder2\*.bat" "D:\Folder4\subfolder3\*.bat" "D:\Folder4\subfolder4\*.bat" "D:\Folder4\subfolder5\*.bat" "D:\Folder4\subfolder6\*.bat" ) do XCOPY /U /Y "C:\folder1\*.bat" "%%i"
Basically the
XCOPY
command has the options I believe you require.EDIT
My understanding grows :P ...this perhaps is more what you seek:
@echo off for /r D:\Folder4\ %%i in (*.bat) do ( for /r C:\folder\ %%j in (*.bat) do ( if %%~ni == %%~nj XCOPY /U /Y "%%j" "%%i" ) ) pause
相关问答
更多-
for /f "delims=" %%a in ('dir /b /a-d "c:\workspace\changeset\com\folder\*.java"') do ( if exist "c:\workspace\target\class\com\folder\%%~na.class" ( echo copy "c:\workspace\target\class\com\folder\%%~na.class" "c:\workspace\changeset\com\folder\%%a") ) ...
-
如何重命名多个子文件夹中多个文件的扩展名(.jpg)?(How to rename the extension (.jpg) of multiple files in multiple subfolders?)[2023-09-16]
正如@bgalea指出的那样,代码的问题是批处理使用%%a而不是%a 。 但是,虽然这会修复代码的语法,但仍然存在错误。 将文件重命名为其他扩展名实际上并不会转换文件,例如,您无法将.txt文件重命名为.mp4并期望它播放视频。 不幸的是,Windows没有本地方式来转换图像。 这意味着您需要第三方工具,例如ImageMagick (免费)。 如果安装了ImageMagick,则可以使用convert命令,如下所示: @ECHO OFF FOR /f "delims=*" %%a IN ('dir *. ... -
这是一个可能的解决方案,因为路径示例中只有XXX部分是可变的: rem // Enumerate `FolderName*` directories: for /D %%R in ("Carabidae\Pterostichinae\FolderName*") do ( rem // Enumerate `Stack*` sub-directories within `dor` sub-directories: for /F "delims= eol=|" %%D in ('dir /B / ...
-
for i in {1..39} do mkdir -p r${i}/ mv *run${i}_* r${i}/ done for i in {1..39} do mkdir -p r${i}/ mv *run${i}_* r${i}/ done
-
如果我正确理解你的问题,那么这样的事情可能有效: for %%i in ( "D:\Folder4\subfolder1\*.bat" "D:\Folder4\subfolder2\*.bat" "D:\Folder4\subfolder3\*.bat" "D:\Folder4\subfolder4\*.bat" "D:\Folder4\subfolder5\*.bat" "D:\Folder4\subfolder6\*.bat" ) do ...
-
打开命令提示符窗口,键入并执行for /? 并读取此命令的帮助输出。 选项/D已在第一个帮助页面上解释,该页面用于在目录的每个子目录上执行命令。 下面的批处理文件使用控制台版本的WinRAR使用命令m (move = archive和delete on success)而不是使用switch -df命令a来存档C:\Users\Admin\Folder每个子文件夹。 @echo off for /D %%F in ("C:\Users\Admin\Folder\*") do ( "%ProgramF ...
-
如何在整个master文件夹中扫描多个子文件夹?(How do i scan multiple subfolders within an overall masterfolder? [duplicate])[2024-02-13]
幸运的是,我有一些业余时间在工作:) 您需要递归以满足您的需求。 粗略的伪代码解释: processFiles(folder) for each subfolder in folder for each file in subfolder Do modifications next call processFiles(subFolder) next end 在VBA中,它看起来像这样: Sub openAllXlsFi ... -
@ECHO OFF SETLOCAL :: no idea what this is aimed at doing...?? for %%* in (.) do set new=%%~n* SET new=newstring SET old=XXXX for %%f in (*.fmw) do ( echo Processing %%f... ( FOR /F "delims=" %%l IN (%%f) DO ( SET "line=%%l" S ...
-
Get-ChildItem *将获取您当前的路径,因此我们使用定义您想要的路径Get-ChildItem -Path "J:\Logs"并添加recurse因为我们想要所有子文件夹中的文件。 然后让我们添加使用Get-ChildItem的include和file参数而不是Where-Object 然后,如果我们将它传递给ForEach ,我们可以在每个对象上使用Rename-Item,其中要重命名的对象是$_ , NewName将是report.txt 。 Get-ChildItem -Path "J:\L ...
-
您可以查找的其中一个选项是使用脚本任务来执行此操作。 脚本任务是嵌入在SSIS中的那些巧妙的东西之一,可以通过充分利用.Net库来做任何开箱即用的组件无法提供的东西。 这是一个链接,解释了如何做到这一点 - http://microsoft-ssis.blogspot.com.au/2011/08/foreach-ftp-file-enumerator.html One of the options you can look for is using Script Task to perform this. ...