public LoginPage(ServiceContainer container) : base(container) { InitializeComponent(); viewModel = new LoginViewModel(); BindingContext = viewModel; authController = Container.Get <AuthController>("auth"); profileApi = Container.Get <ProfileApi>("api/profile"); }
public HistoryPage(ServiceContainer container) : base(container) { InitializeComponent(); historyController = Container.Get <HistoryController>("history"); profileApi = Container.Get <ProfileApi>("api/profile"); imageApi = Container.Get <ImageApi>("api/image"); History = new ObservableCollection <HistoryViewModel>(); _history = new Dictionary <string, HistoryViewModel>(); BindingContext = this; }
public ProfilePage(ServiceContainer container, string profileId) : base(container) { structureController = Container.Get <StructureController>("structure"); bookmarkController = Container.Get <BookmarkController>("bookmark"); authController = Container.Get <AuthController>("auth"); profileApi = Container.Get <ProfileApi>("api/profile"); imageApi = Container.Get <ImageApi>("api/image"); adventureApi = Container.Get <AdventureApi>("api/adventure"); this.profileId = profileId; InitializeComponent(); }
public BookmarksPage(ServiceContainer container) : base(container) { InitializeComponent(); bookmarkController = Container.Get <BookmarkController>("bookmark"); profileApi = Container.Get <ProfileApi>("api/profile"); imageApi = Container.Get <ImageApi>("api/image"); Bookmarks = new ObservableCollection <BookmarkViewModel>(); _bookmarks = new Dictionary <string, BookmarkViewModel>(); BindingContext = this; }
public MatrixApi(Uri url) { if (url != null && url.IsWellFormedOriginalString() && !url.IsAbsoluteUri) { throw new MatrixException(Resources.InvalidUrl); } _isAppservice = false; Backend = new HttpBackend(url, UserId); BaseUrl = url; Rng = new Random(DateTime.Now.Millisecond); Room = new RoomApi(this); LoginEndpoint = new LoginEndpoint(this); VersionsEndpoint = new VersionsEndpoint(this); Device = new DeviceApi(this); Media = new MediaApi(this); Profile = new ProfileApi(this); Sync = new SyncEndpoint(this); RoomDirectory = new RoomDirectoryApi(this); }
protected override async void OnStart() { HttpClient httpClient = new HttpClient(); httpClient.BaseAddress = new Uri(baseUrl); httpClient.MaxResponseContentBufferSize = 256000; var loggingConfig = AWSConfigs.LoggingConfig; loggingConfig.LogMetrics = true; loggingConfig.LogResponses = ResponseLoggingOption.Always; loggingConfig.LogMetricsFormat = LogMetricsFormatOption.JSON; loggingConfig.LogTo = LoggingOptions.SystemDiagnostics; AWSConfigs.AWSRegion = "eu-central-1"; AWSConfigsS3.UseSignatureVersion4 = true; IAmazonS3 s3Client = new AmazonS3Client(AWS_ACCESS_KEY, AWS_SECRET_KEY, RegionEndpoint.EUCentral1); ProfileApi profileApi = new ProfileApi(httpClient); UserApi userApi = new UserApi(httpClient); AdventureApi adventureApi = new AdventureApi(httpClient); ImageApi imageApi = new ImageApi(s3Client); //StructureApi structureApi = new StructureApi(httpClient); //IProfileApi profileApi = new Api.Stub.ProfileApi(); //IUserApi userApi = new Api.Stub.UserApi(); //IAdventureApi adventureApi = new Api.Stub.AdventureApi(); //Api.Stub.ImageApi imageApi = new Api.Stub.ImageApi(); Api.Stub.StructureApi structureApi = new Api.Stub.StructureApi(); await structureApi.InitAsync(); AuthController authController = new AuthController(userApi); authController.TokenChanged += (object sender, EventArgs e) => { if (authController.IsLoggedIn) { httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authController.AuthToken.Token); } else { httpClient.DefaultRequestHeaders.Authorization = null; } }; await authController.InitAsync(); StructureController structureController = new StructureController(structureApi); await structureController.InitAsync(); BookmarkController bookmarkController = new BookmarkController(); await bookmarkController.InitAsync(); HistoryController historyController = new HistoryController(); await historyController.InitAsync(); container = new ServiceContainer(); container.Add("auth", authController); container.Add("structure", structureController); container.Add("bookmark", bookmarkController); container.Add("history", historyController); container.Add("api/profile", profileApi); container.Add("api/user", userApi); container.Add("api/adventure", adventureApi); container.Add("api/structure", structureApi); container.Add("api/image", imageApi); if (authController.IsLoggedIn) { MainPage = new NavigationPage(new MainPage(container)); } else { MainPage = new NavigationPage(new LoginPage(container)); } }
public void Init() { instance = new ProfileApi(); }