-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(project): upgrade to UIComponents v1.0.0-beta.6 (#4)
- Loading branch information
Showing
3 changed files
with
25 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,17 @@ | ||
using System.Collections.Generic; | ||
using UIComponents; | ||
using UIComponents; | ||
using UIComponents.DependencyInjection; | ||
using ILogger = UIComponents.ILogger; | ||
|
||
namespace UnityGit.Core.Services | ||
{ | ||
[Dependency(typeof(ILogger), provide: typeof(DebugLogger))] | ||
public abstract class Service : IDependencyConsumer | ||
public abstract class Service : DependencyConsumer | ||
{ | ||
protected readonly ILogger Logger; | ||
|
||
private readonly DependencyInjector _dependencyInjector; | ||
|
||
protected Service() | ||
{ | ||
DiContext.Current.RegisterConsumer(this); | ||
_dependencyInjector = DiContext.Current.GetInjector(GetType()); | ||
Logger = Provide<ILogger>(); | ||
UIC_PopulateProvideFields(); | ||
} | ||
|
||
protected T Provide<T>() where T : class | ||
{ | ||
return _dependencyInjector.Provide<T>(); | ||
} | ||
|
||
public abstract IEnumerable<IDependency> GetDependencies(); | ||
|
||
protected abstract void UIC_PopulateProvideFields(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
using System.Collections.Generic; | ||
using UIComponents; | ||
using UIComponents.DependencyInjection; | ||
using UnityGit.Core.Services; | ||
|
||
namespace UnityGit.Editor.Toolbar | ||
{ | ||
internal class BranchToolbarButtonServices : IDependencyConsumer | ||
[Dependency(typeof(IStatusService), provide: typeof(StatusService))] | ||
[Dependency(typeof(ICheckoutService), provide: typeof(CheckoutService))] | ||
[Dependency(typeof(IBranchService), provide: typeof(BranchService))] | ||
internal partial class BranchToolbarButtonServices : DependencyConsumer | ||
{ | ||
public IEnumerable<IDependency> GetDependencies() | ||
{ | ||
return new IDependency[] | ||
{ | ||
Dependency.SingletonFor<IStatusService, StatusService>(), | ||
Dependency.SingletonFor<ICheckoutService, CheckoutService>(), | ||
Dependency.SingletonFor<IBranchService, BranchService>() | ||
}; | ||
} | ||
[Provide] | ||
public IStatusService StatusService; | ||
|
||
[Provide] | ||
public ICheckoutService CheckoutService; | ||
|
||
[Provide] | ||
public IBranchService BranchService; | ||
} | ||
|
||
} |