コード例 #1
1
        internal ReflectedAsyncActionDescriptor(MethodInfo asyncMethodInfo, MethodInfo completedMethodInfo, string actionName, ControllerDescriptor controllerDescriptor, bool validateMethods) {
            if (asyncMethodInfo == null) {
                throw new ArgumentNullException("asyncMethodInfo");
            }
            if (completedMethodInfo == null) {
                throw new ArgumentNullException("completedMethodInfo");
            }
            if (String.IsNullOrEmpty(actionName)) {
                throw Error.ParameterCannotBeNullOrEmpty("actionName");
            }
            if (controllerDescriptor == null) {
                throw new ArgumentNullException("controllerDescriptor");
            }

            if (validateMethods) {
                string asyncFailedMessage = VerifyActionMethodIsCallable(asyncMethodInfo);
                if (asyncFailedMessage != null) {
                    throw new ArgumentException(asyncFailedMessage, "asyncMethodInfo");
                }

                string completedFailedMessage = VerifyActionMethodIsCallable(completedMethodInfo);
                if (completedFailedMessage != null) {
                    throw new ArgumentException(completedFailedMessage, "completedMethodInfo");
                }
            }

            AsyncMethodInfo = asyncMethodInfo;
            CompletedMethodInfo = completedMethodInfo;
            _actionName = actionName;
            _controllerDescriptor = controllerDescriptor;
            _uniqueId = new Lazy<string>(CreateUniqueId);
        }
コード例 #2
0
        public BookListView()
        {
            InitializeComponent();

            viewModel = new Lazy<BookListViewModel>(() => ViewHelper.GetViewModel<BookListViewModel>(this));
            Loaded += FirstTimeLoadedHandler;
        }
コード例 #3
0
        public OwinCurrentHttpRequest(OwinRequestBody body)
        {
            _body = body;

            // TODO -- Owin and protocol?
            _baseUrl = new Lazy<string>(() => "http://" + _body.HostWithPort + "/" + _body.PathBase.TrimEnd('/'));
        }
コード例 #4
0
        /// <summary>
        /// Sets the <see cref="HttpSelfHostConfiguration" /> instance to be used when self-hosting the API, externally from ASP.NET.
        /// </summary>
        /// <param name="configurationDelegate">The configuration delegate.</param>
        /// <returns>Current <see cref="WebApiManagerBuilder" /> instance.</returns>
        public ApplicationConfigurationBuilder ConfigureForSelfHosting(Func<HttpSelfHostConfiguration> configurationDelegate)
        {
            _HttpSelfHostConfigurationFactory = new Lazy<HttpSelfHostConfiguration>(configurationDelegate);
            Setup();

            return Builder;
        }
コード例 #5
0
        static TestingContext()
        {
            _library = new Lazy<FixtureLibrary>(() =>
            {
                try
                {
                    var fixture = new SentenceFixture();
                    var library = FixtureLibrary.CreateForAppDomain(new GrammarSystem().Start());

                    // Need to force it to use this one instead of the FactFixture in the samples project
                    var factFixture = new StoryTeller.Testing.EndToEndExecution.FactFixture();
                    library.Models["Fact"] = factFixture.Compile(CellHandling.Basic());
                    library.Fixtures["Fact"] = factFixture;

                    return library;
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                    throw;
                }
            });


        }
