如何在Xamarin Android中使用ExifInterface

时间:2018-09-19 15:13:36

标签: c# android xamarin.forms exif public

我正在使用xamarin媒体插件来保存一些图片。图片为JPEG文件。我想做的是在图像细节中编辑评论属性。见图片。

image detail

我在下面的链接上查看ExifInterface。 https://developer.android.com/reference/android/media/ExifInterface#TAG_COPYRIGHT

我的第一个问题是,我需要在哪个标签中发表评论。 我的第二个问题是我应该如何使用SetAttribue()。

这是我的代码。

  private void Button_Clicked(object sender, EventArgs e)
    {
        Photo photo = new Photo()
        {
            Jobno =jobnoentry.Text,
            Applicationletter = Applicationletterentry,
            Signno = signnoentry.Text,
            Type = Phototypeentry,
            Notes = notesentry.Text,
        };

        using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(App.DB_PATH))
        {
            conn.CreateTable<Photo>();
            var numberofrows = conn.Insert(photo);

            if(numberofrows > 0)
              DisplayAlert("Success","Photo has been saved successfully", "Great");
            else
                DisplayAlert("Failure","Error occoured while saving photo", "Try again");
        }
    }

    //edit image comment 
    public void setAttribute(String TAG_USER_COMMENT, String Applicationletterentry) { }




    private async void Take_Photo_Button_Clicked(object sender, EventArgs e)
    {
        await CrossMedia.Current.Initialize();
        if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
        {
            await DisplayAlert("No Camera", ":( No camera available.", "OK");
            return;
        }

        var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
        {
            SaveToAlbum = true,
            Name = jobnoentry.Text + "-" + Applicationletterentry + "-" + signnoentry.Text + "-" + Phototypeentry,

    });

        if (file == null)
            return;

        MainImage.Source = ImageSource.FromStream(() =>
        {
            var stream = file.GetStream();
            return stream;
        });


    }
}

这是我得到的代码

//edit image comment 
        public void setAttribute(String TAG_USER_COMMENT, String Applicationletterentry) { }

这是正确的,我应该在哪里使用此代码。

非常感谢。

0 个答案:

没有答案