コード例 #1
0
        public void Test()
        {
            // Collection with 1 item to make this test simple
            Items = new ContinuousCollection<NotifiableItem>
                                {
                                    new NotifiableItem { TestValue1 = 3, TestValue2 = 10 },
                                };

            // Start with TestValue1
            MaxValueCV = Items.ContinuousMax(item => item.TestValue1, value => Max = value);
            Console.WriteLine("MaxValueCV = " + MaxValueCV.CurrentValue);
            Console.WriteLine("Max = " + Max);
            Console.WriteLine();

            // Switch to TestValue2
            MaxValueCV = Items.ContinuousMax(item => item.TestValue2, value => Max = value);
            Console.WriteLine("MaxValueCV = " + MaxValueCV.CurrentValue);
            Console.WriteLine("Max = " + Max);
            Console.WriteLine();
            GC.Collect();
            WeakPropertyChangedEventManager.RemoveCollectedEntries();
            GC.Collect();
            // Now set TestValue1
            Items[0].TestValue1 = 20;
            Console.WriteLine("(BUG)");
            Console.WriteLine("MaxValueCV = " + MaxValueCV.CurrentValue);
            // BUG: Max is set to 20 when it should be 10
            Console.WriteLine("Max = " + Max);

            Assert.AreEqual(10, Max);

            Console.Write("Hit enter to continue...");
            Console.ReadLine();
        }
コード例 #2
0
ファイル: PausedAggregation.cs プロジェクト: git-thinh/clinq
 public void Dispose()
 {
     if (!_wasDisposed)
     {
         ContinuousValue.GlobalResume();
         _wasDisposed = true;
     }
 }
コード例 #3
0
ファイル: ModelRoot.cs プロジェクト: ismell/Continuous-LINQ
        public ModelRoot()
        {
            _allTransactions = new ObservableCollection<StockTransaction>();

            // Note that all of these queries are defined against an EMPTY
            // source collection...
            _bids = from tx in _allTransactions
                    where tx.TransactionType == TransactionType.Bid &&
                          tx.Symbol == "AAPL"
                    orderby tx.Price ascending
                    select tx;

            _asks = from tx in _allTransactions
                    where tx.TransactionType == TransactionType.Ask &&
                          tx.Symbol == "AAPL"
                    orderby tx.Price descending
                    select tx;

            _executions = from tx in _allTransactions
                          where tx.TransactionType == TransactionType.Execution &&
                                tx.Symbol == "AAPL"
                          orderby tx.Price descending
                          select tx;

            _graphExecutions = from tx in _executions
                               where tx.TimeStamp >= DateTime.Now.AddMinutes(-5)
                               select tx;

            _minPrice = _executions.ContinuousMin(tx => tx.Price,
                                                       newPrice => this.CurrentMin = newPrice);
            _maxPrice = _executions.ContinuousMax(tx => tx.Price,
                                                       newPrice => this.CurrentMax = newPrice);

            _vwap = _executions.ContinuousVwap(tx => tx.Price, tx => tx.Quantity,
                newVwap => this.CurrentVwap = newVwap);

            _simulationTimer = new Timer(1000);
            _simulationTimer.Elapsed += GenerateBogusData;
            _simulationTimer.Start();
        }
コード例 #4
0
ファイル: PausedAggregation.cs プロジェクト: git-thinh/clinq
 public PausedAggregation()
 {
     ContinuousValue.GlobalPause();
 }