コード例 #6
0
        public ListEventPermissionView()
        {
            InitializeComponent();

            try
            {
                if (!ViewModelBase.IsInDesignModeStatic)
                {
                    _viewModelExport = App.Container.GetExport<ViewModelBase>(
                        ViewModelTypes.ListClassViewModel);
                    if (_viewModelExport != null)
                    {
                        DataContext = _viewModelExport.Value;
                        if (_viewModelExport.Value is IViewModel)
                        {
                            (_viewModelExport.Value as IViewModel).LoadPermission();
                            (_viewModelExport.Value as IViewModel).SetFocus += new EventHandler(View_SetFocus);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageCustomize.Show(ex.Message);
            }  
        }
コード例 #7
0
 public CommandLineMachineWideSettings()
 {
     var baseDirectory = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
     _settings = new Lazy<IEnumerable<Settings>>(
         () => Configuration.Settings.LoadMachineWideSettings(
             baseDirectory));
 }
コード例 #8
0
ファイル: PartPresenter.cs プロジェクト: Antares007/InRetail
        public PartPresenter(PartPresenterView view, IUnityContainer container)
        {
            _container = container;
            View = view;
            View.DataContext = this;
            _regionManager = new RegionManager();
            RegionManager.SetRegionManager(View, _regionManager);

            _addPartCommand = new Lazy<DelegateCommand<object>>(() => new DelegateCommand<object>(AddPartExecuted));
            Action<int> add = (i) =>
            {
                var region = _regionManager.Regions["Page1Content" + i];
                if (region.Views.Count() == 0)
                {
                    var partView = _container.Resolve<PartView>();

                    region.Add(partView);
                    region.Activate(partView);

                }
            };

            add(1);
            add(2);
            add(3);
        }
コード例 #9
0
        protected PackagesProviderBase(
            Project project,
            IProjectManager projectManager,
            ResourceDictionary resources,
            ProviderServices providerServices,
            IProgressProvider progressProvider)
        {
            if (projectManager == null) {
                throw new ArgumentNullException("projectManager");
            }

            if (project == null) {
                throw new ArgumentNullException("project");
            }

            if (resources == null) {
                throw new ArgumentNullException("resources");
            }

            if (providerServices == null) {
                throw new ArgumentNullException("providerServices");
            }

            _progressProvider = progressProvider;
            _resources = resources;
            _scriptExecutor = providerServices.ScriptExecutor;
            _progressWindowOpener = providerServices.ProgressWindow;
            _outputConsole = new Lazy<IConsole>(() => providerServices.OutputConsoleProvider.CreateOutputConsole(requirePowerShellHost: false));
            ProjectManager = projectManager;
            _project = project;
        }
コード例 #10
0
ファイル: ConstructorMap.cs プロジェクト: garora/AutoMapper
        public ConstructorMap(ConstructorInfo ctor, IEnumerable<ConstructorParameterMap> ctorParams)
        {
            Ctor = ctor;
            CtorParams = ctorParams;

            _runtimeCtor = new Lazy<LateBoundParamsCtor>(() => DelegateFactory.CreateCtor(ctor, CtorParams));
        }
コード例 #11
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="mapPath">A delegate method used to perform a Server.MapPath operation</param>
        public DefaultPackageContext(RebelSettings settings, Func<string, string> mapPath)
        {
            _settings = settings;

            _pluginInstallFolderPath = mapPath(_settings.PluginConfig.PluginsPath + "/Packages");
            _localPackageRepoFolderPath = mapPath(_settings.RebelFolders.LocalPackageRepositoryFolder);

            //create lazy instances of each
            _localPackageRepository = new Lazy<IPackageRepository>(
                () =>
                    {
                        //create a new path resolver with false as 'useSideBySidePaths' so that it doesn't install with version numbers.
                        var packageFileSys = new PhysicalFileSystem(_localPackageRepoFolderPath);
                        var packagePathResolver = new DefaultPackagePathResolver(packageFileSys, false);
                        return new LocalPackageRepository(packagePathResolver, packageFileSys, true);
                    });

            _localPackageManager = new Lazy<IPackageManager>(
                () =>
                    {
                        //create a new path resolver with false as 'useSideBySidePaths' so that it doesn't install with version numbers.
                        var packageFileSys = new PhysicalFileSystem(_pluginInstallFolderPath);
                        var packagePathResolver = new DefaultPackagePathResolver(packageFileSys, false);
                        return new PackageManager(_localPackageRepository.Value, packagePathResolver, packageFileSys);
                    });
            
            // Public packages
            _publicPackageRepository = new Lazy<IPackageRepository>(
                () => PackageRepositoryFactory.Default.CreateRepository(_settings.PublicPackageRepository.RepositoryAddress));
            
            _publicPackageManager = new Lazy<IPackageManager>(
                () => new PackageManager(_publicPackageRepository.Value, mapPath(_settings.PluginConfig.PluginsPath + "/Packages")));

        }
コード例 #12
0
ファイル: CrawledPage.cs プロジェクト: haigneyc/abot
 public CrawledPage(Uri uri)
     : base(uri)
 {
     _htmlDocument = new Lazy<HtmlDocument>(() => InitializeHtmlAgilityPackDocument() );
     _csQueryDocument = new Lazy<CQ>(() => InitializeCsQueryDocument());
     Content = new PageContent();
 }
コード例 #13
0
ファイル: DnSpyLoaderManager.cs プロジェクト: levisre/dnSpy
		DnSpyLoaderManager(IImageManager imageManager, IThemeManager themeManager, ISettingsManager settingsManager, [ImportMany] IEnumerable<Lazy<IDnSpyLoader, IDnSpyLoaderMetadata>> mefLoaders) {
			this.imageManager = imageManager;
			this.themeManager = themeManager;
			this.settingsManager = settingsManager;
			this.loaders = mefLoaders.OrderBy(a => a.Metadata.Order).ToArray();
			this.windowLoader = new WindowLoader(this, imageManager, themeManager, settingsManager, loaders);
		}
コード例 #14
0
        private void RegisterHubExtensions()
        {
            var methodDescriptorProvider = new Lazy<ReflectedMethodDescriptorProvider>();
            Register(typeof(IMethodDescriptorProvider), () => methodDescriptorProvider.Value);

            var hubDescriptorProvider = new Lazy<ReflectedHubDescriptorProvider>(() => new ReflectedHubDescriptorProvider(this));
            Register(typeof(IHubDescriptorProvider), () => hubDescriptorProvider.Value);

            var parameterBinder = new Lazy<DefaultParameterResolver>();
            Register(typeof(IParameterResolver), () => parameterBinder.Value);

            var activator = new Lazy<DefaultHubActivator>(() => new DefaultHubActivator(this));
            Register(typeof(IHubActivator), () => activator.Value);

            var hubManager = new Lazy<DefaultHubManager>(() => new DefaultHubManager(this));
            Register(typeof(IHubManager), () => hubManager.Value);

            var proxyGenerator = new Lazy<DefaultJavaScriptProxyGenerator>(() => new DefaultJavaScriptProxyGenerator(this));
            Register(typeof(IJavaScriptProxyGenerator), () => proxyGenerator.Value);

            var requestParser = new Lazy<HubRequestParser>();
            Register(typeof(IHubRequestParser), () => requestParser.Value);

            var assemblyLocator = new Lazy<DefaultAssemblyLocator>(() => new DefaultAssemblyLocator());
            Register(typeof(IAssemblyLocator), () => assemblyLocator.Value);

            // Setup the default hub pipeline
            var dispatcher = new Lazy<IHubPipeline>(() => new HubPipeline().AddModule(new AuthorizeModule()));
            Register(typeof(IHubPipeline), () => dispatcher.Value);
            Register(typeof(IHubPipelineInvoker), () => dispatcher.Value);
        }
コード例 #15
0
        public CncWorldInteractionControllerWidget([ObjectCreator.Param] World world,
		                                           [ObjectCreator.Param] WorldRenderer worldRenderer)
            : base(world, worldRenderer)
        {
            tooltipContainer = new Lazy<TooltipContainerWidget>(() =>
                Widget.RootWidget.GetWidget<TooltipContainerWidget>(TooltipContainer));
        }
コード例 #16
0
        public ProductionQueueFromSelection(World world, ProductionQueueFromSelectionInfo info)
        {
            this.world = world;

            tabsWidget = new Lazy<ProductionTabsWidget>(() =>
                Widget.RootWidget.GetWidget<ProductionTabsWidget>(info.ProductionTabsWidget));
        }
コード例 #17
0
        public ProductionQueueFromSelection(World world, ProductionQueueFromSelectionInfo info)
        {
            this.world = world;

            tabsWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.ProductionTabsWidget) as ProductionTabsWidget);
            paletteWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.ProductionPaletteWidget) as ProductionPaletteWidget);
        }
