public bool Start(HostControl hostControl) { this.stopwatch.Start(); Console.WriteLine(@"Starting the queue data generator"); var observer = Msmq(); // Data stream var integerSequence = Observable.Interval(TimeSpan.FromMilliseconds(2)); var source = (from n in integerSequence select TxItem.Demo(n)); this.sourceSubscriber = source.Subscribe(observer); return(true); }
public void AddTransaction(TransactionInfo info) { bool isAdd = true; for (int i = 0; i < txItems.Count; i++) { if (txItems[i]._info.Transaction.Hash == info.Transaction.Hash) { isAdd = false; break; } } if (isAdd) { TxItem item = new TxItem(info); item.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(56)))), ((int)(((byte)(66))))); item.Location = new System.Drawing.Point(30, 16 + (txItems.Count) * (70 + 10)); item.Name = "txItem" + info.Transaction.Hash.ToString(); item.Size = new System.Drawing.Size(500, 70); item.TabIndex = 100; this.pan_history.Controls.Add(item); txItems.Add(item); if (txItems.Count * 80 + 16 > pan_history.Height) { vsb_history.Maximum = txItems.Count * 80 + 16 - pan_history.Height + 16; vsb_history.Show(); } } if (txItems.Count > 0) { lbl_no_history.Hide(); } }
public IObservable <int> Write(TxItem item, string connectionString, string commandText) { return(Observable.Create <int>( async o => { try { using (var conn = new SqlConnection(connectionString)) { using (var cmd = new SqlCommand(commandText)) { await conn.OpenAsync().ConfigureAwait(false); await cmd.ExecuteNonQueryAsync().ConfigureAwait(false); } } } catch (Exception ex) { o.OnError(ex); } o.OnCompleted(); })); }