public Form1()
        {
            InitializeComponent();
            Persons = new BindingList <Data>();
            for (int i = 0; i < Count; i++)
            {
                Persons.Add(new Data {
                    Id       = i,
                    Text     = "Text" + i,
                    Progress = GetNumber()
                });
            }


            RealTimeSource rts = new RealTimeSource()
            {
                DataSource = Persons
            };

            gridControl1.DataSource = rts;

            Timer timer = new Timer(components);

            timer.Interval = 10;
            timer.Tick    += Tick;
            timer.Start();

            RepositoryItemProgressBar item = new RepositoryItemProgressBar();

            gridControl1.RepositoryItems.Add(item);
            gridView1.Columns["Progress"].ColumnEdit = item;
        }
示例#2
0
        public ImportDataSource(DmModel model, string folderPath, bool includeSubfolders)
        {
            this._rts = new RealTimeSource()
            {
                DataSource = this._files,
            };
            SearchOption         option  = includeSubfolders ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
            IEnumerable <string> folders = new List <string> {
                folderPath
            } as IEnumerable <string>;

            folders = folders.Concat(SafeFileEnumerator.EnumerateDirectories(folderPath, "*", option));

            this._worker = new BackgroundWorker();
            this._worker.WorkerSupportsCancellation = true;
            this._worker.DoWork += (sender, args) => {
                var dirs = args.Argument as IEnumerable <string>;
                var w    = sender as BackgroundWorker;
                foreach (var dir in dirs)
                {
                    if ((w.CancellationPending))
                    {
                        args.Cancel = true;
                        break;
                    }
                    var files   = SafeFileEnumerator.EnumerateFiles(dir, "*", SearchOption.TopDirectoryOnly);
                    var dmFiles = model.Helper.AddFileHelper.GetFilesToAdd(files);
                    foreach (var dmfile in dmFiles)
                    {
                        lock (locker) { this._files.Add(dmfile); }
                    }
                }
            };
            this._worker.RunWorkerAsync(folders);
        }
        static RealTimeSource CreateRealTimeSource(IList dataSource)
        {
            RealTimeSource rts = new RealTimeSource {
                DataSource = dataSource
            };

            return(rts);
        }
 void DisposeRealTimeSource()
 {
     if (realTimeSource != null)
     {
         realTimeSource.DataSource = null;
         realTimeSource.Dispose();
     }
     realTimeSource = null;
 }