コード例 #18
0
 public FunctionView(IModuleContext context, string name, IPythonFunction member, bool isMethod)
     : base(context, name, member)
 {
     _function = member;
     _isMethod = isMethod;
     _returnTypes = new Lazy<IEnumerable<IAnalysisItemView>>(CalculateReturnTypes);
 }
コード例 #19
0
ファイル: ConfigSource.cs プロジェクト: aluetjen/fubumvc
 public ConfigSource(FubuRegistry provenance, IConfigurationAction action)
 {
     _provenance = provenance;
     _action = action;
     Id = Guid.NewGuid();
     _description = new Lazy<Description>(() => Description.For(action));
 }
コード例 #20
0
        public RepositoriesExploreView()
        {
            Title = "Explore";

            EmptyView = new Lazy<UIView>(() =>
                new EmptyListView(Octicon.Repo.ToEmptyListImage(), "There are no repositories."));
        }
コード例 #21
0
        public FileSystemCompletionHelper(
            CompletionListProvider completionProvider,
            TextSpan textChangeSpan,
            ICurrentWorkingDirectoryDiscoveryService fileSystemDiscoveryService,
            Glyph folderGlyph,
            Glyph fileGlyph,
            ImmutableArray<string> searchPaths,
            IEnumerable<string> allowableExtensions,
            Func<string, bool> exclude = null,
            CompletionItemRules itemRules = null)
        {
            Debug.Assert(searchPaths.All(path => PathUtilities.IsAbsolute(path)));

            _completionProvider = completionProvider;
            _textChangeSpan = textChangeSpan;
            _searchPaths = searchPaths;
            _allowableExtensions = allowableExtensions.Select(e => e.ToLowerInvariant()).ToSet();
            _fileSystemDiscoveryService = fileSystemDiscoveryService;
            _folderGlyph = folderGlyph;
            _fileGlyph = fileGlyph;
            _exclude = exclude;
            _itemRules = itemRules;

            _lazyGetDrives = new Lazy<string[]>(() =>
                IOUtilities.PerformIO(Directory.GetLogicalDrives, SpecializedCollections.EmptyArray<string>()));
        }
コード例 #22
0
        public AutoroutePartHandler(
            IRepository<AutoroutePartRecord> autoroutePartRepository,
            Lazy<IAutorouteService> autorouteService,
            IOrchardServices orchardServices) {

            Filters.Add(StorageFilter.For(autoroutePartRepository));
            _autorouteService = autorouteService;
            _orchardServices = orchardServices;

            OnUpdated<AutoroutePart>((ctx, part) => CreateAlias(part));

            OnCreated<AutoroutePart>((ctx, part) => {
                // non-draftable items
                if (part.ContentItem.VersionRecord == null) {
                    PublishAlias(part);
                }
            });

            // OnVersioned<AutoroutePart>((ctx, part1, part2) => CreateAlias(part1));

            OnPublished<AutoroutePart>((ctx, part) => PublishAlias(part));

            // Remove alias if removed or unpublished
            OnRemoved<AutoroutePart>((ctx, part) => RemoveAlias(part));
            OnUnpublished<AutoroutePart>((ctx, part) => RemoveAlias(part));

            // Register alias as identity
            OnGetContentItemMetadata<AutoroutePart>((ctx, part) => {
                if (part.DisplayAlias != null)
                    ctx.Metadata.Identity.Add("alias", part.DisplayAlias);
            });
        }
コード例 #23
0
ファイル: Chapter.cs プロジェクト: vgdagpin/MangaAPI
        public Chapter()
        {
            pagesUrl = new Lazy<IEnumerable<Page>>(() =>
            {
                var content = Utility.GetContent(Uri);

                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(content);
                List<Page> pages = new List<Page>();

                doc.DocumentNode
                    .SelectNodes("//select[@id=\"pageMenu\"]//option")
                    .ToList()
                    .ForEach(p =>
                    {
                        Page page = new Page
                        {
                            ChapterName = Title,
                            ChapterNumber = Number,
                            PageNumber = Convert.ToInt32(p.NextSibling.InnerText),
                            Uri = MangaPanda.BaseUrl + p.Attributes["value"].Value
                        };

                        pages.Add(page);
                    });

                return pages;
            });
        }
