Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

How Paste HTML as a Design in email.

$
0
0

I have some HTML , i need copy and paste the HTML and send HTML design email.

i have create renderer for both ios and android. in ios its working fine, but in android its not working properly.
In ios when i copy the HTML and paste in Email its show me design, its working good.
but in android when i copy the HTML and paste in Email its show me HTML text, i need HTML design not HTML text.

In ios below Renderer Code is working fine.

protected override void OnElementChanged (ElementChangedEventArgs e)
{
base.OnElementChanged (e);
CustomButton custombutton = e.NewElement as CustomButton;
if (this.Control != null) {
UIButton btn = (UIButton)Control;
btn.TouchUpInside += delegate {
UIPasteboard pasteboard = UIPasteboard.General;
pasteboard.SetValue(new NSString(string.Empty),UIPasteboard.General.Name);
string htmlType = @"Apple Web Archive pasteboard type";
NSMutableDictionary resourceDictionary = new NSMutableDictionary ();
resourceDictionary.Add (new NSString ("WebResourceData"),
htmlString.Encode (NSStringEncoding.UTF8));
resourceDictionary.Add (new NSString ("WebResourceFrameName"), new
NSString (""));
resourceDictionary.Add (new NSString ("WebResourceMIMEType"), new
NSString ("text/html"));
resourceDictionary.Add (new NSString ("WebResourceTextEncodingName"),
new NSString ("UTF-8"));
resourceDictionary.Add (new NSString ("WebResourceURL"), new NSString
("about:blank"));
NSDictionary containerDictionary = NSDictionary.FromObjectsAndKeys (
new object [] {resourceDictionary},
new object [] {new NSString ("WebMainResource")});
NSDictionary htmlItem = NSDictionary.FromObjectsAndKeys (
new object [] {containerDictionary},
new object [] {htmlType});
pasteboard.AddItems (new NSDictionary [] {htmlItem});
};
}

But in android Renderer code is paste only HTML text not Design .

protected override void OnElementChanged (ElementChangedEventArgs e)
{
base.OnElementChanged (e);
activity= this.Context as Activity;
if (e.OldElement == null) {
CustomButton custombutton = e.NewElement as CustomButton;
custombutton.Clicked += delegate {
ClipboardManager clipboardmanager= (ClipboardManager)activity.GetSystemService(Activity.ClipboardService);
clipboardmanager.Text= emailsignatureViewModel.HtmlSignature;
custombutton._popup.DismissPopup();
};
}
}

please help
Thanks


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>