public ControlMarket(int stockNum, MainWindow mainWindow)
        {
            InitializeComponent();
            //StockNum = stockNum;

            _mainWindow = mainWindow;

            _kernelTerminal = CKernelTerminal.GetKernelTerminalInstance();



            StockNum = stockNum;
            Loaded  += new RoutedEventHandler(ControlMarket_Loaded);
            ControlStockInstance.PriceCoordChanged += new EventHandler(OnPriceCoordChanged);
            ControlStockInstance.PriceCoordChanged += new EventHandler(ControlDealsInstance.OnPriceCoordChanged);
            ControlStockInstance.PriceCoordChanged += new EventHandler(ControlClustersInstance.OnPriceCoordChanged);


            //note: subscribe ControlMarket to MouseWheel event of ControlStock
            ControlStockInstance.DoScrollAllControls += new EventHandler(OnControllStockScrolled);

            /*  if (_modeMouse)
             * {
             *    MouseActiveIcon.Visibility = Visibility.Visible;
             * }
             * else if (!_modeMouse)
             * {
             *    MouseActiveIcon.Visibility = Visibility.Collapsed;
             * }
             */
            ControlStockInstance.PositionGrid = PositionGrid;



            ControlDealsInstance.LstLevel2     = ControlStockInstance.TenLevels;
            ControlDealsInstance.LstLevel1     = ControlStockInstance.FiftyLevels;
            ControlDealsInstance.DictPriceY    = ControlStockInstance.DictPriceY;
            ControlClustersInstance.DictPriceY = ControlStockInstance.DictPriceY;

            ControlClustersInstance.GetAvailableSpaceForScrollViewer = GetFreeSpaceForControlCluster;


            _timerCheckCoord.Elapsed += new ElapsedEventHandler(TimerCheckCoord_Elapsed);
            _timerCheckCoord.Start();



            //KAA onfocus event
            DoAllFocused += ToFocus;


            PreviewKeyDown += new KeyEventHandler(ControlMarket_PreviewKeyDown);
            PreviewKeyUp   += new KeyEventHandler(ControlMarket_PreviewKeyUp);
            //_mainWindow = (MainWindow)CUtilWin.FindWindow<MainWindow>();
            _mainWinDispatcher = Dispatcher.CurrentDispatcher;

            GenDPList();

            MouseDown += new MouseButtonEventHandler(ControlMarket_MouseDown);
        }
        public ControlClusters()
        {
            InitializeComponent();

            IsInitializeComplete = false;


            GenDPList();

            _renderer = new CRenderer(this, _drwVis);
            _alarmer  = CKernelTerminal.GetKernelTerminalInstance().Alarmer;

            if (_typeFaceDefault == null)
            {
                _typeFaceDefault = new Typeface(_fontFamilyDefault, FontStyles.Normal, _fontWeightDefault, new FontStretch());
            }
            _penClusterTotal = new Pen(Brushes.LightGray, 1.0);
            //KAA removed 2016-May-31
            // StringHeight = 13;
            _lstImageSegments.Add(Image_0);
            _lstImageSegments.Add(Image_1);
            _lstImageSegments.Add(Image_2);
            _lstImageSegments.Add(Image_3);
            _lstImageSegments.Add(Image_4);
            _lstImageSegments.Add(Image_5);
            _lstImageSegments.Add(Image_6);
            _lstImageSegments.Add(Image_7);
            _lstImageSegments.Add(Image_8);
            _lstImageSegments.Add(Image_9);

            ScrollViewerClusters.ScrollToRightEnd();

            for (int i = 0; i < _lstImageSegments.Count; i++)
            {
                RenderOptions.SetBitmapScalingMode(_lstImageSegments[i], BitmapScalingMode.NearestNeighbor);
                TextOptions.SetTextRenderingMode(_lstImageSegments[i], TextRenderingMode.ClearType);
                TextOptions.SetTextFormattingMode(_lstImageSegments[i], TextFormattingMode.Display);
            }
            RenderOptions.SetEdgeMode(this, EdgeMode.Aliased);



            //  CUtil.TaskStart(TaskTriggerPaint);
            CUtil.ThreadStart(ThreadDrawClusters);


            SizeChanged += ControlClusters_SizeChanged;

            GridCanvasControlClusters.MouseEnter += GridCanvasControlClusters_MouseEnter;

            _guiDispatcher = Dispatcher.CurrentDispatcher;
        }
Пример #3
0
        public void OpenAuthWindow(int connId, string stockName)
        {
            _kernelTerminal = CKernelTerminal.GetKernelTerminalInstance();
            AuthWindow aw = (AuthWindow)_kernelTerminal.ViewModelDispatcher.OpenChildWindow <AuthWindow>(false);

            aw.Left = this.Left + 30;
            aw.Top  = this.Top + 30;

            aw.SetParams(connId, stockName);
            Window win = (Window)aw;

            CUtilWin.ShowActivated(ref win);

            /*
             * AuthWindow aw = (AuthWindow) _kernelTerminal.ViewModelDispatcher.GetViewChild<AuthWindow>();
             * aw.SetParams(connId, stockName);
             * aw.Closed += new EventHandler(aw_Closed);
             * aw.ShowDialog();
             */
        }
        public BaseTerminalWindow()
        {
            // KernelTerminal = ((App)Application.Current).KernelTerminal;
            KernelTerminal = CKernelTerminal.GetKernelTerminalInstance();

            this.SizeChanged     += new SizeChangedEventHandler(BaseTerminalWindow_SizeChanged);
            this.LocationChanged += new EventHandler(BaseTerminalWindow_LocationChanged);
            // this.Loaded += new RoutedEventHandler(BaseTerminalWindow_Loaded);
            this.Initialized += new EventHandler(BaseTerminalWindow_Initialized);
            this.Closed      += new EventHandler(BaseTerminalWindow_Closed);

            _typeOfWindow = this.GetType();
            _geomWindow   = new CGeomWindow
            {
                TypeOfWindow = _typeOfWindow.ToString(),
                IsOpened     = true
            };

            //  (new Task(TaskSaveWindowLocation)).Start();
        }
Пример #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                List <CColor> lstColors = CKernelTerminal.GetKernelTerminalInstance().ColorList.ListColors;

                ColorList.ItemsSource = lstColors;

                //PropertyInfo[] props = typeof(Brushes).GetProperties();

                string stFill        = rtlfill.Fill.ToString();
                Color  colorSelected = (Color)ColorConverter.ConvertFromString(stFill);
                string stColor       = colorSelected.ToString();

                for (int i = 0; i < lstColors.Count; i++)
                {
                    string colorName = lstColors[i].Name;
                    Color  clr       = (Color)ColorConverter.ConvertFromString(colorName);

                    if (clr == colorSelected)
                    {
                        ColorList.SelectedItem = ColorList.Items[i];
                        //ColorList.SelectedIndex = i;
                        ColorList.UpdateLayout();
                        var listBoxItem = (ListBoxItem)ColorList.ItemContainerGenerator.ContainerFromItem(ColorList.SelectedItem);



                        listBoxItem.Focus();
                    }
                }
            }
            catch (Exception exc)
            {
                CKernelTerminal.ErrorStatic("ColorSelectionWindow.Window_Loaded", exc);
            }
        }