コード例 #24
0
        public AbpNHibernateInterceptor(IIocManager iocManager)
        {
            _iocManager = iocManager;

            _abpSession =
                new Lazy<IAbpSession>(
                    () => _iocManager.IsRegistered(typeof(IAbpSession))
                        ? _iocManager.Resolve<IAbpSession>()
                        : NullAbpSession.Instance,
                    isThreadSafe: true
                    );
            _guidGenerator =
                new Lazy<IGuidGenerator>(
                    () => _iocManager.IsRegistered(typeof(IGuidGenerator))
                        ? _iocManager.Resolve<IGuidGenerator>()
                        : SequentialGuidGenerator.Instance,
                    isThreadSafe: true
                    );

            _eventBus =
                new Lazy<IEventBus>(
                    () => _iocManager.IsRegistered(typeof(IEventBus))
                        ? _iocManager.Resolve<IEventBus>()
                        : NullEventBus.Instance,
                    isThreadSafe: true
                );
        }
コード例 #25
0
ファイル: MacPlatform.cs プロジェクト: pjt33/monodevelop
		public MacPlatformService ()
		{
			if (IntPtr.Size == 8)
				throw new Exception ("Mac integration is not yet 64-bit safe");

			if (initedGlobal)
				throw new Exception ("Only one MacPlatformService instance allowed");
			initedGlobal = true;

			timer.BeginTiming ();
			
			systemVersion = Carbon.Gestalt ("sysv");
			
			mimemap = new Lazy<Dictionary<string, string>> (LoadMimeMapAsync);

			//make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
			Carbon.SetProcessName (BrandingService.ApplicationName);
			
			Cocoa.InitMonoMac ();

			CheckGtkVersion (2, 24, 14);

			timer.Trace ("Installing App Event Handlers");
			GlobalSetup ();
			
			timer.EndTiming ();
		}
コード例 #26
0
        public WebWorkContext(Func<string, ICacheManager> cacheManager,
            HttpContextBase httpContext,
            ICustomerService customerService,
			IStoreContext storeContext,
            IAuthenticationService authenticationService,
            ILanguageService languageService,
            ICurrencyService currencyService,
			IGenericAttributeService attrService,
            TaxSettings taxSettings, CurrencySettings currencySettings,
            LocalizationSettings localizationSettings, Lazy<ITaxService> taxService,
            IStoreService storeService, ISettingService settingService,
			IUserAgent userAgent)
        {
            this._cacheManager = cacheManager("static");
            this._httpContext = httpContext;
            this._customerService = customerService;
            this._storeContext = storeContext;
            this._authenticationService = authenticationService;
            this._languageService = languageService;
            this._attrService = attrService;
            this._currencyService = currencyService;
            this._taxSettings = taxSettings;
            this._taxService = taxService;
            this._currencySettings = currencySettings;
            this._localizationSettings = localizationSettings;
            this._storeService = storeService;
            this._settingService = settingService;
            this._userAgent = userAgent;
        }
コード例 #27
0
        /// <summary>
        /// Use Redis as the messaging backplane for scaling out of ASP.NET SignalR applications in a web farm.
        /// </summary>
        /// <param name="resolver">The dependency resolver</param>
        /// <param name="configuration">The Redis scale-out configuration options.</param> 
        /// <returns>The dependency resolver.</returns>
        public static IDependencyResolver UseRedis(this IDependencyResolver resolver, RedisScaleoutConfiguration configuration)
        {
            var bus = new Lazy<RedisMessageBus>(() => new RedisMessageBus(resolver, configuration, new RedisConnection()));
            resolver.Register(typeof(IMessageBus), () => bus.Value);

            return resolver;
        }
コード例 #28
0
        public ProductionPaletteWidget([ObjectCreator.Param] World world,
		                               [ObjectCreator.Param] WorldRenderer worldRenderer)
        {
            this.world = world;
            this.worldRenderer = worldRenderer;
            tooltipContainer = new Lazy<TooltipContainerWidget>(() =>
                Widget.RootWidget.GetWidget<TooltipContainerWidget>(TooltipContainer));

            cantBuild = new Animation("clock");
            cantBuild.PlayFetchIndex("idle", () => 0);
            clock = new Animation("clock");

            iconSprites = Rules.Info.Values
                .Where(u => u.Traits.Contains<BuildableInfo>() && u.Name[0] != '^')
                .ToDictionary(
                    u => u.Name,
                    u => Game.modData.SpriteLoader.LoadAllSprites(
                        u.Traits.Get<TooltipInfo>().Icon ?? (u.Name + "icon"))[0]);

            overlayFont = Game.Renderer.Fonts["TinyBold"];
            holdOffset = new float2(32,24) - overlayFont.Measure("On Hold") / 2;
            readyOffset = new float2(32,24) - overlayFont.Measure("Ready") / 2;
            timeOffset = new float2(32,24) - overlayFont.Measure(WidgetUtils.FormatTime(0)) / 2;
            queuedOffset = new float2(4,2);
        }
コード例 #29
0
		private static void ExecuteCommand(CommandType command, DirectoryInfo baseDirectory, Lazy<Uri> url, string userName, string password) 
		{
			var engine = Engine.CreateStandard(baseDirectory);
			switch (command)
			{
				case CommandType.Help:
					break;
				case CommandType.Generate:
					var generatedDocuments = engine.Generate();
					foreach (var generatedDocument in generatedDocuments)
					{
						System.Console.WriteLine(generatedDocument);
						System.Console.WriteLine();
					}
					break;
				case CommandType.Check:
					var haveChanged =
						engine.CheckIfChanged(url.Value, userName, password);
					System.Console.WriteLine(haveChanged? "Changed": "Have not changed");
					break;
				case CommandType.Push:
					engine.PushIfChanged(url.Value, userName, password);
					break;
				case CommandType.Purge:
					engine.PurgeDatabase(url.Value, userName, password);
					break;
				default:
					throw new ArgumentOutOfRangeException();
			}
		}
