public PedidoDetalheModel(Model.Value value, INavigation navigation) { this.viewModel = value; Descricao = viewModel.nomeFormatado; _navigation = navigation; QtdSolicitada = 1; }
private async void LoadCalendar(Model.Value cuRequest) { var client = new HttpClient(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", App.AuthenticationResult.AccessToken); //var response = await client.GetStringAsync("https://graph.microsoft.com/beta/users"); //var response = await client.GetStringAsync("https://graph.microsoft.com/beta/users/" + cuRequest.UserPrincipalName + "/events"); var response = await client.GetStringAsync("https://graph.microsoft.com/beta/me/events"); var result = JsonConvert.DeserializeObject <RootObject>(response); listView.ItemsSource = result.value; var cell = new DataTemplate(typeof(TextCell)); //this below will use the default cell properties but will customize it later //cell.SetBinding(TextCell.TextProperty, "subject"); //cell.SetBinding(TextCell.TextProperty, "organizer.emailAddress.address"); //listView.ItemTemplate = cell; //OK this below is a customized cell that will render more informaiton in 1 row in the List View //listView.ItemTemplate = new DataTemplate(typeof(EventOrgCell)); //this uses my customized cell to make 2 items in 1 row listView.ItemTemplate = new DataTemplate(typeof(EventNameOrgnAddrCell)); //this uses my customized cell to make 2 items in 1 row }
private async void LoadImage(Model.Value cuRequest) { var client = new HttpClient(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", App.AuthenticationResult.AccessToken); //var response = await client.GetStringAsync("https://graph.microsoft.com/beta/users"); var response = await client.GetStringAsync("https://graph.microsoft.com/beta/users/" + cuRequest.UserPrincipalName + "/photo/$value"); //var response = await client.GetStringAsync("https://graph.microsoft.com/beta/users/" + cuRequest.UserPrincipalName + "/photo"); var assembly = typeof(ByteImageConverter).GetTypeInfo().Assembly; //var stream = assembly .GetManifestResourceStream("TestImage.c5qdlJqrb04.jpg"); var stream = assembly.GetManifestResourceStream(response); using (var ms = new MemoryStream()) { await stream.CopyToAsync(ms); byte[] myUserImge = ms.ToArray(); userImage.Source = ImageSource.FromStream(() => new MemoryStream(myUserImge)); } }
public UserDetailandCalendar(Model.Value cuRequest) { Title = cuRequest.DisplayName; listView = new ListView { }; var UserNameLabel = new Label { FontAttributes = FontAttributes.Bold, Text = "Hello " + cuRequest.DisplayName, FontSize = 15 }; var picUrl = "https://graph.microsoft.com/beta/users/" + cuRequest.UserPrincipalName + "/photo/$value"; //LoadImage(cuRequest); LoadCalendar(cuRequest); if (userImage.Source != null) { } else { userImage.Source = ImageSource.FromUri(new Uri("https://dm8cyuj6t42zr.cloudfront.net/wp-content/uploads/2015/05/09143949/SRM-14.png")); } Content = new StackLayout { Children = { UserNameLabel, listView } }; }
public PedidoDetalhe(Model.Value moedas) { InitializeComponent(); BindingContext = viewModel = new PedidoDetalheModel(moedas, this.Navigation); }