いくつかのスレッドで以下のコードがスレッドによって呼び出されたときにUIthread にコマンドを実行させるにはどうすればよいですか。そして、プロセスファンは無限ループのように高速になりました..その後、「stackoverflowexception」というエラーが表示されます
私のアプリケーションはファイルマネージャーです..(コピー、切り取り、貼り付け、新しいフォルダーなど)..およびdirRecursive(string path) ..ファイルとフォルダーをlistViewにアイコンで表示するので、次のようなことをするたびに(新しいフォルダーまたは貼り付け) listViewを更新するには、dirRecursiveを呼び出す必要があります
ノート:
助けてください:)事前に感謝します
private void PasteFromCopy(object dest)
{
foreach (ListViewItem item in copiedItems)
{
string _dest = (string)dest;
string itemName = item.Text;
string itemPath = item.ToolTipText;
string itemDest = Path.Combine(_dest, itemName);
if (IsFolder(itemPath))
{
if (Directory.Exists(itemDest))
{
if (MessageBox.Show(itemName + " is already exists .. Do you want to overwrite it and its all contents?"
, "Overwrite", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
{
CopyDirectory(itemPath, itemDest, true);
}
}
else
CopyDirectory(itemPath, itemDest, false);
}
else
{
if (File.Exists(itemDest))
{
if (MessageBox.Show(itemName + " is already exists .. Do you want to overwrite it?"
, "Overwrite", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
{
InfoLabel("Copying " + itemName + " ...");
File.Copy(itemPath, itemDest, true);
}
}
else
{
InfoLabel("Copying " + itemName + " ...");
File.Copy(itemPath, itemDest, false);
}
}
InfoLabel("Paste done.");
dirRecursive(currAddress); // here is line i need to execute from UIthread
}
}