public bool Start() { try { bool bRet = InitOPCService(); if (!bRet) { return(false); } if (null == opcSerNodes || null == allOPCItemNodes) { NLogHelper.DefalutError("OPCBUSService.Start error,未配置opc服务"); return(false); } opcSer.Connect(host, guid); syncIOGroup = new SyncIOGroup(opcSer); refreshEventHandler = new RefreshEventHandler(RefreshEvent); refreshGroup = new RefreshGroup(opcSer, 10, refreshEventHandler); foreach (DriveNodeEntity item in allOPCItemNodes) { int iRet = refreshGroup.Add(item.nodeName); if (HRESULTS.Succeeded(iRet)) { Console.WriteLine(" true " + iRet); } } return(true); } catch (Exception ex) { NLogHelper.ExceptionInfo(ex, "Start StartOPCService exception: {0}", ex.Message); return(false); } }
/// <summary> /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed. /// <example> /// refresheventhandler.BeginInvoke(e, callback); /// </example> /// </summary> public static IAsyncResult BeginInvoke(this RefreshEventHandler refresheventhandler, RefreshEventArgs e, AsyncCallback callback) { if (refresheventhandler == null) { throw new ArgumentNullException("refresheventhandler"); } return(refresheventhandler.BeginInvoke(e, callback, null)); }
public Progress(string filename, RefreshEventHandler delg) { InitializeComponent(); RefreshDelg = delg; bgWorker = new BackgroundWorker(); bgWorker.WorkerReportsProgress = true; bgWorker.WorkerSupportsCancellation = false; bgWorker.DoWork += new DoWorkEventHandler(Exec); bgWorker.ProgressChanged += new ProgressChangedEventHandler(ProgressChanged); bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkCompleted); ExcelApi.Init(filename); count = 3; rows = ExcelApi.GetRows(); }
public Form1() { InitializeComponent(); RefreshTreeView += new RefreshEventHandler(LoadTreeFromBegin); RefreshTreeView?.Invoke(); }