public BookSearchPage(BookShelf bookShelf) { this.bookShelf = bookShelf; amazonKey = LoadCredentialsFile(); InitializeComponent(); this.Appearing += (object sender, System.EventArgs e) => this.entryTitle.Focus(); //スクリーンのサイズを取得する var screenWidth = Application.Current.MainPage.Width; var screenHeight = Application.Current.MainPage.Height; ResizeView(screenWidth, screenHeight); }
private AmazonCredentials LoadCredentialsFile() { //AmazonCredentials.json sample //{"associate_tag":"XXXXX","access_key_id":"XXXXX","secret_access_key":"XXXXX"} var assembly = typeof(BookSearchPage).GetTypeInfo().Assembly; Stream stream = assembly.GetManifestResourceStream("MyBookReading.Assets.AmazonCredentials.json"); string text = ""; using (var reader = new System.IO.StreamReader(stream)) { text = reader.ReadToEnd(); } AmazonCredentials amazon = JsonConvert.DeserializeObject <AmazonCredentials>(text); return(amazon); }
public AmazonBookSearch(AmazonCredentials cresidentials) { amazonKey = cresidentials; }