Exemple #1
0
 public ChartNewViewModel(FreqDataCollectNewViewModel freqVM)
 {
     _uiContext                = SynchronizationContext.Current;
     _MyLatestQuote            = new MinuteQuoteViewModel();
     _MyLatestQuote.LastPx     = 0;
     _FreqDataCollectViewModel = freqVM;
 }
        public ViewModelLocator()
        {
            try
            {
                ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

                if (ViewModelBase.IsInDesignModeStatic)
                {
                    SimpleIoc.Default.Register <IDataService, Design.DesignDataService>();

                    //SimpleIoc.Default.Register<IDataService, Design.DesignDataService>();
                }
                else
                {
                    SimpleIoc.Default.Register <IDataService, DataService>();
                    SimpleIoc.Default.Register <IChestBitmapService, ChestBitmapService>();
                    //SimpleIoc.Default.Register<IMultiPersionTrainingSerice, MultiPersionTrainingService>();
                }

                SimpleIoc.Default.Register <MainViewModel>();
                //SimpleIoc.Default.Register<FreqDataCollectViewModel>();
                //SimpleIoc.Default.Register<FreqDataCreatViewModel>();

                FreqDataCreat      = new FreqDataCreatViewModel();
                FreqDataCollect    = new FreqDataCollectViewModel();
                FreqDataCollectNew = new FreqDataCollectNewViewModel();
            }
            catch (Exception ex)
            {
                throw new Exception("ViewModelLocator初始化错误,错误信息:" + ex.Message);
            }
            return;


            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            if (ViewModelBase.IsInDesignModeStatic)
            {
                SimpleIoc.Default.Register <IDataService, Design.DesignDataService>();

                //SimpleIoc.Default.Register<IDataService, Design.DesignDataService>();
            }
            else
            {
                SimpleIoc.Default.Register <IDataService, DataService>();
                SimpleIoc.Default.Register <IChestBitmapService, ChestBitmapService>();
                //SimpleIoc.Default.Register<IMultiPersionTrainingSerice, MultiPersionTrainingService>();
            }

            SimpleIoc.Default.Register <MainViewModel>();
            SimpleIoc.Default.Register <FreqDataCollectViewModel>();
            SimpleIoc.Default.Register <FreqDataCreatViewModel>();
            //SimpleIoc.Default.Register<FreqDataReloadViewModel>();
        }