示例#5
0
        private void SetupGridView()
        {
            realTimeSource1                     = new RealTimeSource();
            realTimeSource1.DataSource          = _watchListBinding;
            realTimeSource1.UseWeakEventHandler = true;
            gridControl1.DataSource             = realTimeSource1;

            gridView1.Columns.Clear();
            GridColumn symCol = new GridColumn()
            {
                Caption = "Sym", Visible = true, FieldName = "Sym"
            };

            gridView1.Columns.Add(symCol);

            GridColumn bidCol = new GridColumn()
            {
                Caption = "Bid", Visible = true, FieldName = "Bid"
            };

            bidCol.DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
            bidCol.DisplayFormat.FormatString = "f2";
            gridView1.Columns.Add(bidCol);

            GridColumn bidSzCol = new GridColumn()
            {
                Caption = "BidSz", Visible = true, FieldName = "BidSz"
            };

            gridView1.Columns.Add(bidSzCol);

            GridColumn askCol = new GridColumn()
            {
                Caption = "Ask", Visible = true, FieldName = "Ask"
            };

            askCol.DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
            askCol.DisplayFormat.FormatString = "f2";
            gridView1.Columns.Add(askCol);

            GridColumn askSzCol = new GridColumn()
            {
                Caption = "AskSz", Visible = true, FieldName = "AskSz"
            };

            gridView1.Columns.Add(askSzCol);

            GridColumn lastCol = new GridColumn()
            {
                Caption = "Last", Visible = true, FieldName = "Last"
            };

            lastCol.DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
            lastCol.DisplayFormat.FormatString = "f2";
            gridView1.Columns.Add(lastCol);
        }
 public RealtimeDataSource()
 {
     viewModel   = new RealtimeDataSourceViewModel();
     DataContext = viewModel;
     InitializeComponent();
     viewModel.TimerShowTick += model_TimerShowTick;
     PatchInterval();
     realTimeSource               = CreateRealTimeSource(viewModel.List);
     grid.ItemsSource             = realTimeSource;
     viewModel.WithRealTimeSource = true;
     Unloaded += RealtimeDataSource_Unloaded;
 }
 void CheckBox_Checked(object sender, RoutedEventArgs e)
 {
     if (grid == null)
     {
         return;
     }
     grid.ItemsSource = null;
     realTimeSource   = CreateRealTimeSource(viewModel.List);
     grid.ItemsSource = realTimeSource;
     viewModel.Update();
     PatchInterval();
 }
        protected void InitializeCustomComponents()
        {
            this.Disposed += BasicDXView_Disposed;

            syncContext   = SynchronizationContext.Current;
            updaterThread = new UpdaterThread(syncContext);

            double pow = (34 - 10 + 3) / 2.0;

            updaterThread.InterEventDelay = (int)Math.Pow(2.0, pow);

            //updaterThread.InterEventDelay = 500;

            realTimeSource             = CreateRealTimeSource();
            bookGridControl.DataSource = realTimeSource;

            backgroundTimer = new Timer(updaterThread.OnIdle, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(10));

            starterThread = new Thread(updaterThread.Do);
            starterThread.IsBackground = true;
            starterThread.Start();

            realTimeSource.DataSource = updaterThread.List;
        }
