Ejemplo n.º 1
0
 public MovieService()
 {
     _dbContext    = ContextLocator.GetContext();
     _mapperConfig = new MapperConfiguration(cfg =>
     {
         cfg.AddProfile(new MovieProfile());
         cfg.AddProfile(new UserMovieRatingProfile());
     });
     _mapper = _mapperConfig.CreateMapper();
 }
Ejemplo n.º 2
0
 /// <inheritdoc/>
 public virtual object?GetContext(string id)
 {
     if (!string.IsNullOrEmpty(id))
     {
         Func <object>?locator = null;
         if (ContextLocator?.TryGetValue(id, out locator) == true)
         {
             return(locator?.Invoke());
         }
     }
     return(null);
 }
Ejemplo n.º 3
0
        public Startup(IConfiguration configuration, IHostingEnvironment env)
        {
            Configuration     = configuration;
            ConfigurationRoot = new ConfigurationBuilder()
                                .SetBasePath(env.ContentRootPath)
                                .AddJsonFile("appsettings.json", true, true)
                                //.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true)
                                .AddEnvironmentVariables()
                                .Build();

            ContextLocator.Initialise(ConfigurationRoot);
        }
Ejemplo n.º 4
0
 ///<inheritdoc/>
 public virtual object?GetContext(string id)
 {
     if (!string.IsNullOrEmpty(id))
     {
         Func <object>?locator = null;
         if (ContextLocator?.TryGetValue(id, out locator) == true)
         {
             return(locator?.Invoke());
         }
     }
     Debug.WriteLine($"Context with provided id={id} is not registered");
     return(null);
 }
Ejemplo n.º 5
0
        public override void InitLayout(IDockable layout)
        {
            this.ContextLocator = new Dictionary <string, Func <object> >
            {
                [nameof(IRootDock)]         = () => _derp,
                [nameof(IProportionalDock)] = () => _derp,
                [nameof(IDocumentDock)]     = () => _derp,
                [nameof(IToolDock)]         = () => _derp,
                [nameof(ISplitterDockable)] = () => _derp,
                [nameof(IDockWindow)]       = () => _derp,
                [nameof(IDocument)]         = () => _derp,
                [nameof(ITool)]             = () => _derp,
                ["LeftPane"]             = () => _derp,
                ["LeftPaneTop"]          = () => _derp,
                ["LeftPaneTopSplitter"]  = () => _derp,
                ["LeftPaneBottom"]       = () => _derp,
                ["RightPane"]            = () => _derp,
                ["RightPaneTop"]         = () => _derp,
                ["RightPaneTopSplitter"] = () => _derp,
                ["RightPaneBottom"]      = () => _derp,
                ["DocumentsPane"]        = () => _derp,
                ["MainLayout"]           = () => _derp,
                ["LeftSplitter"]         = () => _derp,
                ["RightSplitter"]        = () => _derp,
                ["MainLayout"]           = () => _derp,
                ["Main"]           = () => _derp,
                ["Main"]           = () => _derp,
                ["VerticalPane"]   = () => _derp,
                ["BottomPane"]     = () => _derp,
                ["BottomSplitter"] = () => _derp,
                ["TopPane"]        = () => _derp,
                ["TopSplitter"]    = () => _derp,
                ["WindowDocument"] = () => _derp,
            };

            foreach (var item in _floatingToolWindows)
            {
                ContextLocator.Add(item.Key, () => ConstructToolView(item.Value.ToolWindowAttribute.ViewType));
            }

            foreach (var item in _documentToolWindows)
            {
                ContextLocator.Add(item.Key, () => ConstructToolView(item.Value.ToolWindowAttribute.ViewType));
            }

            this.HostWindowLocator = new Dictionary <string, Func <IHostWindow> >
            {
                [nameof(IDockWindow)] = () =>
                {
                    var hostWindow = new HostWindow()
                    {
                        [!HostWindow.TitleProperty] = new Binding("ActiveDockable.Title")
                    };
                    return(hostWindow);
                }
            };

            // No f*****g clue what this does...
            // Dock.Avalonia has shit documentation.
            this.DockableLocator = new Dictionary <string, Func <IDockable> >
            {
            };

            base.InitLayout(layout);
        }