public DataTable Enter() { DataTable dt = new DataTable(); dt.Columns.Add("交易所"); foreach (var item in CoinList) { dt.Columns.Add(item.ToString()); } for (int i = 0; i < ExChanges.Count; i++) { dt.Rows.Add(); dt.Rows[i][0] = ExChanges[i].GetExchangeName(); for (int j = 0; j < CoinList.Count; j++) { FuncHandle fh = new FuncHandle(this.AscySingle); IAsyncResult ar = fh.BeginInvoke(ExChanges[i], CoinList[j], null, fh); dt.Rows[i][j + 1] = fh.EndInvoke(ar); } } return(dt); }
// connect to the server or refresh private void Conect_btn_Click(object sender, RoutedEventArgs e) { fh = new FuncHandle(this.send_data_rev_data); AsyncCallback callback = new AsyncCallback(this.AsyncCallbackImpl); fh.BeginInvoke(callback, null); }
static void Main(string[] args) { //CommonSingle commonSingle = CommonSingle.GetInstance(); //Console.WriteLine(commonSingle.GetHashCode()); FuncHandle fh = new FuncHandle(CommonSingle.GetInstance); FuncHandle fh1 = new FuncHandle(CommonSingle.GetInstance); AsyncCallback ac = new AsyncCallback(AsyncCallbackImpl); IAsyncResult result = fh.BeginInvoke(null, fh); IAsyncResult result1 = fh1.BeginInvoke(null, fh1); CommonSingle re = fh.EndInvoke(result); CommonSingle re1 = fh1.EndInvoke(result1); Console.WriteLine("----------------"); Console.WriteLine(re.GetHashCode()); Console.WriteLine(re1.GetHashCode()); Console.WriteLine(re.Equals(re1)); /* Lazy */ LazyHandle lazyHandler= new LazyHandle(LazySingle.GetInstance); LazyHandle lazyHandler1 = new LazyHandle(LazySingle.GetInstance); IAsyncResult lazyResult = lazyHandler.BeginInvoke(null, lazyHandler); IAsyncResult lazyResult1 = lazyHandler1.BeginInvoke(null, lazyHandler1); Console.WriteLine(((LazySingle)lazyHandler.EndInvoke(lazyResult)).GetHashCode()); Console.WriteLine(((LazySingle)lazyHandler1.EndInvoke(lazyResult1)).GetHashCode()); Console.Read(); }
private void btnGKD_Click(object sender, EventArgs e) { //if (btnGKD.Text == "太慢🌶,给👴停下,下一张") //{ // btnGKD.Text = "再来1️🐙给👴👀👀"; //} btnGKD.Enabled = false; fh = new FuncHandle(this.loadData); AsyncCallback callback = new AsyncCallback(this.AsyncCallbackImpl); fh.BeginInvoke(callback, null); }
/// <summary> /// 获取数据 /// </summary> /// <param name="argId">参数id</param> public static T Get(int argId) { List <FuncHandle> funcs = _pool.GetValueAnyway(argId); if (funcs != null && funcs.Count > 0) { FuncHandle highest = funcs[funcs.Count - 1]; if (highest?.Func != null) { return(highest.Func.Invoke()); } } return(default(T)); }
private void frmSetu_Load(object sender, EventArgs e) { Control.CheckForIllegalCrossThreadCalls = false; //reSetSize((frmSetu) sender); container.Width = this.Width; container.Height = ((frmSetu)sender).Height - btnGKD.Height - progress.Height - groupBox1.Height - 50; picSetu.Width = this.Width - 30; picSetu.Height = container.Height - 50; comStyle.SelectedIndex = 0; comSetuType.SelectedIndex = 1; picSetu.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.picSetu_MouseWheel); // SyncCallBack(loadData()); //异步调取涩图 fh = new FuncHandle(this.loadData); AsyncCallback callback = new AsyncCallback(this.AsyncCallbackImpl); fh.BeginInvoke(callback, null); frmSetu_Resize(this, null); }