void DatagridTickers_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { try { var dg = (DataGrid)sender; int conNum = (int)dg.Tag; int rowNum = CUtilWPF.GetDataGridClickedRowNum(e); CTIckerData tickerData = (CTIckerData)dg.Items[rowNum]; string ticker = tickerData.TickerName; if (KernelTerminal.ViewModelDispatcher.IsMarketViewModelExist(ticker)) { AllertWindow win = new AllertWindow("Невозможно выбрать инструмент. Стакан с таким инструментом уже существует."); win.Topmost = true; Window wn = (Window)win; // CUtilWin.ShowActivated(ref wn); Window windowRoot = (Window)CUtilWin.FindWindow <AvailableTickersWindow>(); CUtilWin.ShowDialogOnCenter(wn, windowRoot); //CUtilWin.ShowDialogOnCenter(ref wn, _); //win.Show(); return; } //note put to method marketViewModel as parameters MarketViewModel currMarketViewModel = _winAvailTicks.CurrentMarketViewModel; KernelTerminal.ChangeMarketInstrument(conNum, tickerData, currMarketViewModel); // (new Task(KernelTerminal.TaskSaveVisualConf)).Start(); _winAvailTicks.Close(); } catch (Exception exc) { Error("DatagridTickers_PreviewMouseDown", exc); } }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { // (new Thread(ForceRenderOnLoad)).Start(); ReOpenChildWindows(); RetriveBorderFromTemplate(); if (_terminalViewModel.NeedAutoConnection) { KernelTerminal.AutoConnection(); } }
public void CloseWindow() { try { KernelTerminal.OnClose(); //TODO normal exit // Application.Current.Shutdown(); System.Diagnostics.Process.GetCurrentProcess().Kill(); } catch (Exception exc) { Error("MainWindow.CloseWindow", exc); } }
/// <summary> /// 1) Call KernelTerminal.AddEmptyStockFromButton to create ControlMarket and MarketViewModel. /// After creation perform Callback CreateStockCell (adds ControlMarket to Grid). /// 2) After creating manage Stock elements: WindowControlPannel and buttons, /// control width of Stocks /// /// Call from EventHandler - ButtonAddStock_PreviewMouseUp /// </summary> public void AddStockFromButton() { try { int stockNum = KernelTerminal.AddEmptyStockFromButton(this, CreateStockCell); HideWindowControlPanels(); CheckStocksForButtDelDisable(); CheckStocksForDelEnable(); CheckAddButtonVisibility(); SetWidthOfStocks(); } catch (Exception exc) { Error("AddStockFromButton", exc); } }
protected override void CreateControls() { _authorised = false; _authWin = (AuthWindow)_view; var authReq = KernelTerminal.GetAuthReqById(_authWin.AuthForm.ConnNum); if (authReq != null) { _authWin.AuthForm.InputLogin.Text = authReq.User; _authWin.AuthForm.InputPassword.Password = authReq.Password; } base.CreateControls(); }
/// <summary> /// 1) Call KernelTerminal.AddAllStocksFromConfig, /// to create ControlMarkets and MarketViewModels /// after creating each one calling CreateStockCell callback perfoms /// 2) After creating manage Stock elements: WindowControlPannel and buttons, /// control width of Stocks /// </summary> private void AddAllStocksFromConfig() { try { KernelTerminal.AddAllStocksFromConfig(this, CreateStockCell); HideWindowControlPanels(); CheckStocksForButtDelDisable(); CheckStocksForDelEnable(); CheckAddButtonVisibility(); SetWidthOfStocks(); } catch (Exception err) { KernelTerminal.Error("AddAllStocksFromConfig", err); } }
public MainWindow() { InitializeComponent(); SetAlarmBoxVisibility(); CUtil.TaskStart(TaskPreloadVisibility); this.Loaded += new RoutedEventHandler(MainWindow_Loaded); this.ContentRendered += new EventHandler(MainWindow_ContentRendered); IsModeTopWindow = false; string version = CUtil.GetVersion(); this.Title = "Terminal " + version; GUIDispatcher = Dispatcher.CurrentDispatcher; KernelTerminal.GUIDispatcher = GUIDispatcher; KernelTerminal.CreateAlarmer(this, ComboboxAlarm.AlarmComboBox, AlarmList_CollectionChanged); Alarmer = KernelTerminal.Alarmer; _terminalViewModel = KernelTerminal.ViewModelDispatcher.TerminalViewModel; KernelTerminal.SetDataFromConfigToTerminalViewModel(); AddAllStocksFromConfig(); Deactivated += new EventHandler(MainWindow_Deactivated); Activated += new EventHandler(MainWindow_Activated); // GridMarket.PreviewMouseMove += new MouseEventHandler(GridMarket_PreviewMouseMove); PreviewMouseDown += new MouseButtonEventHandler(MainWindow_PreviewMouseDown); PreviewMouseUp += new MouseButtonEventHandler(MainWindow_PreviewMouseUp); }