public App() { InitializeComponent(); Directory.CreateDirectory(Paths.ROOT_DIRECTORY); DependencyService.Register <MockDataStore>(); // Register transient types: container.RegisterType <IUserService, UserService>(); container.RegisterType <IConvoService, ConvoService>(); container.RegisterType <ICompressionUtility, BrotliUtility>(); container.RegisterType <ICompressionUtilityAsync, BrotliUtilityAsync>(); container.RegisterType <IAsymmetricKeygenRSA, AsymmetricKeygenRSA>(); container.RegisterType <ISymmetricCryptography, SymmetricCryptography>(); container.RegisterType <IAsymmetricCryptographyRSA, AsymmetricCryptographyRSA>(); container.RegisterType <IServerConnectionTest, ServerConnectionTest>(); container.RegisterType <IMessageSender, MessageSender>(); container.RegisterType <ITotpProvider, TotpProvider>(); container.RegisterType <IKeyExchange, KeyExchange>(); container.RegisterType <IPasswordChanger, PasswordChanger>(); container.RegisterType <IRegistrationService, RegistrationService>(); // Register IoC singletons: container.RegisterType <User>(new ContainerControlledLifetimeManager()); // This is the application's user. container.RegisterType <IMethodQ, MethodQ>(new ContainerControlledLifetimeManager()); container.RegisterType <ILogger, TextLogger>(new ContainerControlledLifetimeManager()); container.RegisterType <IAppSettings, AppSettingsJson>(new ContainerControlledLifetimeManager()); container.RegisterType <IUserSettings, UserSettingsJson>(new ContainerControlledLifetimeManager()); container.RegisterType <IEventAggregator, EventAggregator>(new ContainerControlledLifetimeManager()); container.RegisterType <IViewModelFactory, ViewModelFactory>(new ContainerControlledLifetimeManager()); container.RegisterType <IConvoPasswordProvider, ConvoPasswordProvider>(new ContainerControlledLifetimeManager()); container.RegisterType <IMessageFetcher, MessageFetcher>(new ContainerControlledLifetimeManager()); user = container.Resolve <User>(); logger = container.Resolve <ILogger>(); methodQ = container.Resolve <IMethodQ>(); userService = container.Resolve <IUserService>(); appSettings = container.Resolve <IAppSettings>(); userSettings = container.Resolve <IUserSettings>(); convoService = container.Resolve <IConvoService>(); totpProvider = container.Resolve <ITotpProvider>(); eventAggregator = container.Resolve <IEventAggregator>(); crypto = container.Resolve <IAsymmetricCryptographyRSA>(); viewModelFactory = container.Resolve <IViewModelFactory>(); connectionTest = container.Resolve <IServerConnectionTest>(); convoPasswordProvider = container.Resolve <IConvoPasswordProvider>(); // Subscribe to important IEventAggregator PubSubEvents. eventAggregator.GetEvent <LogoutEvent>().Subscribe(Logout); eventAggregator.GetEvent <ClickedRegisterButtonEvent>().Subscribe(ShowRegistrationPage); eventAggregator.GetEvent <ClickedConfigureServerUrlButtonEvent>().Subscribe(ShowConfigServerUrlPage); eventAggregator.GetEvent <UserCreationSucceededEvent>().Subscribe(OnUserCreationSuccessful); eventAggregator.GetEvent <UserCreationVerifiedEvent>().Subscribe(() => ShowLoginPage(false)); eventAggregator.GetEvent <LoginSucceededEvent>().Subscribe(OnLoginSuccessful); eventAggregator.GetEvent <JoinedConvoEvent>().Subscribe(OnJoinedConvo); }
#pragma warning disable 1591 public MessageSender(User user, IUserService userService, IConvoPasswordProvider convoPasswordProvider, IConvoService convoService, IAsymmetricCryptographyRSA rsa, IUserSettings userSettings, IKeyExchange keyExchange, ISymmetricCryptography aes, ICompressionUtilityAsync compressionUtility) { this.aes = aes; this.rsa = rsa; this.user = user; this.keyExchange = keyExchange; this.userService = userService; this.userSettings = userSettings; this.convoService = convoService; this.compressionUtility = compressionUtility; this.convoPasswordProvider = convoPasswordProvider; }
#pragma warning disable 1591 public MessageFetcher(IConvoService convoService, User user) { this.user = user; this.convoService = convoService; }