本文整理汇总了C#中MethodInvoker.BeginInvoke方法的典型用法代码示例。如果您正苦于以下问题:C# MethodInvoker.BeginInvoke方法的具体用法?C# MethodInvoker.BeginInvoke怎么用?C# MethodInvoker.BeginInvoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MethodInvoker
的用法示例。
在下文中一共展示了MethodInvoker.BeginInvoke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button3_Click
private void button3_Click(object sender, EventArgs e)
{
FolderBrowserDialog flr = new FolderBrowserDialog();
if (flr.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string path = flr.SelectedPath;
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Выберите файл отчета";
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
MethodInvoker mi = new MethodInvoker(delegate
{
ShowAnimation();
ApplyPatch(flr.SelectedPath, ofd.FileName);
HideAnimation();
});
mi.BeginInvoke(null, null);
}
}
}
示例2: BT_ComputeIL_Click
private void BT_ComputeIL_Click(object sender, EventArgs e)
{
MethodInvoker asynTask = new MethodInvoker(Compute);
asynTask.BeginInvoke(null, null);
}
示例3: Page_Load
/// <summary>
/// Load default value to control and other initialize.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MethodInvoker runHitCount = new MethodInvoker(UpdateHitCount);
runHitCount.BeginInvoke(CurrentWeb, HttpContext.Current, null, null);
//dvBG.Attributes.Add("style", "background-image: url('" + DocLibUrl + "/statistic.jpg'); width: 118px; height: 35px;");
//dvHitCount.InnerText = HitCountNumber.ToString();
//dvBGDay.Attributes.Add("style", "background-image: url('" + DocLibUrl + "/statistic.jpg'); width: 118px; height: 35px;");
//dvHitCountDay.InnerText = DayHitCountNumber.ToString();
//dvBGNow.Attributes.Add("style", "background-image: url('" + DocLibUrl + "/statistic.jpg'); width: 118px; height: 35px;");
//dvHitCountNow.InnerText = CurrentHitCountNumber.ToString();
//dvBGWeek.Attributes.Add("style", "background-image: url('" + DocLibUrl + "/statistic.jpg'); width: 118px; height: 35px;");
//dvHitCountWeek.InnerText = WeekHitCountNumber.ToString();
//dvBGMonth.Attributes.Add("style", "background-image: url('" + DocLibUrl + "/statistic.jpg'); width: 118px; height: 35px;");
//dvHitCountMonth.InnerText = MonthHitCountNumber.ToString();
//dvBGYesterday.Attributes.Add("style", "background-image: url('" + DocLibUrl + "/statistic.jpg'); width: 118px; height: 35px;");
//dvHitCountYesterday.InnerText = YesterdayHitCountNumber.ToString();
tdAll.InnerText = HitCountNumber.ToString();
tdToday.InnerText = DayHitCountNumber.ToString();
lblCurrent.Text = "<span id='spCurrent'>" + CurrentHitCountNumber.ToString() + "</span>";
tdThisWeek.InnerText = WeekHitCountNumber.ToString();
tdThisMonth.InnerText = MonthHitCountNumber.ToString();
tdYesterday.InnerText = YesterdayHitCountNumber.ToString();
}
}
示例4: WriteLog
public static void WriteLog(string module, string optor, OpLogTypeEnum type, string content)
{
MethodInvoker m = new MethodInvoker(delegate
{
BLL.Bll_Operation opInst = new QX.BLL.Bll_Operation();
opInst.WriteLog(module, optor, type, content);
});
m.BeginInvoke(null, null);
}
示例5: InvokeAsync
public static bool InvokeAsync(MethodInvoker method, int timeout)
{
if (timeout < 0)
throw new InvalidOperationException("The timeout cannot be less than zero");
// invoke
IAsyncResult res = method.BeginInvoke(null, null);
// timeout
return res.AsyncWaitHandle.WaitOne(timeout);
}
示例6: ExecuteRequest
public void ExecuteRequest()
{
if (HttpContext.Current.Handler == null) return;
_currentPage = (Page)HttpContext.Current.Handler;
if (_currentPage != null)
{
var taskDelegate = new MethodInvoker(this.RunTask);
taskDelegate.BeginInvoke(CallBack, null);
}
}
示例7: loadImage
// Load image
private void loadImage(string[] _files)
{
if (!busy)
{
files = _files;
busy = true;
// Begin
MethodInvoker mi = new MethodInvoker(loadInvoke);
mi.BeginInvoke(null, null);
}
}
示例8: frmLogin
public frmLogin()
{
//This call is required by the Windows Form Designer.
InitializeComponent();
MethodInvoker myProcessStarter = new MethodInvoker(InitialDigSignature);
myProcessStarter.BeginInvoke(null, null);
timer1 = new System.Windows.Forms.Timer();
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Interval = 1000; // 1 second
timer1.Start();
}
示例9: FormInicial
public FormInicial()
{
InitializeComponent();
loadconfig();
//aqui vai ser para a vpn
//ipinicial = new Utils().getipinternetMeu();
//String ipinicial2 = new Utils().getipinternet2();
MethodInvoker startdtinit = new MethodInvoker(ipinicial1);
startdtinit.BeginInvoke(null, null);
MethodInvoker startdt3init = new MethodInvoker(ipinicial2);
startdt3init.BeginInvoke(null, null);
MethodInvoker startdt2init = new MethodInvoker(ipinicial3);
startdt2init.BeginInvoke(null, null);
//ipinicial = new Utils().getipinternetMeu();
while (ipinicial == "")
{
int i = 0;
}
label1.Text = ipinicial;
}
示例10: UpdateWelcomeUI
private void UpdateWelcomeUI ()
{
back_button.Enabled = false;
if (rule_loader == null) {
rule_loader = Runner.LoadRules;
rules_loading = rule_loader.BeginInvoke (EndCallback, rule_loader);
}
PopulateProjectListBox();
}
示例11: UpdateAnalyzeUI
private void UpdateAnalyzeUI ()
{
// update UI before waiting for assemblies to be loaded
progress_bar.Value = 0;
next_button.Enabled = false;
analyze_status_label.Text = String.Format ("Processing assembly 1 of {0}",
assemblies.Count);
analyze_defect_label.Text = String.Format ("Defects Found: 0");
// make sure all assemblies are loaded into memory
assemblies_loading.AsyncWaitHandle.WaitOne ();
PrepareAnalyze ();
analyze = Analyze;
analyzing = analyze.BeginInvoke (EndCallback, analyze);
}
示例12: button1_Click
private void button1_Click(object sender, EventArgs e)
{
FolderBrowserDialog flr = new FolderBrowserDialog();
if (flr.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string path = flr.SelectedPath;
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
MethodInvoker mi = new MethodInvoker(delegate
{
ShowAnimation();
var report = GenerateReport(path);
Save(report, sfd.FileName);
HideAnimation();
});
mi.BeginInvoke(null, null);
}
}
}
示例13: BuildDataSet
private DataSet BuildDataSet(ManagementObjectCollection entries, Progress progress)
{
// Create the dataset that the datagrid is going to bind to
DataSet ds = new DataSet();
DataTable table = new DataTable("Entries");
table.Columns.Add("EntryType");
table.Columns.Add("TimeWritten", typeof(DateTime));
table.Columns.Add("Category", typeof(ushort));
table.Columns.Add("Source");
table.Columns.Add("EventID", typeof(uint));
table.Columns.Add("Message");
table.Columns.Add("Index", typeof(uint));
ds.Tables.Add(table);
groupNames = new List<String>();
// Enumerate through the events and add each item to the dataset
using (System.Management.ManagementObjectCollection.ManagementObjectEnumerator enumerator = entries.GetEnumerator())
{
while (enumerator.MoveNext())
{
if (progress != null)
{
if (cancelFill)
{
return null;
}
MethodInvoker invoker = new MethodInvoker(progress.IncrementValue);
invoker.BeginInvoke(null, null);
}
ManagementBaseObject entry = enumerator.Current;
if (!groupNames.Contains((string)(entry["SourceName"])))
{
groupNames.Add((string)(entry["SourceName"]));
}
AddTableRow(table, entry);
Application.DoEvents();
}
}
FillSourceItems(groupNames);
return ds;
}
示例14: button2_Click
private void button2_Click(object sender, EventArgs e)
{
FolderBrowserDialog flr = new FolderBrowserDialog();
if (flr.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string path = flr.SelectedPath;
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Выберите файл отчета";
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
MethodInvoker mi = new MethodInvoker(delegate
{
ShowAnimation();
var lrep = LoadReport(ofd.FileName);
var patch = GeneratePatch(flr.SelectedPath, lrep);
Save(patch, sfd.FileName);
HideAnimation();
});
mi.BeginInvoke(null, null);
}
}
}
}
示例15: SelectFile_Click
private void SelectFile_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
this.filename = this.openFileDialog.FileName;
textFile.Text = this.filename;
textSha1sum.Text = "Calculating";
MethodInvoker mi = new MethodInvoker(this.Sha1sum);
mi.BeginInvoke(null, null);
}
}