Esempio n. 1
0
 /// <summary>
 /// Sets the view model.
 /// </summary>
 /// <param name="viewModel">The view model.</param>
 public void SetViewModel(ViewModelBase viewModel)
 {
     ViewModel = (MainVModel)viewModel;
 }
Esempio n. 2
0
        static void InitLocator(ServiceLocator locator)
        {
            //LogVModel log = new LogVModel();
            //WinLog log = new WinLog(AppContext.Current.ApplicationTitle);
            LogVModel log = new LogVModel();

            locator.RegisterInstance <Ops.NetCoe.LightFrame.ILog>(log);
            locator.RegisterInstance <LogVModel>(log);
            AppContext.Current.LogTrace("Init locator");
            locator.RegisterType <IWebProxy>(() => {
                IWebProxy proxy = WebRequest.GetSystemWebProxy();
                return(proxy);
            });

            locator.RegisterSingleton <Ops.NetCoe.LightFrame.IServiceLocator>(() => locator);
            locator.RegisterInstance <VideoHelper>(new VideoHelper());
            ViewFactory vFactory = new ViewFactory();

            vFactory.Register <ImageProjectVModel, ImageProjectView>();
            vFactory.Register <VideoProjectVModel, VideoProjectView>();
            vFactory.Register <PropElementListVModel, PropElementListView>();
            vFactory.Register <TrackGroupVModel, TrackGroupView>();
            vFactory.Register <MediaSplitVModel, MediaSplitView>();
            vFactory.Register <TextRqtVModel, TextRqtView>();
            //vFactory.Register<MonitorVModels.TaskVModel, MonitorViews.TaskView>();

            //locator.RegisterType<NodeSearchVModel>();
            //locator.RegisterType<NodeVModel>();
            //locator.RegisterType<AssetSearchVModel>();
            //locator.RegisterType<AssetVModel>();
            //locator.RegisterType<TextEditVModel>();
            //locator.RegisterType<MonitorVModels.TaskSearchVModel>();

            //locator.RegisterInstance<LogVModel>(log);
            locator.RegisterInstance <ViewFactory>(vFactory);
            var uiBus = new UIBus();

            locator.RegisterInstance <UIBus>(uiBus);
            IUIHelper uhlp = App.Current as IUIHelper;

            if (uhlp == null)
            {
                string em = "Initialization failure: Class App does not implement IUIHelper interface";
                AppContext.Current.LogTechError(em, null);
                throw new TechnicalException(em);
            }
            locator.RegisterInstance <IUIHelper>(uhlp);
            //locator.RegisterInstance<ICrypto>(new Crypto());
            //locator.RegisterType<IisWebsiteVModel, IisWebsiteVModel>();
            //locator.RegisterType<DeploymentTaskVModel, DeploymentTaskVModel>();

            //ServiceEndpointPrefix = AppContext.Current.GetAppCfgItem("ServicePrefix");
            //if (ServiceEndpointPrefix == null) {
            //    ServiceEndpointPrefix = "Default";
            //    AppContext.Current.LogWarning("Configuration error: value appSettings\\@ServicePrefix is not specified. Will fall back to 'Default'.");
            //}


            // Create Main VModel at the end so it can use previos declarations
            MainVModel mvm = new MainVModel();

            locator.RegisterInstance <MainVModel>(mvm);
        }