示例#9
0
        private void SetupGridView()
        {
            realTimeSource1                       = new RealTimeSource();
            realTimeSource1.DataSource            = _bindingList;
            realTimeSource1.DisplayableProperties = "Exch;Price;Size;";
            realTimeSource1.UseWeakEventHandler   = true;
            gridControl1.DataSource               = realTimeSource1;

            gridView1.Columns.Clear();
            GridColumn exchCol = new GridColumn()
            {
                Caption = "Exch", Visible = true, FieldName = "Exch"
            };

            gridView1.Columns.Add(exchCol);

            GridColumn priceCol = new GridColumn()
            {
                Caption = "Price", Visible = true, FieldName = "Price"
            };

            priceCol.DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
            priceCol.DisplayFormat.FormatString = "f2";
            gridView1.Columns.Add(priceCol);
            priceCol.SortOrder = _buy ? ColumnSortOrder.Descending : ColumnSortOrder.Ascending;
            priceCol.SortIndex = 0;

            GridColumn sizeCol = new GridColumn()
            {
                Caption = "Size", Visible = true, FieldName = "Size"
            };

            gridView1.Columns.Add(sizeCol);
            sizeCol.SortOrder = ColumnSortOrder.Descending;
            sizeCol.SortIndex = 1;
        }
        void OnArbitrageChanged(StatisticalArbitrageStrategy prev, StatisticalArbitrageStrategy current)
        {
            if (prev != null)
            {
                prev.Tag = null;
            }

            if (current != null)
            {
                current.Tag = this;
            }

            RealTimeSource source = new RealTimeSource()
            {
                DataSource = Arbitrage.History
            };

            UpperName = Arbitrage.SecondName.ToString() + " (upper)";
            LowerName = Arbitrage.FirstNames[0].ToString() + " (lower)";

            this.myChartControl1.Series["Upper"].DataSource         = source;
            this.myChartControl1.Series["Upper"].ArgumentDataMember = "Time";
            this.myChartControl1.Series["Upper"].ValueDataMembers.AddRange("UpperBidChart");
            this.myChartControl1.Series["Upper"].Name = UpperName;

            this.myChartControl1.Series["Lower"].DataSource         = source;
            this.myChartControl1.Series["Lower"].ArgumentDataMember = "Time";
            this.myChartControl1.Series["Lower"].ValueDataMembers.AddRange("LowerAskChart");
            this.myChartControl1.Series["Lower"].Name = LowerName;

            this.myChartControl1.Series["Deviation"].DataSource         = source;
            this.myChartControl1.Series["Deviation"].ArgumentDataMember = "Time";
            this.myChartControl1.Series["Deviation"].ValueDataMembers.AddRange("MaxDeviationLog");

            this.gridControl1.DataSource = source;
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        static RealTimeSource CreateRealTimeSource()
        {
            RealTimeSource realTimeSource = new RealTimeSource();

            return(realTimeSource);
        }
示例#12
0
        private RealTimeSource CreateRealTimeSource()
        {
            RealTimeSource rts = new RealTimeSource();

            return(rts);
        }
示例#13
0
        private void SetupGridView()
        {
            realTimeSource1                     = new RealTimeSource();
            realTimeSource1.DataSource          = _orderList;
            realTimeSource1.UseWeakEventHandler = true;
            gridControl1.DataSource             = realTimeSource1;

            gridView1.Columns.Clear();
            GridColumn fillTSCol = new GridColumn()
            {
                Caption = "LastExecTS", Visible = false, FieldName = "LastExecTS"
            };

            fillTSCol.DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
            fillTSCol.DisplayFormat.FormatString = "HH:mm:ss:fff";
            gridView1.Columns.Add(fillTSCol);

            GridColumn orderIDCol = new GridColumn()
            {
                Caption = "OrderID", Visible = false, FieldName = "orderID"
            };

            gridView1.Columns.Add(orderIDCol);
            orderIDCol.SortOrder = ColumnSortOrder.Descending;

            GridColumn symCol = new GridColumn()
            {
                Caption = "Sym", Visible = true, FieldName = "Symbol"
            };

            gridView1.Columns.Add(symCol);

            GridColumn exchCol = new GridColumn()
            {
                Caption = "Exch", Visible = true, FieldName = "exchange"
            };

            gridView1.Columns.Add(exchCol);

            GridColumn sideCol = new GridColumn()
            {
                Caption = "Side", Visible = true, FieldName = "side"
            };

            gridView1.Columns.Add(sideCol);

            GridColumn statusCol = new GridColumn()
            {
                Caption = "Status", Visible = true, FieldName = "status"
            };

            gridView1.Columns.Add(statusCol);

            GridColumn qtyCol = new GridColumn()
            {
                Caption = "OrderQty", Visible = true, FieldName = "qty"
            };

            gridView1.Columns.Add(qtyCol);

            GridColumn lastQtyCol = new GridColumn()
            {
                Caption = "LastQty", Visible = true, FieldName = "lastQtyExecuted"
            };

            gridView1.Columns.Add(lastQtyCol);

            GridColumn remQtyCol = new GridColumn()
            {
                Caption = "RemainingQty", Visible = true, FieldName = "remainingQuantity"
            };

            gridView1.Columns.Add(remQtyCol);

            GridColumn fillQtyCol = new GridColumn()
            {
                Caption = "FillQty", Visible = true, FieldName = "fillQuantity"
            };

            gridView1.Columns.Add(fillQtyCol);

            GridColumn priceCol = new GridColumn()
            {
                Caption = "Price", Visible = true, FieldName = "prc"
            };

            gridView1.Columns.Add(priceCol);

            GridColumn tifCol = new GridColumn()
            {
                Caption = "TiF", Visible = true, FieldName = "tif"
            };

            gridView1.Columns.Add(tifCol);

            GridColumn typeCol = new GridColumn()
            {
                Caption = "Type", Visible = true, FieldName = "type"
            };

            gridView1.Columns.Add(typeCol);

            GridColumn errorCol = new GridColumn()
            {
                Caption = "Error", Visible = true, FieldName = "Error"
            };

            gridView1.Columns.Add(errorCol);
        }