本文整理汇总了C++中CSysProgressDlg::EnsureValid方法的典型用法代码示例。如果您正苦于以下问题:C++ CSysProgressDlg::EnsureValid方法的具体用法?C++ CSysProgressDlg::EnsureValid怎么用?C++ CSysProgressDlg::EnsureValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSysProgressDlg
的用法示例。
在下文中一共展示了CSysProgressDlg::EnsureValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
bool DropCopyCommand::Execute()
{
CString sDroppath = parser.GetVal(_T("droptarget"));
if (CTGitPath(sDroppath).IsAdminDir())
{
CMessageBox::Show(NULL,_T("Can't drop to .git repository directory\n"),
_T("TortoiseGit"),MB_OK|MB_ICONERROR);
return FALSE;
}
unsigned long count = 0;
CString sNewName;
pathList.RemoveAdminPaths();
if ((parser.HasKey(_T("rename")))&&(pathList.GetCount()==1))
{
// ask for a new name of the source item
do
{
CRenameDlg renDlg;
renDlg.m_windowtitle.LoadString(IDS_PROC_COPYRENAME);
renDlg.m_name = pathList[0].GetFileOrDirectoryName();
if (renDlg.DoModal() != IDOK)
{
return FALSE;
}
sNewName = renDlg.m_name;
} while(sNewName.IsEmpty() || PathFileExists(sDroppath+_T("\\")+sNewName));
}
CSysProgressDlg progress;
progress.SetTitle(IDS_PROC_COPYING);
progress.SetAnimation(IDR_MOVEANI);
progress.SetTime(true);
progress.ShowModeless(CWnd::FromHandle(hwndExplorer));
for(int nPath = 0; nPath < pathList.GetCount(); nPath++)
{
const CTGitPath& sourcePath = orgPathList[nPath];
CTGitPath fullDropPath(sDroppath);
if (sNewName.IsEmpty())
fullDropPath.AppendPathString(sourcePath.GetFileOrDirectoryName());
else
fullDropPath.AppendPathString(sNewName);
// Check for a drop-on-to-ourselves
if (sourcePath.IsEquivalentTo(fullDropPath))
{
// Offer a rename
progress.Stop();
CRenameDlg dlg;
dlg.m_windowtitle.Format(IDS_PROC_NEWNAMECOPY, (LPCTSTR)sourcePath.GetUIFileOrDirectoryName());
if (dlg.DoModal() != IDOK)
{
return FALSE;
}
// rebuild the progress dialog
progress.EnsureValid();
progress.SetTitle(IDS_PROC_COPYING);
progress.SetAnimation(IDR_MOVEANI);
progress.SetTime(true);
progress.SetProgress(count, pathList.GetCount());
progress.ShowModeless(CWnd::FromHandle(hwndExplorer));
// Rebuild the destination path, with the new name
fullDropPath.SetFromUnknown(sDroppath);
fullDropPath.AppendPathString(dlg.m_name);
}
if( CopyFile( sourcePath.GetWinPath(), fullDropPath.GetWinPath(), true))
{
CString ProjectTopDir;
if(fullDropPath.HasAdminDir(&ProjectTopDir))
{
g_Git.SetCurrentDir(ProjectTopDir);
SetCurrentDirectory(ProjectTopDir);
CString cmd;
cmd = _T("git.exe add \"");
CString path;
path=fullDropPath.GetGitPathString().Mid(ProjectTopDir.GetLength());
if(path.GetLength()>0)
if(path[0]==_T('\\') || path[0]==_T('/'))
path=path.Mid(1);
cmd += path;
cmd +=_T('\"');
CString output;
if (g_Git.Run(cmd, &output, CP_UTF8))
{
CMessageBox::Show(NULL, output, _T("TortoiseGit"), MB_OK|MB_ICONERROR);
} else
CShellUpdater::Instance().AddPathForUpdate(fullDropPath);
}
} else
{
CString str;
str+=_T("Copy file fail:");
str+=sourcePath.GetWinPath();
//.........这里部分代码省略.........