Creating a FaceBook Like Button for C# Winforms Desktop Application - c#

I want to link my winforms application to Facebook fanpage,So that a +1 is added when the user clicks the Like button on the Form .How can do it in C# winforms.Is it possible by invoking a URL.

You can get some LIKE button code: http://developers.facebook.com/docs/reference/plugins/like/ it will give you a few options, then you have a choice of delivery formats - choose IFRAME.
you'll get something that looks like this:
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.webbod.info&send=false&layout=standard&width=450&show_faces=false&action=like&colorscheme=light&font&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true">
</iframe>
You are only interested in the src and the dimensions.
In your winforms application you can host a webbrowser control size it to the dimensions and point it at the src - this will give you an embedded facebook like button.
Facebook allows people to Like URLs, so you'll need to provide one - in my example it's www.webbod.info, but anything should do and by varying the href part of the src url you can let people like any part of the application.

Related

HTML/CCS print function

I'm creating a website and I want to add a button to print the page. I was able to do it, as it would print with ctrl+P, but the structure gets all changed and it looks bad.
<div class="header-content">
<h2 id="Feed">
<button onclick="printFunction()">Imprimir</button>
<script>function printFunction(){window.print();}</script>
</h2>
</div>
Is there other way to do print? Like if it was a print screen
When printing a webpage, the page is re-rendered to fit the page rather than taking a sort of screenshot and printing that. This allows developers to create custom styles to aid the page to be printed to paper which is inherently different from laying it out on the screen.
There is a way to get something similar to what you want using canvas as outlined here:
Using HTML5/Canvas/JavaScript to take in-browser screenshots
using the tool:
https://html2canvas.hertzen.com/
but it's not perfect and I don't believe it's possible to get a perfect screenshot without using a browser extension.

How to display HTML article in app? WinRT

I'm creating client-side WP 8.1(appx) app for one website.
Well, let's say that I got html code of some article(with images, lists etc), only article(without site's header etc).
I want to display that article in my WP 8.1 app with article's formatting and images.
How can I do that?
I tried using WebView but it's not what I need, because text in WebView is really small and needs zooming and so on.
* for Tamás Deme *
<RichTextBlock>
<common:Properties.Html>
<![CDATA[ <img width="100" height = "100" src="https://www.google.com/images/srpr/logo11w.png"/> ]]>
</common:Properties.Html>
</RichTextBlock>
It displays p, b tags properly, the only problem is images.
* for Tamás Deme *
You could use the HtmlAgilityPack to parse the page, and then rerender the article's contents in a RichTextBlock.
To do the conversion these two links I found might help: http://blogs.msdn.com/b/tess/archive/2013/05/13/displaying-html-content-in-a-richtextblock.aspx and https://github.com/MacawNL/WinRT-RichTextBlock.Html2Xaml
have you tried the JavaScript Windows Store App templates (available in VS2013)?
you can find some good tutorials here: https://msdn.microsoft.com/en-us/library/windows/apps/br211385.aspx?f=255&MSPPError=-2147217396

How to set dynamic home page link in image logo?

MySite.com
when I click site logo, wanna appear sitefinity home page. how to set href atrribute in sitefinity as sitefinity CMS is dynamic home page?
there are several ways to achieve this, depending on how you have your logo setup on the page.
Your home page is usually setup to load when you visit the top level domain, which is at the root of your site.
If this is the case and you have your logo defined in a .master page, you can easily set the link to be the root, like
<img />
If, on the otherhand, you have the image on a sitefinity page or template, you need to make sure that you're adding the image inside a ContentBlock, and not the Image widget from the sidebar. This widget is only used to disaply an image, not link one.
by adding the image to the content block, you can then select it and add a link from the radeditor toolbar to the home page (or any other page)
hope this is helfpul!
Another, rather easy way of doing this would be using your url http://www.mysite.com as href for the logo, which is not too bad either (Although not as dynamic anymore)
But still helpful, especially if you are using some code in your print.css that looks like this:
a:link:after,
a:visited:after {
content: " (" attr(href) ") ";
font-size: 90%;
}
and renders href links after your actual links on printed pages.
This would result in something like the below:
[your company logo] http://www.mysite.com

Facebook Like Button in ASP.NET MVC C#

I've created my website that used to show the products; when the user click on the product, it will show the product detail of each item: I want to put the Facebook Like Button inside them.
I tried using http://developers.facebook.com/docs/reference/plugins/like/. This is the url that I tried to put: http://ff/Products/ProductSpec/ (it is in my local), but actually each product have different parameter string due to its ID.
<iframe src="http://www.facebook.com/plugins/like.php?
href=http://www.example.com/Prod/Spec/1115?dep=82&cat=243&tab=2"
scrolling="no" frameborder="0"
style="border:none; width:450px; height:80px"></iframe>
But the URL that shared on my wall in facebook just only "http://www.example.com/Prod/Spec/1115?dep=82" NOT "http://www.example.com/Prod/Spec/1115?dep=82&cat=243&tab=2"
Could anyone tell me how to have Facebook Like Button in ASP .NET MVC website with C# please?
You can create an image button of the like button first and then ..associate a label with it with the incremented integer value. If u want to to store it in database u can also do that.
You could go to the Facebook site dedicated to this button, generate the code and copy it into your layout page (or into view page, as you wish). The process is absolutely the same as for any other technology.
Okay, the task is pretty the same. You just need to put the generated code into the csthml and change slightly the url. For example you generate the following code
<div class="fb-like" data-href="http://www.mysite.com" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false" data-action="recommend" data-font="lucida grande"></div>
you could create some variable like:
#{
string page url = #Url.Action("ProductSpec", "Products", new {id= item.Id})
}
and then replace the url in you link:
<div class="fb-like" data-href=#url data-send="false" data-layout="button_count" data-width="450" data-show-faces="false" data-action="recommend" data-font="lucida grande"></div

modalpopupextendar overlapped by youtube embed iframe

I have a gridview that is dynamically filling by youtube iframe embed objects. Everything is going well be when i am opening a modalpopup on the page, its getting overlapped by youtube iframe.
Please check the image -
Here is the embed code-
<iframe style="z-index:0;" width="300" height="200" src='http://<%# DataBinder.Eval(Container.DataItem,"URL") %>'> frameborder="0" allowfullscreen="false"> </iframe>
can anybody help me out?
Try adding this at the end of the youtube link: ?wmode=Opaque
You cannot do anything about that unless you will hide the Youtube iframe. The Youtude control is a flash ActiveX object and the ActiveX objects have the topmost z-order, which you cannot overlap.
seems wired,
few day back i found similar issue with a javascript horizontal menu that was overlapped by a flash object. I was able to fix that, but here i cont found any <object> tag sothat i can process.
Ok I'm trying to show this modalpopup to any other place on the page.

Categories

Resources