本文整理汇总了C#中Progress.SetAskOnCancel方法的典型用法代码示例。如果您正苦于以下问题:C# Progress.SetAskOnCancel方法的具体用法?C# Progress.SetAskOnCancel怎么用?C# Progress.SetAskOnCancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Progress
的用法示例。
在下文中一共展示了Progress.SetAskOnCancel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintPagesVoid
public void PrintPagesVoid()
{
CommandLineInterpreter oCLI = new CommandLineInterpreter();
ActionCallingContext acc = new ActionCallingContext();
string strPages = string.Empty;
acc.AddParameter("TYPE", "PAGES");
oCLI.Execute("selectionset", acc);
acc.GetParameter("PAGES", ref strPages);
Progress oProgress = new Progress("SimpleProgress");
oProgress.SetAllowCancel(true);
oProgress.SetAskOnCancel(true);
oProgress.SetNeededSteps(3);
oProgress.SetTitle("Drucken");
oProgress.ShowImmediately();
foreach (string Page in strPages.Split(';'))
{
if (!oProgress.Canceled())
{
acc.AddParameter("PAGENAME", Page);
oCLI.Execute("print", acc);
}
else
{
break;
}
}
oProgress.EndPart(true);
return;
}
示例2: Function
public void Function()
{
string strProjectpath =
PathMap.SubstitutePath("$(PROJECTPATH)");
string strProjectname = PathMap.SubstitutePath("$(PROJECTNAME)");
string strFullProjectname = PathMap.SubstitutePath("$(P)");
string strDate = DateTime.Now.ToString("yyyy-MM-dd");
string strTime = DateTime.Now.ToString("hh-mm-ss");
string strBackupDirectory = strProjectpath + @"\Backup\";
string strBackupFilename = strProjectname + "_Backup_"
+ strDate + "_" + strTime;
if (!System.IO.Directory.Exists(strBackupDirectory))
{
System.IO.Directory.CreateDirectory(strBackupDirectory);
}
Progress oProgress = new Progress("SimpleProgress");
oProgress.SetAllowCancel(true);
oProgress.SetAskOnCancel(true);
oProgress.BeginPart(100, "");
oProgress.SetTitle("Backup");
oProgress.ShowImmediately();
if (!oProgress.Canceled())
{
CommandLineInterpreter oCLI = new CommandLineInterpreter();
ActionCallingContext acc = new ActionCallingContext();
acc.AddParameter("BACKUPMEDIA", "DISK");
acc.AddParameter("ARCHIVENAME", strBackupFilename);
acc.AddParameter("BACKUPMETHOD", "BACKUP");
acc.AddParameter("COMPRESSPRJ", "1");
acc.AddParameter("INCLEXTDOCS", "1");
acc.AddParameter("BACKUPAMOUNT", "BACKUPAMOUNT_ALL");
acc.AddParameter("INCLIMAGES", "1");
acc.AddParameter("LogMsgActionDone", "true");
acc.AddParameter("DESTINATIONPATH", strBackupDirectory);
acc.AddParameter("PROJECTNAME", strFullProjectname);
acc.AddParameter("TYPE", "PROJECT");
oCLI.Execute("backup", acc);
}
oProgress.EndPart(true);
MessageBox.Show(
"Backup wurde erfolgreich erstellt:\n"
+ strBackupFilename,
"Hinweis",
MessageBoxButtons.OK,
MessageBoxIcon.Information
);
return;
}
示例3: PagePdfVoid
public void PagePdfVoid()
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
CommandLineInterpreter oCLI = new CommandLineInterpreter();
ActionCallingContext acc = new ActionCallingContext();
if (fbd.ShowDialog() != DialogResult.OK)
{
return;
}
Progress oProgress = new Progress("SimpleProgress");
oProgress.SetAllowCancel(true);
oProgress.SetAskOnCancel(true);
oProgress.BeginPart(100, "");
oProgress.ShowImmediately();
try
{
string strPages = string.Empty;
acc.AddParameter("TYPE", "PAGES");
oCLI.Execute("selectionset", acc);
acc.GetParameter("PAGES", ref strPages);
foreach (string CurrentPage in strPages.Split(';'))
{
if (!oProgress.Canceled())
{
acc.AddParameter("TYPE", "PDFPAGESSCHEME");
acc.AddParameter("PAGENAME", CurrentPage);
acc.AddParameter("EXPORTFILE", fbd.SelectedPath + @"\" + CurrentPage);
acc.AddParameter("EXPORTSCHEME", "EPLAN_default_value");
oCLI.Execute("export", acc);
}
else
{
oProgress.EndPart(true);
return;
}
}
Process.Start(fbd.SelectedPath);
oProgress.EndPart(true);
}
catch (System.Exception ex)
{
oProgress.EndPart(true);
MessageBox.Show("Error", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例4: Function
public void Function()
{
string strFullProjectname =
PathMap.SubstitutePath("$(P)");
string strProjectpath =
PathMap.SubstitutePath("$(PROJECTPATH)" + @"\");
string strProjectname =
PathMap.SubstitutePath("$(PROJECTNAME)");
DialogResult Result = MessageBox.Show(
"Soll ein PDF für das Projekt\n'"
+ strProjectname +
"'\nerzeugt werden?",
"PDF-Export",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question
);
if (Result == DialogResult.Yes)
{
Progress oProgress = new Progress("SimpleProgress");
oProgress.SetAllowCancel(true);
oProgress.SetAskOnCancel(true);
oProgress.BeginPart(100, "");
oProgress.ShowImmediately();
CommandLineInterpreter oCLI = new CommandLineInterpreter();
ActionCallingContext acc = new ActionCallingContext();
acc.AddParameter("TYPE", "PDFPROJECTSCHEME");
acc.AddParameter("PROJECTNAME", strFullProjectname);
acc.AddParameter("EXPORTFILE",
strProjectpath + strProjectname);
acc.AddParameter("EXPORTSCHEME", "EPLAN_default_value");
oCLI.Execute("export", acc);
oProgress.EndPart(true);
}
return;
}
示例5: Function
public void Function()
{
Progress oProgress = new Progress("SimpleProgress");
oProgress.SetAllowCancel(true);
oProgress.SetAskOnCancel(true);
oProgress.SetNeededSteps(3);
oProgress.SetTitle("Meine Progressbar");
oProgress.ShowImmediately();
if (!oProgress.Canceled())
{
oProgress.SetActionText("Step 1");
oProgress.SetTitle("Titelzeile 1");
oProgress.Step(1);
Thread.Sleep(1000);
}
if (!oProgress.Canceled())
{
oProgress.SetActionText("Step 2");
oProgress.SetTitle("Titelzeile 2");
oProgress.Step(1);
Thread.Sleep(1000);
}
if (!oProgress.Canceled())
{
oProgress.SetActionText("Step 3");
oProgress.SetTitle("Titelzeile 3");
oProgress.Step(1);
Thread.Sleep(1000);
}
oProgress.EndPart(true);
return;
}