コード例 #1
0
        protected internal override void HandleProcessedDataRows(object sender, CursorDataReadProgressChangedArgs e)
        {
            // construct data, create eventargs, raise event
            JsonCreator    jc         = new JsonCreator(this);
            List <JObject> list       = jc.SerializeRowValues(e.RowValues);
            var            jsonString = "[" + string.Join(",", list.Select(o => o.ToString())) + "]";
            // do custom bubbling up
            ExportProgressChangedArgs args = new ExportProgressChangedArgs(
                e.RowsProcessed,
                e.RowsTotal,
                jsonString);

            base.OnWriterProgressChanged(args);
        }
コード例 #2
0
ファイル: BaseWriter.cs プロジェクト: arnovb-github/CmcLibNet
        /// <summary>
        /// Handler used to bubble up the ExportProgressChanged event
        /// </summary>
        /// <param name="e">ExportProgressAsJsonChangedArgs.</param>
        protected virtual void OnWriterProgressChanged(ExportProgressChangedArgs e)
        {
            ExportProgressChangedHandler handler = WriterProgressChanged;

            if (handler == null)
            {
                return;
            }                                // no subscriptions
            Delegate[] eventHandlers = handler.GetInvocationList();
            foreach (Delegate currentHandler in eventHandlers)
            {
                ExportProgressChangedHandler currentSubscriber = (ExportProgressChangedHandler)currentHandler;
                try
                {
                    currentSubscriber(this, e);
                }
                catch { }
            }
        }
コード例 #3
0
ファイル: BaseWriter.cs プロジェクト: arnovb-github/CmcLibNet
 // overload that allows derivers to supply their own ExportProgressChangedArgs
 protected void BubbleUpProgressEvent(ExportProgressChangedArgs e)
 {
     OnWriterProgressChanged(e);
 }
コード例 #4
0
 /// <summary>
 /// Raise the ExportProgressChanged event.
 /// </summary>
 /// <param name="e">ExportProgressAsStringChangedArgs object.</param>
 protected virtual void OnExportProgressChanged(ExportProgressChangedArgs e)
 {
     ExportProgressChanged?.Invoke(this, e);
 }
コード例 #5
0
 // we need some mechanism to tell consumers about the progress of our export
 // the writer classes are not exposed, so we need to capture the events of those classes,
 // and then raise an event that consumers can subscribe to.
 /// <summary>
 /// Event handler for the ExportProgressChanged event.
 /// </summary>
 /// <param name="sender">sender object.</param>
 /// <param name="e">ExportProgressAsJsonChangedArgs object.</param>
 public virtual void HandleExportProgressChanged(object sender, ExportProgressChangedArgs e)
 {
     // just re-raise event
     OnExportProgressChanged(e); // outside assemblies can subscribe to this
 }