private void LoadImageFromInternalStorage(string path) { try { string combinedPath = path + "/picture.png"; System.IO.FileStream stream = new System.IO.FileStream(combinedPath, System.IO.FileMode.Open, System.IO.FileAccess.Read); bitmap = BitmapFactory.DecodeStream(stream); picture.SetImageBitmap(bitmap); stream.Close(); } catch (Exception e) { System.Diagnostics.Debug.Write("Deze lijn: " + e.Message); } }
private async void cameraBtnClicked(object sender, EventArgs e) { var action = await DisplayActionSheet("Take or select photo", "Cancel", null, "Take Picture", "Select picture"); MediaFile m = null; switch (action) { case "Take Picture": m = await App.MANAGER.MediaContorller.TakePicture(); break; case "Select picture": m = await App.MANAGER.MediaContorller.SelectPicture(); break; } if (m == null) { return; } IImageProcessing processer = DependencyService.Get <IImageProcessing>(); Bitmap b = await processer.ScaleBitmap(m.Source, await processer.GetBitmapOptionsOfImageAsync(m.Source), 200, 200); image.SetImageBitmap(b); pic = processer.compress(b); m.Dispose(); }
public void DrawMap() { // Clean up ResetMap(); // Get out drawing var canvas = new Canvas(CurrentImage); if (StartPoint != null) { canvas.DrawCircle(StartPoint.X, StartPoint.Y, 20, PaintBrush); } if (EndPoint != null) { canvas.DrawCircle(EndPoint.X, EndPoint.Y, 20, PaintBrush); } if (UserPosition != null) { // Just some maths to scale the image (we dont want a big arrow at least not for now lol) canvas.DrawBitmap(CurrentUserRepresentation, UserPosition.X - CurrentUserRepresentation.Width / 2, UserPosition.Y - CurrentUserRepresentation.Height / 2, PaintBrush); } if (StartPoint != null && EndPoint != null) { // Map points var startPoint = PathfindingGraph.FindClosestNode((int)StartPoint.X, (int)StartPoint.Y); var endPoint = PathfindingGraph.FindClosestNode((int)EndPoint.X, (int)EndPoint.Y); UserPath = PathfindingGraph.FindPath(startPoint, endPoint); } if (UserPath.Count > 0) { PaintBrush.StrokeWidth = 5; PaintBrush.Color = Color.Red; // If we have some path, draw it foreach (var edge in UserPath) { var start = new Vector2(edge.Source); var target = new Vector2(edge.Target); canvas.DrawLine(start.X, start.Y, target.X, target.Y, PaintBrush); } } canvas.Dispose(); CIVInstance.SetImageBitmap(CurrentImage); }
protected override async void OnAppearing() { IImageProcessing processer = DependencyService.Get <IImageProcessing>(); profImg.SetImageBitmap(await processer.ScaleBitmap(item.picture, await processer.GetBitmapOptionsOfImageAsync(item.picture), 200, 200)); if (App.CredManager.IsLoggedIn()) { buyBtn.IsEnabled = true; buyBtn.Text = "Buy Item"; } else { buyBtn.IsEnabled = false; buyBtn.Text = "Log in to buy Item"; } }
public fblaChapterListView() { SeparatorColor = Constants.palette.divider; Label schoolLabel = null; Label locLabel = null; // Source of data items. VerticalOptions = LayoutOptions.FillAndExpand; HorizontalOptions = LayoutOptions.FillAndExpand; RowHeight = 75; // Define template for displaying each item. // (Argument of DataTemplate constructor is called for // each item; it must return a Cell derivative.) ItemTemplate = new DataTemplate(() => { // Create views with bindings for displaying each property. schoolLabel = new Label { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; locLabel = new Label(); schoolLabel.SetBinding(Label.TextProperty, "school"); imageView = new CustomImageView { HeightRequest = 75, WidthRequest = 75, }; // Return an assembled ViewCell. return(new ViewCell { View = new StackLayout { Padding = new Thickness(5, 5, 5, 5), Orientation = StackOrientation.Horizontal, Children = { imageView, new StackLayout { //VerticalOptions = LayoutOptions.Center, Spacing = 5, Children = { schoolLabel, locLabel, } } } } }); }); this.ItemSelected += ((sender, eventArgs) => { if (this.SelectedItem != null) { var c = SelectedItem as myDataTypes.fblaChapter; var chapterView = new fblaChapterPage(c); this.SelectedItem = null; Navigation.PushAsync(chapterView); } }); ItemAppearing += async(s, e) => { if (e.Item == null) { return; } myDataTypes.fblaChapter i = e.Item as myDataTypes.fblaChapter; locLabel.Text = i.city + ", " + i.state; schoolLabel.Text = i.school; IImageProcessing processer = DependencyService.Get <IImageProcessing>(); imageView.SetImageBitmap(await processer.ScaleBitmap(i.picture, await processer.GetBitmapOptionsOfImageAsync(i.picture), 200, 200)); }; }