コード例 #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApplicationVersionContextInitializer" /> class.
 /// </summary>
 /// <param name="applicationVersion">The application version. If null, calculated from <see cref="Assembly.GetEntryAssembly"/>.</param>
 public ApplicationVersionContextInitializer(string applicationVersion = null)
 {
     _applicationVersion = new Lazy<string>(() =>
         String.IsNullOrWhiteSpace(applicationVersion)
             ? (Assembly.GetEntryAssembly()?.ToString() ?? Assembly.GetExecutingAssembly().ToString())
             : applicationVersion);
 }
コード例 #31
0
 public VcsRootMapper(Lazy <IProjectMapper> projectMapper, IPropertyMapper propertyMapper)
 {
     _projectMapper  = projectMapper ?? throw new ArgumentNullException(nameof(projectMapper));
     _propertyMapper = propertyMapper ?? throw new ArgumentNullException(nameof(propertyMapper));
 }
コード例 #32
0
 public void SetExecutionContext(IExecutionContext context)
 {
     _lazyUserContextData = new Lazy <UserContextData>(() => GetUserData(context));
 }
コード例 #33
0
ファイル: Audit.cs プロジェクト: snoways/EntityFramework-Plus
 /// <summary>Default constructor.</summary>
 public Audit()
 {
     _configuration = new Lazy <AuditConfiguration>(() => AuditManager.DefaultConfiguration.Clone());
     Entries        = new List <AuditEntry>();
 }
コード例 #34
0
ファイル: Factory.cs プロジェクト: sabrogden/logjoint
        public Factory(
            IViewsFactory postprocessingViewsFactory,
            IManagerInternal postprocessorsManager,
            ILogSourcesManager logSourcesManager,
            ISynchronizationContext synchronizationContext,
            IChangeNotification changeNotification,
            IBookmarks bookmarks,
            IModelThreads threads,
            Persistence.IStorageManager storageManager,
            ILogSourceNamesProvider logSourceNamesProvider,
            IUserNamesProvider shortNames,
            SourcesManager.IPresenter sourcesManagerPresenter,
            LoadedMessages.IPresenter loadedMessagesPresenter,
            IClipboardAccess clipboardAccess,
            IPresentersFacade presentersFacade,
            IAlertPopup alerts,
            IColorTheme colorTheme,
            Drawing.IMatrixFactory matrixFactory,
            ICorrelationManager correlationManager
            )
        {
            stateInspectorVisualizer = new Lazy <StateInspectorVisualizer.IPresenterInternal>(() =>
            {
                var view  = postprocessingViewsFactory.CreateStateInspectorView();
                var model = new LogJoint.Postprocessing.StateInspector.StateInspectorVisualizerModel(
                    postprocessorsManager,
                    logSourcesManager,
                    changeNotification,
                    shortNames
                    );
                return(new StateInspectorVisualizer.StateInspectorPresenter(
                           view,
                           model,
                           shortNames,
                           logSourcesManager,
                           loadedMessagesPresenter,
                           bookmarks,
                           threads,
                           presentersFacade,
                           clipboardAccess,
                           sourcesManagerPresenter,
                           colorTheme,
                           changeNotification
                           ));
            });

            timelineVisualizer = new Lazy <TimelineVisualizer.IPresenter>(() =>
            {
                var view  = postprocessingViewsFactory.CreateTimelineView();
                var model = new LogJoint.Postprocessing.Timeline.TimelineVisualizerModel(
                    postprocessorsManager,
                    logSourcesManager,
                    shortNames,
                    logSourceNamesProvider
                    );
                return(new TimelineVisualizer.TimelineVisualizerPresenter(
                           model,
                           view,
                           stateInspectorVisualizer.Value,
                           new Common.PresentationObjectsFactory(postprocessorsManager, logSourcesManager, changeNotification, alerts, correlationManager),
                           loadedMessagesPresenter,
                           bookmarks,
                           storageManager,
                           presentersFacade,
                           shortNames,
                           changeNotification,
                           colorTheme
                           ));
            });

            sequenceDiagramVisualizer = new Lazy <SequenceDiagramVisualizer.IPresenter>(() =>
            {
                var view  = postprocessingViewsFactory.CreateSequenceDiagramView();
                var model = new LogJoint.Postprocessing.SequenceDiagram.SequenceDiagramVisualizerModel(
                    postprocessorsManager,
                    logSourcesManager,
                    shortNames,
                    logSourceNamesProvider,
                    changeNotification
                    );
                return(new SequenceDiagramVisualizer.SequenceDiagramVisualizerPresenter(
                           model,
                           view,
                           stateInspectorVisualizer.Value,
                           new Common.PresentationObjectsFactory(postprocessorsManager, logSourcesManager, changeNotification, alerts, correlationManager),
                           loadedMessagesPresenter,
                           bookmarks,
                           storageManager,
                           presentersFacade,
                           shortNames,
                           changeNotification,
                           colorTheme,
                           matrixFactory
                           ));
            });

            timeSeriesVisualizer = new Lazy <TimeSeriesVisualizer.IPresenter>(() =>
            {
                var view  = postprocessingViewsFactory.CreateTimeSeriesView();
                var model = new LogJoint.Postprocessing.TimeSeries.TimelineVisualizerModel(
                    postprocessorsManager,
                    logSourcesManager,
                    shortNames,
                    logSourceNamesProvider
                    );
                return(new TimeSeriesVisualizer.TimeSeriesVisualizerPresenter(
                           model,
                           view,
                           new Common.PresentationObjectsFactory(postprocessorsManager, logSourcesManager, changeNotification, alerts, correlationManager),
                           loadedMessagesPresenter.LogViewerPresenter,
                           bookmarks,
                           presentersFacade,
                           changeNotification
                           ));
            });
        }
