C#/Prism
-
[Prism] RegisterC#/Prism 2023. 2. 7. 10:59
Register says that the given service should be used when the given interface is injected, and that a new instance will be created for each single injection. RegisterSingleton differs in that the same instance is used for all injections. RegisterInstance is the same as RegisterSingleton, but you have to provide an instance. https://stackoverflow.com/questions/61023264/register-vs-registerinstance..
-
[Prism] Navigation view oneTime InstanceC#/Prism 2023. 2. 1. 17:21
void ExecuteItem1Command(string navigatePath) { if (navigatePath != null) this.regionManager.RequestNavigate("DocumentRegion", navigatePath); } RequestNavigate으로 불러와지는 뷰, 뷰모델 위와 같이 IRegionMemberLifetime 상속받고 KeepAlive return false하면 다른뷰로 넘어갈때 인스턴스 해제 RequestNavigate 할때 마다 View instance 생성 ( 생성된 each View Instance마다 each ViewModel생성 ) 위와 같이 INavigationAware상속 후 아래 return false; 추가 public bool IsN..
-
[Prism] RegionAdapterC#/Prism 2023. 2. 1. 14:40
//StackPanelRegionAdapter.cs using Prism.Regions; using System.Collections.Specialized; using System.Windows; using System.Windows.Controls; namespace PMLSStudio.RegionAdapter { public class StackPanelRegionAdapter : RegionAdapterBase { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////..
-
[Prism] <Control> ContentRegionC#/Prism 2023. 2. 1. 14:22
Region 에 하나의 View를 View Injection방식으로 각각을 Instance화 시켜서 View를 여러개 더하여 표현은 가능!! BUT Region 에 하나의 View를 View Injection방식으로 각각을 Instance화 시켜서 Add할때 Add하려는 View에 View Discovery방식으로 주입되어있는 view가 있는경우 Compile Error ( View Discovery방식은 Singletone) View Injection으로 주입되어있는 view가 있는 경우에도 Error Navigation 방식으로하는 경우는 정상작동. ex) View ->(View Injection)independent_View, independent_View, independent_View (가능) ..
-
[Prism] Call Moule ClassC#/Prism 2023. 2. 1. 11:53
Test 필요. how to call wpf prism module class You can call a WPF Prism module class by using the IModuleManager service provided by Prism. You can use the IModuleManager to load a module by type or name and then call the module's class methods. Here is an example of how you can use IModuleManager to load a module and call its class methods: // Get the IModuleManager service from the service locato..
-
-
[Prism] DialogC#/Prism 2023. 1. 6. 16:57
모듈을 Dialog로 등록해서 사용. ViewModel에 IDialogAware인터페이스 추가 ShowDialog public void NewProject() { //using the dialog service as-is var newProjectData = new NewProject(); var dialogParameters = new DialogParameters(); dialogParameters.Add("newProject", newProjectData); //using the dialog service as-is _dialogService.ShowDialog("NewProjectView", dialogParameters, r => { if (r.Result == ButtonResult.OK) {..