Пример #1
0
        /// <summary>
        /// 已经成交了的订单
        /// </summary>
        /// <param name="item"></param>
        public void _TradedOrder(RecordTransItem item)
        {
            List <RecordTransItem> removeItems = new List <RecordTransItem>();

            foreach (var it in PositionRecords)
            {
                if (it.direction != item.direction)
                {
                    removeItems.Add(it);
                    break;
                }
            }

            if (removeItems.Count() > 0)
            {
                foreach (var it in removeItems)
                {
                    Invoke_OnRemovePosition(it);
                    PositionRecords.Remove(it);
                }
            }
            else
            {
                Invoke_OnInsertPosition(item);
                PositionRecords.Add(item);
            }


            Invoke_OnInsertOrder(item);

            HistoryRecords.Add(item);
        }
        async Task ExecuteLoadRecordsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                HistoryRecords.Clear();
                var items = await DataStore.GetRecordsAsync();

                foreach (var item in items)
                {
                    HistoryRecords.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Пример #3
0
        public void Record(int bookId, int tocID, NavigationType type = NavigationType.TOCDocument, int pageNum = 0, object tag = null)
        {
            NavigationRecord record = new NavigationRecord
            {
                BookId  = bookId,
                TOCId   = tocID,
                PageNum = pageNum,
                Type    = type,
                Tag     = tag
            };

            if (CurrenRecordIndex == HistoryRecords.Count - 1)
            {
                CurrenRecordIndex++;
                HistoryRecords.Add(record);
            }
            else if (CurrenRecordIndex < HistoryRecords.Count - 1)
            {
                CurrenRecordIndex++;
                HistoryRecords.RemoveRange(CurrenRecordIndex, HistoryRecords.Count - CurrenRecordIndex);
                HistoryRecords.Add(record);
            }
            BackWard = CurrenRecordIndex > 0 ? true : false;
            ForWard  = false;
        }
Пример #4
0
 public void Record(string words)
 {
     if (CurrenRecordIndex == HistoryRecords.Count - 1)
     {
         CurrenRecordIndex++;
         HistoryRecords.Add(words);
     }
     else if (CurrenRecordIndex < HistoryRecords.Count - 1)
     {
         CurrenRecordIndex++;
         HistoryRecords.RemoveRange(CurrenRecordIndex, HistoryRecords.Count - CurrenRecordIndex);
         HistoryRecords.Add(words);
     }
     IsCanBackWard = CurrenRecordIndex > 0 ? true : false;
     IsCanForWard  = false;
 }
Пример #5
0
        public void Read(BinaryReader binaryReader)
        {
            HistoryRecords.Clear();
            IsNull = binaryReader.ReadBoolean();

            if (IsNull)
            {
                return;
            }
            else
            {
                var length = binaryReader.ReadInt32();

                for (var i = 0; length > i; i++)
                {
                    var historyRecord = new ROCMaster_HistoryRecord();
                    historyRecord.Read(binaryReader);
                    HistoryRecords.Add(historyRecord);
                }
            }
        }
Пример #6
0
 public ROCMaster_HistoryRecordArray AddHistoryRecord(ROCMaster_HistoryRecord historyRecord)
 {
     HistoryRecords.Add(historyRecord);
     return(this);
 }
Пример #7
0
 public HistoryRecordArray AddHistoryRecord(HistoryRecord historyRecord)
 {
     HistoryRecords.Add(historyRecord);
     return(this);
 }