コード例 #35
0
        ExceptionsContent(IWpfCommandService wpfCommandService, IExceptionsVM exceptionsVM, ExceptionsOperations exceptionsOperations, Lazy <DbgExceptionSettingsService> dbgExceptionSettingsService, IMessageBoxService messageBoxService)
        {
            Operations        = exceptionsOperations;
            exceptionsControl = new ExceptionsControl();
            var addVM = new AddExceptionVM(dbgExceptionSettingsService);

            exceptionsControl.addExceptionControl.DataContext       = addVM;
            exceptionsControl.addExceptionControl.IsVisibleChanged += AddExceptionControl_IsVisibleChanged;
            exceptionsControl.addExceptionControl.InputBindings.Add(new KeyBinding(addVM.SaveCommand, Key.Enter, ModifierKeys.None));
            exceptionsControl.addExceptionControl.InputBindings.Add(new KeyBinding(new RelayCommand(a => exceptionsVM.IsAddingExceptions = false), Key.Escape, ModifierKeys.None));
            this.exceptionsVM             = exceptionsVM;
            exceptionsControl.DataContext = new ControlVM(exceptionsVM, exceptionsOperations, messageBoxService, exceptionsControl);
            exceptionsControl.ExceptionsListViewDoubleClick += ExceptionsControl_ExceptionsListViewDoubleClick;

            wpfCommandService.Add(ControlConstants.GUID_DEBUGGER_EXCEPTIONS_CONTROL, exceptionsControl);
            wpfCommandService.Add(ControlConstants.GUID_DEBUGGER_EXCEPTIONS_LISTVIEW, exceptionsControl.ListView);
        }
 public DotNetCoreProjectCompatibilityDetector([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, Lazy<IProjectServiceAccessor> projectAccessor,
                                               Lazy<IDialogServices> dialogServices, Lazy<IProjectThreadingService> threadHandling, Lazy<IVsShellUtilitiesHelper> vsShellUtilitiesHelper,
                                               Lazy<IFileSystem> fileSystem, Lazy<IHttpClient> httpClient)
 {
     _serviceProvider = serviceProvider;
     _projectServiceAccessor = projectAccessor;
     _dialogServices = dialogServices;
     _threadHandling = threadHandling;
     _shellUtilitiesHelper = vsShellUtilitiesHelper;
     _fileSystem = fileSystem;
     _httpClient = httpClient;
 }
コード例 #37
0
        private void CreateModel <T>(Lazy <IXrmToolBoxPlugin, IPluginMetadata> plugin, ref int top, int width, int count)
            where T : PluginModel
        {
            var type = plugin.Value.GetMyType();
            //var pm = (T)pManager.PluginsControls.FirstOrDefault(t => ((Type)t.Tag).FullName == type && t is T);

            var pm    = (T)pluginsModels.FirstOrDefault(t => ((Lazy <IXrmToolBoxPlugin, IPluginMetadata>)t.Tag).Value.GetType().FullName == type && t is T);
            var small = (typeof(T) == typeof(SmallPluginModel));

            if (pm == null)
            {
                var title = plugin.Metadata.Name;
                var desc  = plugin.Metadata.Description;

                var author  = plugin.Value.GetCompany();
                var version = plugin.Value.GetVersion();

                var backColor      = ColorTranslator.FromHtml(plugin.Metadata.BackgroundColor);
                var primaryColor   = ColorTranslator.FromHtml(plugin.Metadata.PrimaryFontColor);
                var secondaryColor = ColorTranslator.FromHtml(plugin.Metadata.SecondaryFontColor);

                var args = new[]
                {
                    typeof(Image),
                    typeof(string),
                    typeof(string),
                    typeof(string),
                    typeof(string),
                    typeof(Color),
                    typeof(Color),
                    typeof(Color),
                    typeof(int)
                };

                var vals = new object[]
                {
                    GetImage(small ? plugin.Metadata.SmallImageBase64 : plugin.Metadata.BigImageBase64, small),
                    title,
                    desc,
                    author,
                    version,
                    backColor,
                    primaryColor,
                    secondaryColor,
                    count
                };

                var ctor = typeof(T).GetConstructor(args);
                if (ctor != null)
                {
                    pm = (T)ctor.Invoke(vals);

                    pm.Tag      = plugin;
                    pm.Clicked += PluginClicked;

                    pluginsModels.Add(pm);
                }
            }

            if (pm == null)
            {
                return;
            }

            var localTop = top;

            Invoke(new Action(() =>
            {
                pm.Left  = 4;
                pm.Top   = localTop;
                pm.Width = width;
            }));
            top += pm.Height + 4;
        }
コード例 #38
0
        public App()
        {
            // save a pointer to ourself
            App.Current = this;

            InitializeComponent();

            // app lifecycle event handlers
            EnteredBackground  += OnEnteredBackground;
            Suspending         += OnSuspending;
            Resuming           += OnResuming;
            UnhandledException += OnUnhandledException;

            // we want full screen, but leave this off during dev
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
            //ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;

            // we want landscape only
            DisplayOrientations orientations = DisplayOrientations.Landscape;

            DisplayInformation.AutoRotationPreferences = orientations;

            // Deferred execution until used. Check https://msdn.microsoft.com/library/dd642331(v=vs.110).aspx for further info on Lazy<T> class.
            _activationService = new Lazy <ActivationService>(CreateActivationService);

            // register our configuration service and initialize it
            SimpleIoc.Default.Register <ConfigurationService>();
            ConfigurationService configurationService = (ConfigurationService)SimpleIoc.Default.GetInstance <ConfigurationService>();

            if (null != configurationService)
            {
                // run this synchronously
                AsyncHelper.RunSync(() => configurationService.Initialize());
            }

            // register our localization service and initialize it
            SimpleIoc.Default.Register <LocalizationService>();
            LocalizationService localizationService = (LocalizationService)SimpleIoc.Default.GetInstance <LocalizationService>();

            if (null != localizationService)
            {
                // async here might lead to a race condition, but no signs so far
                //localizationService.Initialize();
                AsyncHelper.RunSync(() => localizationService.Initialize());
            }

            // initialize the telemetry service
            SimpleIoc.Default.Register <TelemetryService>();
            TelemetryService telemetryService = (TelemetryService)SimpleIoc.Default.GetInstance <TelemetryService>();

            if (null != telemetryService)
            {
                if (null != configurationService)
                {
                    // DO NOT try to run this asynchronously; MetroLog hangs when invoked async
                    //AsyncHelper.RunSync(() => telemetryService.Initialize(configurationService.Configuration.TelemetryKey));
                    telemetryService.Initialize(configurationService.Configuration.IsTelemetryEnabled,
                                                configurationService.Configuration.TelemetryKey);

                    // log app start
                    TelemetryService.Current?.LogTelemetryEvent(TelemetryEvents.StartApplication);
                }
            }
        }
コード例 #39
0
ファイル: BaseRepository.cs プロジェクト: awsxdr/raindrop
 public BaseRepository(
     Func<string, IDatabase> databaseFactory)
 {
     _database = new Lazy<IDatabase>(() => databaseFactory(DatabaseFileName));
 }
コード例 #40
0
		BreakpointBreakChecker(Lazy<DbgCodeBreakpointHitCountService2> dbgCodeBreakpointHitCountService, Lazy<DbgCodeBreakpointFilterChecker> dbgCodeBreakpointFilterChecker, Lazy<DbgCodeBreakpointHitCountChecker> dbgCodeBreakpointHitCountChecker, Lazy<DbgCodeBreakpointConditionChecker> dbgCodeBreakpointConditionChecker, Lazy<DbgCodeBreakpointTraceMessagePrinter> dbgCodeBreakpointTraceMessagePrinter) {
			this.dbgCodeBreakpointHitCountService = dbgCodeBreakpointHitCountService;
			this.dbgCodeBreakpointFilterChecker = dbgCodeBreakpointFilterChecker;
			this.dbgCodeBreakpointHitCountChecker = dbgCodeBreakpointHitCountChecker;
			this.dbgCodeBreakpointConditionChecker = dbgCodeBreakpointConditionChecker;
			this.dbgCodeBreakpointTraceMessagePrinter = dbgCodeBreakpointTraceMessagePrinter;
		}
コード例 #41
0
ファイル: RulesTests.cs プロジェクト: nodyang/DryIoc
 public ADLazyConsumer(Lazy <AD> ad)
 {
     Ad = ad.Value;
 }
コード例 #42
0
 static RedisCacheDatabaseProvider()
 {
     _connectionMultiplexer = new Lazy <ConnectionMultiplexer>(CreateConnectionMultiplexer);
 }
コード例 #43
0
ファイル: ControllerSharp.cs プロジェクト: Mej0/a
 public ControllerSharp([Import] IServiceContext context, [Import] Lazy <IOrbwalkerManager> orbwalker)
 {
     this.owner     = context.Owner;
     this.context   = context;
     this.orbwalker = orbwalker;
 }
コード例 #44
0
 internal static SourceText Create(Stream stream, Lazy <Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
 => EncodedStringText.Create(stream, getEncoding, defaultEncoding, checksumAlgorithm, canBeEmbedded);
コード例 #45
0
 public static void Register <T>(Func <T> function)
 {
     services[typeof(T)] = new Lazy <object>(() => function());
 }
コード例 #46
0
 public static void ClearUpdatableComponentCache()
 {
     UpdatableComponentsEditor.Value?.Clear();
     UpdatableComponentsEditor = new Lazy <Dictionary <string, ConstructorInfo> >(FindUpdatableComponentEditorFromAssemblies);
 }
コード例 #47
0
 public FieldFormattableStringViewModel(FieldFormattableString model) : base(model)
 {
     Lazy.Initialize(out table, () => GenerateTable().ToList().AsReadOnly());
 }
コード例 #48
0
 public TransformProjectsIntoContainers(ILogger logger)
 {
     _logger = logger;
     _certificateDirectory = new Lazy <TempDirectory>(() => TempDirectory.Create());
 }
コード例 #49
0
 public ContactListView()
 {
     InitializeComponent();
     viewModel = new Lazy <ContactListViewModel>(() => ViewHelper.GetViewModel <ContactListViewModel>(this) !);
     Loaded   += LoadedHandler;
 }
コード例 #50
0
        /// <summary>
        /// Do your analysis. This method is called once per segment (typically one-minute segments).
        /// </summary>
        /// <param name="audioRecording"></param>
        /// <param name="configuration"></param>
        /// <param name="segmentStartOffset"></param>
        /// <param name="getSpectralIndexes"></param>
        /// <param name="outputDirectory"></param>
        /// <param name="imageWidth"></param>
        /// <returns></returns>
        public override RecognizerResults Recognize(AudioRecording audioRecording, Config configuration, TimeSpan segmentStartOffset, Lazy <IndexCalculateResult[]> getSpectralIndexes, DirectoryInfo outputDirectory, int?imageWidth)
        {
            // The next line actually calculates the high resolution indices!
            // They are not much help for frogs recognition but could be useful for HiRes spectrogram display

            /*
             * var indices = getSpectralIndexes.Value;
             * // check if the indices have been calculated - you shouldn't actually need this
             * if (getSpectralIndexes.IsValueCreated)
             * {
             *  // then indices have been calculated before
             * }
             */

            // DIFFERENT WAYS to get value from CONFIG file.
            // Get a value from the config file - with a backup default
            //          int minHz = (int?)configuration[AnalysisKeys.MinHz] ?? 600;
            // Get a value from the config file - with no default, throw an exception if value is not present
            //          int maxHz = ((int?)configuration[AnalysisKeys.MaxHz]).Value;
            // Get a value from the config file - without a string accessor, as a double
            //          double someExampleSettingA = (double?)configuration.someExampleSettingA ?? 0.0;
            // common properties
            //          var speciesName = (string)configuration[AnalysisKeys.SpeciesName] ?? "<no species>";
            //          var abbreviatedSpeciesName = (string)configuration[AnalysisKeys.AbbreviatedSpeciesName] ?? "<no.sp>";

            //RecognizerResults results = Algorithm1(recording, configuration, outputDirectory);
            RecognizerResults results = Algorithm2(audioRecording, configuration, outputDirectory, segmentStartOffset);

            return(results);
        }
コード例 #51
0
 protected HttpActionDescriptor()
 {
     _filterPipeline = new Lazy <Collection <FilterInfo> >(InitializeFilterPipeline);
 }
コード例 #52
0
 /// <summary>
 ///     Add a new contract + service implementation
 /// </summary>
 /// <typeparam name="TContract">Contract type</typeparam>
 /// <typeparam name="TService">Service type</typeparam>
 public void Register <TContract, TService>() where TService : new()
 {
     registeredServices[typeof(TContract)] =
         new Lazy <object>(() => Activator.CreateInstance(typeof(TService)));
 }
コード例 #53
0
ファイル: IOCTests.cs プロジェクト: miroslavpokorny/BTDB
 public WorldHttpHandler(Lazy <IWorld> world, IEnumerable <IRefinable> refinables)
 {
     Assert.Single(refinables);
 }
コード例 #54
0
        private IEnumerable <string> GetProductIdsFromArgs(Arguments args, ValidationContext context, Lazy <Variables> variableValues)
        {
            var argValues = new Lazy <Dictionary <string, object> >(() => ExecutionHelper.GetArgumentValues(
                                                                        context.Schema,
                                                                        new QueryArguments(
                                                                            context.TypeInfo.GetFieldDef()?.Arguments
                                                                            .Where(arg => arg.Name == "productIds")
                                                                            ?? Enumerable.Empty <QueryArgument>()
                                                                            ),
                                                                        args,
                                                                        variableValues.Value));

            if (argValues.Value.ContainsKey("productIds"))
            {
                return(((IEnumerable)argValues.Value["productIds"]).Cast <string>());
            }

            return(Enumerable.Empty <string>());
        }
コード例 #55
0
ファイル: IOCTests.cs プロジェクト: miroslavpokorny/BTDB
 public Cycle2(Lazy <ICycle1> cycle1)
 {
     _cycle1 = cycle1;
 }
コード例 #56
0
 internal static ITagger <IntraTextAdornmentTag> GetTagger(IWpfTextView view, IEditorFormatMap format, Lazy <ITagAggregator <CommentTag> > commentTagger)
 {
     return(view.Properties.GetOrCreateSingletonProperty(() => new CommentAdornmentTagger(view, format, commentTagger.Value)));
 }
コード例 #57
0
 ShowCodeBreakpointSettingsServiceImpl(IAppWindow appWindow, UIDispatcher uiDispatcher, Lazy <DbgCodeBreakpointsService> dbgCodeBreakpointsService, Lazy <DbgFilterExpressionEvaluatorService> dbgFilterExpressionEvaluatorService, IMessageBoxService messageBoxService)
 {
     this.appWindow    = appWindow;
     this.uiDispatcher = uiDispatcher;
     this.dbgCodeBreakpointsService           = dbgCodeBreakpointsService;
     this.dbgFilterExpressionEvaluatorService = dbgFilterExpressionEvaluatorService;
     this.messageBoxService = messageBoxService;
 }
コード例 #58
0
ファイル: IOCTests.cs プロジェクト: miroslavpokorny/BTDB
 public RefinePreview(Lazy <IWorld> world, INotify notify)
 {
     Assert.IsType <NotificationOverride>(notify);
 }
コード例 #59
0
ファイル: LazyCell.cs プロジェクト: zzazang/sodium
 internal LazyCell(Stream <T> stream, Lazy <T> lazyInitialValue)
     : base(stream, default(T))
 {
     this.LazyInitialValue = lazyInitialValue;
 }
コード例 #60
0
ファイル: IOCTests.cs プロジェクト: miroslavpokorny/BTDB
 public Cycle1(Lazy <ICycle2> cycle2)
 {
     _cycle2 = cycle2;
 }