Exemplo n.º 1
0
        public ColorSelectionWindow(string bindColorPropertyName)
        {
            InitializeComponent();


            CUtil.SetBinding(CViewModelDispatcher.GetTerminalViewModel(), bindColorPropertyName, rtlfill, Rectangle.FillProperty, twoWayBinding: true);
        }
        public MarketViewModel(int stockNum, ControlMarket controlMain, CKernelTerminal kernelTerminal,
                               CStocksVisual stockVisual, CInstrumentConfig instrumentConfig)
        {
            StockNum = stockNum;
            string tickerName = stockVisual.Ticker;


            IsAlive = true;
            IsDead  = false;


            SelectionMode = new CSelectionMode();
            string tf = instrumentConfig.MarketProperties.ClusterProperties.TimeFrame;

            _clusterProcessor = new CClusterProcessor(tickerName, tf);
            _userLevels       = new CUserLevels(tickerName);


            _eventRouterViewModel = new CEventRouterViewModel(this);

            // int conId = stockVisual.ConNumm;



            _orders = new OrderData[Params.MaxUserOrdersPerInstr];



            _terminalViewModel = CViewModelDispatcher.GetTerminalViewModel();



            int parUpdateStockPerSec = kernelTerminal.TerminalConfig.UpdateStockPerSec;

            _parSleep = (int)(1 / (double)parUpdateStockPerSec * 1000);

            _instrumentConfig = instrumentConfig;

            //    (new Thread(TestPar)).Start();


            GUIDispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;

            _controlMarket  = controlMain;
            _kernelTerminal = kernelTerminal;
            _communicator   = kernelTerminal.Communicator;

            //TextPriceSize = "10";
            //  StringHeight = "10";

            CurrAmountNum  = "0";
            ListWorkAmount = new List <CWorkAmount>();

            SetInstrumentParams(stockVisual);
            _vmUserPos = new ViewModelUserPos(Decimals, Step);



            _parMaxVolumeBar = Int32.MaxValue;

            //RaisePropertyChanged("Contract_ShortName");


            ConnId = stockVisual.ConNumm;// conId;



            MonitorUserOrders = new Dictionary <long, COrder>();


            if (tickerName != null)
            {
                _logger = new CLogger("MarketViewModel_" + tickerName);
            }

            Log("Start logging__________________________________________");



            InitBidsAsks();



            //TODO remove
            this.InitializeStockData();

            SetMouseMode(true);

            _threadDataReciever = new Thread(ThreadDataReciever);
            _threadDataReciever.Start();


            //BindWorkAmount();
        }