本文整理汇总了C#中Progress.Close方法的典型用法代码示例。如果您正苦于以下问题:C# Progress.Close方法的具体用法?C# Progress.Close怎么用?C# Progress.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Progress
的用法示例。
在下文中一共展示了Progress.Close方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button_backup_Click
private void button_backup_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
DialogResult result = fbd.ShowDialog();
if (result == DialogResult.OK)
{
int lastFoo = (int)Enum.GetValues(typeof(ECRComms.program)).Cast<ECRComms.program>().Last();
for (int p = 0; p <= lastFoo; p++)
{
Progress pr = new Progress(Program.ecr);
pr.Show();
string name = ((ECRComms.program)p).ToString();
data = Program.ecr.getprogram((ECRComms.program)p);
pr.Close();
try
{
writedata(data.ToArray(), Path.Combine(fbd.SelectedPath, name + ".dat"));
}
catch (Exception _Exception)
{
Console.WriteLine("Exception caught saving file{0}", _Exception.ToString());
}
}
}
}
示例2: Export
//.........这里部分代码省略.........
string supportPath = GetSupportPath();
Backend.Load(Common.ProgInstall);
LoadProgramSettings(supportPath);
LoadDataTypeSettings();
var outDir = Path.GetDirectoryName(outFullName);
DefaultProjectFileSetup(outDir);
SubProcess.BeforeProcess(outFullName);
var mainXhtml = Path.GetFileNameWithoutExtension(outFullName) + ".xhtml";
var mainFullName = Common.PathCombine(outDir, mainXhtml);
Debug.Assert(mainFullName.IndexOf(Path.DirectorySeparatorChar) >= 0, "Path for input file missing");
if (string.IsNullOrEmpty(mainFullName) || !File.Exists(mainFullName))
{
var msg = new[] { "Input File(main.xhtml) is not Found" };
LocDB.Message("errFnFound", "Input File(main.xhtml) is not Found.", msg, LocDB.MessageTypes.Error, LocDB.MessageDefault.First);
return;
}
string cssFullName = GetCssFullName(outDir, mainFullName);
if (cssFullName == null) return;
SetPageCenterTitle(cssFullName);
_selectedCssFromTemplate = Path.GetFileNameWithoutExtension(cssFullName);
string fluffedCssFullName;
string revFileName = string.Empty;
if (Path.GetFileNameWithoutExtension(outFullName) == "FlexRev")
{
fluffedCssFullName = GetFluffedCssFullName(GetRevFullName(outFullName), outDir, cssFullName);
}
else
{
fluffedCssFullName = GetFluffedCssFullName(outFullName, outDir, cssFullName);
revFileName = GetRevFullName(outDir);
}
string fluffedRevCssFullName = string.Empty;
if (revFileName.Length > 0)
{
fluffedRevCssFullName = GetFluffedCssFullName(revFileName, outDir, cssFullName);
}
DestinationSetup();
SetDefaultLanguageFont(fluffedCssFullName, mainFullName, fluffedRevCssFullName);
Common.StreamReplaceInFile(fluffedCssFullName, "\\2B27", "\\25C6");
if (DataType == "Scripture")
{
SeExport(mainXhtml, Path.GetFileName(fluffedCssFullName), outDir);
}
else if (DataType == "Dictionary")
{
string revFullName = GetRevFullName(outDir);
DeExport(outFullName, fluffedCssFullName, revFullName, fluffedRevCssFullName);
}
}
catch (InvalidStyleSettingsException err)
{
if (_fromNUnit)
{
Console.WriteLine(string.Format(err.ToString(), err.FullFilePath), "Pathway Export");
}
else
{
Utils.MsgBox(string.Format(err.ToString(), err.FullFilePath), caption,
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return;
}
catch (UnauthorizedAccessException err)
{
if (_fromNUnit)
{
Console.WriteLine(string.Format(err.ToString(), "Sorry! You might not have permission to use this resource."));
}
else
{
var msg = LocalizationManager.GetString("PsExport.ExportClick.Message", "Sorry! You might not have permission to use this resource.", "");
Utils.MsgBox(string.Format(err.ToString(), msg), caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return;
}
catch (Exception ex)
{
if (_fromNUnit)
{
Console.WriteLine(ex.ToString());
}
else
{
if (ex.ToString().IndexOf("Module1.xml") == -1)
{
Utils.MsgBox(ex.ToString(), caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
return;
}
finally
{
if (pb != null)
{
pb.Close();
}
}
}
示例3: FillGrid
private void FillGrid()
{
lock (lockReadWrite)
{
// Progress bar for loading the items in the event log
Progress progress = null;
// Reset the counters for event log types
ResetCounters();
//// Show the progress bar only if the event log is not on the local machine
//if (!((log.MachineName == ".") || (log.MachineName == System.Net.Dns.GetHostName())))
//{
progress = new Progress();
progress.Show();
progress.btnCancel.Click += new EventHandler(Progress_Cancel_Click);
//}
Application.DoEvents();
this.Cursor = Cursors.WaitCursor;
try
{
dgEvents.SelectionChanged -= dgEvents_SelectionChanged;
DataSet currentEntries = null;
// Retrieve the Event Log Entries via WMI
using (ManagementObjectCollection entries = GetEvents())
{
currentEntries = BuildDataSet(entries, progress);
}
// The request was cancelled
if (currentEntries == null)
{
return;
}
if (bindingSource == null)
{
bindingSource = new BindingSource(currentEntries, "Entries");
}
else
{
bindingSource.DataSource = currentEntries;
}
UpdateBindingSourceFilter();
dgEvents.DataSource = bindingSource;
dgEvents.Refresh();
UpdateCounterButtons();
dgEvents.SelectionChanged += dgEvents_SelectionChanged;
}
catch (Exception ex)
{
MessageBox.Show("Exception caught : " + ex.ToString(), "EventLog Viewer", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
this.Cursor = Cursors.Default;
if (progress != null)
{
progress.Close();
}
this.Focus();
}
}
}
示例4: zuXMLToolStripMenuItem_Click
private void zuXMLToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.file != null)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "XML-Datei (*.xml)|*.xml";
if (sfd.ShowDialog() == DialogResult.OK)
{
Progress progress = new Progress();
progress.Show();
progress.ReportProgress(40);
GedcomReader.ToXml(this.filename).Save(sfd.FileName);
progress.ReportProgress(100);
progress.Close();
}
}
}
示例5: bildSpeichernToolStripMenuItem_Click
private void bildSpeichernToolStripMenuItem_Click(object sender, EventArgs e)
{
Tuple<string, string> data = (Tuple<string, string>)pictureBox1.Tag;
string filetype = string.Empty;
switch (data.Item1)
{
case "image/jpeg":
case "image/jpg":
filetype = "jpg";
break;
}
if (data.Item2.StartsWith("http"))
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = string.Format("*.{0}|*.{0}", filetype);
GedcomIndividual individual = (GedcomIndividual)familyTreeView.SelectedNode.Tag;
sfd.FileName = individual.Name.ToString();
if (sfd.ShowDialog() == DialogResult.OK)
{
Progress progress = new Progress();
progress.Show();
WebClient client = new WebClient();
string tmpFile = string.Concat(Path.GetTempFileName(), filetype);
client.DownloadProgressChanged += (x, args) => {
progress.ReportProgress(args.ProgressPercentage);
progress.ReportProgress(string.Format("{0} of {1}", args.BytesReceived.FormatBytes(), args.TotalBytesToReceive.FormatBytes()));
};
client.DownloadFileCompleted += (y, args) => {
progress.Close();
};
client.DownloadFileAsync(new Uri(data.Item2), sfd.FileName);
}
}
}
示例6: LoadFile
private void LoadFile(string filename)
{
this.filename = filename;
this.Enabled = false;
Progress progress = new Progress();
progress.Canceled += Progress_Canceled;
progress.Show();
familyTreeView.Nodes.Clear();
progress.ReportProgress(2);
this.file = GedcomReader.ToGedcomFile(filename);
progress.ReportProgress(5);
double increaseValue = (double)95 / file.Families.Count;
double currentValue = 5;
foreach (GedcomFamily family in file.Families)
{
if (this.progressCanceled)
break;
if (family.Children.Count == 0)
progress.ReportProgress(string.Concat("Load family ", family.Identifier));
TreeNode famNode = new TreeNode("Familie") { ImageIndex = 3, SelectedImageIndex = 3 };
TreeNode husband = new TreeNode() { ImageIndex = 1, SelectedImageIndex = 1, Tag = family.Husband };
husband.Text = family.Husband != null ? family.Husband.Name.ToString() : string.Empty;
TreeNode wife = new TreeNode() { ImageIndex = 0, SelectedImageIndex = 0, Tag = family.Wife };
wife.Text = family.Wife != null ? family.Wife.Name.ToString() : string.Empty;
famNode.Nodes.AddRange(new TreeNode[] { husband, wife });
DateTime marriage = new DateTime();
if (family.Marriage != null && family.Marriage.Date?.Content != null && DateTime.TryParse(family.Marriage.Date.Content, out marriage))
famNode.Nodes.Add(Guid.NewGuid().ToString(), "Heirat: " + marriage.ToShortDateString(), 2, 2);
if (family.Children.Count > 0)
{
progress.ReportProgress(string.Concat("Load family ", family.Identifier, " (", family.Children.Count, " children)"));
TreeNode children = new TreeNode("Kinder") { ImageIndex = 3, SelectedImageIndex = 3 };
children.Nodes.AddRange(family.Children.Select(p => new TreeNode(p.Name.ToString()
)
{
ImageIndex =
p.Sex.Content.ToLower().Equals("m") ? 1 : 0,
SelectedImageIndex =
p.Sex.Content.ToLower().Equals("m") ? 1 : 0,
Tag = p
}).ToArray());
famNode.Nodes.Add(children);
}
familyTreeView.Nodes.Add(famNode);
progress.ReportProgress((int)currentValue);
Application.DoEvents();
currentValue += increaseValue;
famNode.ExpandAll();
}
if (!this.progressCanceled)
{
familyTreeView.Nodes[0].EnsureVisible();
progress.ReportProgress(100);
statusLabel.Text = string.Format("GEDCOM Source: {0} ({1})", this.file.Head.Source.Name, this.file.Head.Source.Version);
}
progress.Close();
this.Enabled = true;
this.progressCanceled = false;
if (!this.Focused)
this.Focus();
}
示例7: B_MangleSource_Click
private void B_MangleSource_Click(object sender, RoutedEventArgs e)
{
//validate input
if (Text_RootFolder.Text.Length == 0)
{
MessageBox.Show("Please select a valid root folder", "", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
DirectoryInfo rootInfo = new DirectoryInfo(Text_RootFolder.Text);
if (!rootInfo.Exists)
{
MessageBox.Show("Please select a valid root folder","",MessageBoxButton.OK,MessageBoxImage.Error);
return;
}
if (Text_NewNotice.Text.Length == 0)
{
MessageBox.Show("Please enter a new copyright message", "", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
if (Text_FileTypes.Text.Length == 0)
{
MessageBox.Show("Please enter at least one file type to mangle", "", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
//build filetype list
_fileTypes = Text_FileTypes.Text.Split(new[] { ' ', ','}, StringSplitOptions.RemoveEmptyEntries);
//display UI
_window = new Progress();
_window.T_Current.Content = "Currently Mangling:";
_window.T_Files.Content = "Files Mangled:";
_window.Show();
_window.Focus();
//recurse
long start;
long stop;
long frequency = Stopwatch.Frequency;
//Activator
start = Stopwatch.GetTimestamp();
Recurse(rootInfo);
stop = Stopwatch.GetTimestamp();
double time = (double)(stop - start) / (double)frequency;
//mangle files
//Display results
_window.Close();
MessageBox.Show("Mangled " + _filesMangled + " source files in " + (time * 1000.0).ToString("F1") + " mS");
}
示例8: RX2RestoreCalData
public void RX2RestoreCalData()
{
Progress p = new Progress("Retrieving Calibration Data from RX2 EEPROM");
p.SetPercent(0.0f);
this.Invoke(new MethodInvoker(p.Show));
Application.DoEvents();
float total_reads = 55.0f;
int count = 0;
FWCEEPROM.ReadRX2Level(rx2_level_table); // 33 reads
p.SetPercent((count+=33)/total_reads);
Application.DoEvents();
FWCEEPROM.ReadRX2Image(rx2_image_gain_table, rx2_image_phase_table); // 22 reads
p.SetPercent((count+=22)/total_reads);
Application.DoEvents();
RX2SyncCalDateTime();
p.Hide();
p.Close();
}
示例9: FLEX5000RestoreCalData
public void FLEX5000RestoreCalData()
{
Progress p = new Progress("Retrieving Calibration Data from TRX EEPROM");
p.SetPercent(0.0f);
this.Invoke(new MethodInvoker(p.Show));
Application.DoEvents();
float total_reads = 324.0f;
int count = 0;
FWCEEPROM.ReadRXLevel(rx1_level_table); // 33 reads
p.SetPercent((count+=33)/total_reads);
Application.DoEvents();
FWCEEPROM.ReadRXImage(rx1_image_gain_table, rx1_image_phase_table); // 22 reads
p.SetPercent((count+=22)/total_reads);
Application.DoEvents();
FWCEEPROM.ReadTXImage(tx_image_gain_table, tx_image_phase_table); // 22 reads
p.SetPercent((count+=22)/total_reads);
Application.DoEvents();
FWCEEPROM.ReadTXCarrier(tx_carrier_table); // 11 reads
p.SetPercent((count+=11)/total_reads);
Application.DoEvents();
FWCEEPROM.ReadPABias(pa_bias_table); // 8 reads
p.SetPercent((count+=8)/total_reads);
Application.DoEvents();
FWCEEPROM.ReadPAPower(power_table); // 143 reads
p.SetPercent((count+=143)/total_reads);
Application.DoEvents();
FWCEEPROM.ReadPABridge(pa_bridge_table); // 66 reads
p.SetPercent((count+=66)/total_reads);
Application.DoEvents();
FWCEEPROM.ReadPASWR(swr_table); // 11 reads
p.SetPercent((count+=11)/total_reads);
Application.DoEvents();
if(flex5000DebugForm != null && !flex5000DebugForm.IsDisposed)
{
for(int i=0; i<8; i++)
flex5000DebugForm.SetPAPot(i, (byte)pa_bias_table[0][i]);
}
p.SetPercent((count+=8)/total_reads);
Application.DoEvents();
FLEX5000SyncCalDateTime();
p.Hide();
p.Close();
Application.DoEvents();
for(int i=(int)Band.B2M; i<(int)Band.LAST; i++)
for(int j=0; j<13; j++)
power_table[i][j] = power_table[10][j];
}
示例10: ToBase
public static bool ToBase(string firetakeNumber)
{
var res = true;
var xml = XDocument.Load("firetakes.xml");
var node = xml.Element("Firetakes").Element("Firetake");
var progress = new Progress();
progress.Show();
progress.SetBarSize(node.Elements().Count<XElement>()+1);
try
{
progress.Focus();
for (int i = 0; i < int.Parse(firetakeNumber); i++)
{
node = node.NextNode as XElement;
}
foreach (XElement student in node.Elements())
{
var commandText = "INSERT INTO FIRETAKE(DATETAKEN,STATUS,GRADE,COMMENT,DELETED,STUDENT_ID,TEACHER_ID,SCORE) VALUES('" +
node.Attribute("Time").Value + "',0," + student.Attribute("Mark").Value + ",'',0," + student.Attribute("Id").Value + "," +
node.Attribute("Teacher").Value + "," + student.Attribute("Score").Value + ")";
var con = new MySqlConnection(conStr);
var com = new MySqlCommand(commandText, con);
con.Open();
com.ExecuteNonQuery();
con.Close();
progress.Increment();
System.Threading.Thread.Sleep(200);
}
node.Remove();
xml.Save("firetakes.xml");
}
catch
{
res = false;
}
progress.Close();
return res;
}