コード例 #1
0
        /// <summary>
        /// Handles closing event if invoked for certain scanner window
        /// </summary>
        void scannerWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            MarketScannerWindow scannerWindow = (MarketScannerWindow)sender;

            if (WPFMessageBox.Show(scannerWindow, string.Format("Close scanner window {0}?", scannerWindow.Title), "Market Data Scanner",
                                   MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
            {
                e.Cancel = true;
            }
            else
            {
                // If scanner window is closing...

                // close all LOB windows related to current scanner window
                foreach (Window window in Application.Current.Windows)
                {
                    if (window is LimitOrderBookWindow && window.Title.Contains(scannerWindow.Title))
                    {
                        window.DataContext = null;
                        window.Close();
                    }
                }

                // remove that MarketScannerWindowViewModel from collection
                MarketScannerWindowViewModel scannerViewModel = ScannerWindowViewModels.First <MarketScannerWindowViewModel>(x => x.Provider.ProviderName == scannerWindow.Title);
                if (scannerViewModel != null)
                {
                    scannerViewModel.RemoveAllSymbols();
                    ScannerWindowViewModels.Remove(scannerViewModel);
                }

                // activate MainWindow
                MainWindow.Activate();
            }
        }
コード例 #2
0
        /// <summary>
        /// Create market scanner for selected market data provider
        /// </summary>
        private void CreateScannerWindowExecute()
        {
            // Try to find scanner window if already created for selected provider
            MarketScannerWindow scannerWindow = (MarketScannerWindow)FindWindowByTitle(SelectedMarketDataProvider.ProviderName);

            // if scanner is already created, just activate it, otherwise create new scanner window for slected data provider
            if (scannerWindow != null)
            {
                scannerWindow.WindowState = WindowState.Normal;
                scannerWindow.Activate();
            }
            else
            {
                scannerWindow = new MarketScannerWindow();
                MarketScannerWindowViewModel scannerWindowViewModel = new MarketScannerWindowViewModel(scannerWindow, SelectedMarketDataProvider, MarketDataProviders);

                // Add scanner window VeiwModel in collection for displaying on Market Scanner Dashboard
                ScannerWindowViewModels.Add(scannerWindowViewModel);

                scannerWindow.DataContext = scannerWindowViewModel;
                scannerWindow.Title       = SelectedMarketDataProvider.ProviderName;
                scannerWindow.Closing    += scannerWindow_Closing;
                scannerWindow.Show();
            }

            // Detach DataContext and close 'New Market Scanner' window
            _newMarketScannerWindow.DataContext = null;
            _newMarketScannerWindow.Close();
        }
コード例 #3
0
        /// <summary>
        /// Close certain market scanner window
        /// </summary>
        /// <param name="param">ProviderName</param>
        private void CloseScannerWindowExecute(object param)
        {
            // Close scanner window
            MarketScannerWindow scannerWindow = (MarketScannerWindow)FindWindowByTitle((string)param);

            if (scannerWindow != null)
            {
                scannerWindow.Close();
            }
        }
コード例 #4
0
        /// <summary>
        /// Focus certain market scanner window
        /// </summary>
        /// <param name="param">ProviderName</param>
        private void FocusScannerWindowExecute(object param)
        {
            MarketScannerWindow scannerWindow = (MarketScannerWindow)FindWindowByTitle((string)param);

            if (scannerWindow != null)
            {
                scannerWindow.WindowState = WindowState.Normal;
                scannerWindow.Activate();
            }
        }