Beispiel #1
0
        public static void SaveTerminalProperties()
        {
            CKernelTerminal kernTeminal = CKernelTerminal.GetKernelTerminalInstance();

            lock (kernTeminal.TerminalConfig)
            {
                CDataBinder.UpdateTerminalConfig(kernTeminal.TerminalConfig.TerminalProperties, CViewModelDispatcher.GetTerminalViewModel());
            }

            CUtil.TaskStart(kernTeminal.SaveTerminalSettings);
        }
 public CViewDispatcher(CKernelTerminal kernelTerminal)
 {
     _kernelTerminal = kernelTerminal;
 }
 private void Error(string msg, Exception exc = null)
 {
     //added 2018-03-28 to protect against crash
     msg += " | Type=" + typeof(TControl).ToString();
     CKernelTerminal.ErrorStatic(msg, exc);
 }
        public CViewModelDispatcher(CKernelTerminal kernelTerminal)
        {
            _kernelTerminal          = kernelTerminal;
            _alarmer                 = kernelTerminal.Alarmer;
            _evntDispMarketViewModel = new EvntDispMarketViewModel(RouteEvent);
            //  _evntDispMarketViewModel.BindCommands(RouteEvent);

            TerminalViewModel = new TerminalViewModel();


            //1. Register relation type_of_win - type_of_view_model type here
            _dictKTypeWindowVTypeViewModelChild[typeof(PosLogWindow)] =
                typeof(ViewModelPosLog <CUserPosLogUpdate, CUserPosLog, ControlPosLog>);

            _dictKTypeWindowVTypeViewModelChild[typeof(DealsLogWindow)] =
                typeof(ViewModelDealsLog <CUserDealsLogUpdate, CUserDeal, ControlDealsLog>);


            _dictKTypeWindowVTypeViewModelChild[typeof(VMWindow)] =
                typeof(ViewModelVM);

            _dictKTypeWindowVTypeViewModelChild[typeof(VMWindow)] =
                typeof(ViewModelVM);


            _dictKTypeWindowVTypeViewModelChild[typeof(DetailedVMWindow)] =
                typeof(ViewModelDetailedVM);



            _dictKTypeWindowVTypeViewModelChild[typeof(ConnectionsWindow)] =
                typeof(ViewModelConnection);


            _dictKTypeWindowVTypeViewModelChild[typeof(AuthWindow)] =
                typeof(ViewModelAuth);


            _dictKTypeWindowVTypeViewModelChild[typeof(AvailableTickersWindow)] =
                typeof(ViewModelAvailableTickers);


            //_dictKTypeWindowVTypeViewModelChild[typeof(SettingsTerminalWindow)] =
            //                    typeof(ViewModelSettings);

            _dictKTypeWindowVTypeViewModelChild[typeof(MoneyWindow)] =
                typeof(ViewModelMoney);

            //2. Register view models here and create it instance
            //   all VM must be child of BaseViewModelChildWindow
            _dictKViewModelVView[new ViewModelPosLog <CUserPosLogUpdate, CUserPosLog, ControlPosLog>()]     = null;
            _dictKViewModelVView[new ViewModelDealsLog <CUserDealsLogUpdate, CUserDeal, ControlDealsLog>()] = null;
            _dictKViewModelVView[new ViewModelVM()]         = null;
            _dictKViewModelVView[new ViewModelDetailedVM()] = null;
            _dictKViewModelVView[new ViewModelConnection(_kernelTerminal)] = null;
            _dictKViewModelVView[new ViewModelAuth()]             = null;
            _dictKViewModelVView[new ViewModelAvailableTickers()] = null;
            //  _dictKViewModelVView[new ViewModelSettings()] = null;
            _dictKViewModelVView[new ViewModelMoney()] = null;


            //3. Register relation type_of_data - type_of_view model here
            _dictKTypeDataVTypeBaseViewModelChild[typeof(CUserPosLogUpdate)] =
                typeof(ViewModelPosLog <CUserPosLogUpdate, CUserPosLog, ControlPosLog>);

            //added 2018-04-16 note in reality we use CUserPosUpdLate here
            _dictKTypeDataVTypeBaseViewModelChild[typeof(CUserPosLogUpdLate)] =
                typeof(ViewModelPosLog <CUserPosLogUpdate, CUserPosLog, ControlPosLog>);


            _dictKTypeDataVTypeBaseViewModelChild[typeof(CUserDealsLogUpdate)] =
                typeof(ViewModelDealsLog <CUserDealsLogUpdate, CUserDeal, ControlDealsLog>);


            _dictKTypeDataVTypeBaseViewModelChild[typeof(CUserVMUpdate)] =
                typeof(ViewModelVM);


            _dictKTypeDataVTypeBaseViewModelChild[typeof(List <CUserVmInstrumentRecord>)] =
                typeof(ViewModelDetailedVM);


            _dictKTypeDataVTypeBaseViewModelChild[typeof(List <CServer>)] =
                typeof(ViewModelConnection);

            _dictKTypeDataVTypeBaseViewModelChild[typeof(CAuthResponse)] =
                typeof(ViewModelAuth);


            _dictKTypeDataVTypeBaseViewModelChild[typeof(CAvailableTickers)] =
                typeof(ViewModelAvailableTickers);

            //_dictKTypeDataVTypeBaseViewModelChild[typeof(CSettingsVisualTerminal)] =
            //                          typeof(ViewModelSettings);



            _dictKTypeDataVTypeBaseViewModelChild[typeof(CUserMoney)] =
                typeof(ViewModelMoney);



            BindChildViewModelKernelTerminal();
        }
 public void Error(string msg, Exception e = null)
 {
     CKernelTerminal.ErrorStatic(msg, e);
     //_alarmer.Error(msg, e);
 }
 public static TerminalViewModel GetTerminalViewModel()
 {
     return(CKernelTerminal.GetViewModelDispatcherInstance().TerminalViewModel);
 }