Example #1
0
        public List <BaseRow> ReadTable(O2GTable table)
        {
            var list = new List <BaseRow>();

            switch (table.Type)
            {
            case O2GTableType.Accounts:
            {
                list.AddRange(this.GetRows((O2GAccountsTable)table));
            }
            break;

            case O2GTableType.ClosedTrades:
            {
                list.AddRange(this.GetRows((O2GClosedTradesTable)table));
            }
            break;

            case O2GTableType.Messages:
            {
                list.AddRange(this.GetRows((O2GMessagesTable)table));
            }
            break;

            case O2GTableType.Offers:
            {
                list.AddRange(this.GetRows((O2GOffersTable)table));
            }
            break;

            case O2GTableType.Orders:
            {
                list.AddRange(this.GetRows((O2GOrdersTable)table));
            }
            break;

            case O2GTableType.Summary:
            {
                list.AddRange(this.GetRows((O2GSummaryTable)table));
            }
            break;

            case O2GTableType.Trades:
            {
                list.AddRange(this.GetRows((O2GTradesTable)table));
            }
            break;
            }

            return(list);
        }
Example #2
0
        public void GetTableData(O2GTable table, IO2GTableListener listener,
                                 O2GRow row, O2GTableManager mTblMgr)
        {
            try
            {
                table.subscribeUpdate(O2GTableUpdateType.Insert, listener);
                table.subscribeUpdate(O2GTableUpdateType.Update, listener);
                try
                {
                    mTblMgr.lockUpdates();
                    for (int ii = 0; ii < table.Count; ii++)
                    {
                        row = table.getGenericRow(ii);

                        foreach (O2GTableColumn CurrentColumn in table.Columns)
                        {
                            for (int jj = 0; jj < row.Columns.Count; jj++)
                            {
                                if (CurrentColumn.ID == row.Columns[jj].ID)
                                {
                                    dataGridView.Rows[ii].Cells[CurrentColumn.ID].Value = row.getCell(jj);
                                }
                            }
                        }
                    }
                }
                finally
                {
                    mTblMgr.unlockUpdates();
                }

                table.unsubscribeUpdate(O2GTableUpdateType.Insert, listener);
                table.unsubscribeUpdate(O2GTableUpdateType.Update, listener);
            }
            catch (Exception e)
            {
                LogDirector.DoAction(4, e);
            }
        }