Call help file in .net window application - chm

We want to know how to show related topic of help file when user click F1 on specific interface.
Thanks
H N Mishra

If you are using windows forms, have a look at a help provider.
Dropping one on your form will give you a ? button in the corner which you can then wire up to each control. You can even hyperlink that into a CHM file, along with any other part that you wish to do.

You may use HelpProvider & HelpNavigator controls. Calling help will look something like this
private void F1pressed(object sender, EventArgs e)
{
Help.ShowHelp(this, helpProvider.HelpNamespace, HelpNavigator.Topic, "screen_8383.htm");
}

Related

PhpStorm autocomplete __construct method

When you write public function __ PhpStorm prompt's a list of Magic Methods
So if you, for instance, want to create a constructor for your class, you would use __construct magic method. For example, I typed __con and PhpStorm detect's my intention of creating a constructor thus a prompt window suggests me to auto-create one.
Once you hit Enter the method is created.
While this is pretty nice, I would really love to have the cursor automatically placed between parenthesis like this: public function __construct(|) (the vertical bar "|" illustrates the cursor), and that would give me the ability to write the params needed for the constructor, in case I don't need any properties, I could press Tab and the cursor would move to the body of the method like this:
public function __construct()
{
|
}
From what I read in PhpStorm documentation, I did not found anywhere to be mentioned that you can edit those suggestions by PhpStorm, so I believe that in order to archive what I'm describing I have to go with a live template like this:
So my question is: Is my approach the only way to archive that or there is a way to edit the PhpStorm build-in suggestion for the class constructor magic method?
Thanks!
This is a known problem, please vote for WI-33646.

What does __ mean when it is part of a function name

I have been looking for a way to code the popup window to perform some action in the parent window here on SO. Somewhere in one of the posts I read a suggestion that the "inspect element" option in browsers is a good way to learn. With this option I got the code for the session timeout popup from my host. Here is the part that I am trying to understand:
function fireTimeoutEvent()
{
__doPostBack('','#####forceSessionTimeout');
}
function __doPostBack(eventTarget, eventArgument)
{
var theform = document.Form1;
theform.__EVENTTARGET.value = eventTarget;
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
What do the "__" mean in the four lines of the code? Do they have a special significance? Am I correct in thinking this is javascript? I ask because I am not familiar enough with the niceties of javascript, jquery and the rest to be able to recognize the difference.
Also, from this script, is it possible to tell what it is going to do? Though the popup is essentially meant to extend the session, it has some other functions besides this one, but none of the others have any under-scores in them.
Usually library writers use _ or __ to indicate private functions or methods. So this is probably something that the person didn't want people to call directly.

Metro App OnSearchActivated ProgressRing not displaying

I am implementing searching within my Metro application. The search works well, results and UI come up as expected with one problem though.
I try to display a ProgressRing before the search and hide it after the search completes, but it never gets displayed.
What am I missing, code snippet below:
protected override void OnSearchActivated(Windows.ApplicationModel.Activation.SearchActivatedEventArgs args)
{
// Some Metro designer generated code here
// Show progress ring
MainPage.Current.ResetProgressRingState(true);
// Bind search results
MainPage.Current.BindSearchResults(args.QueryText);
// Ensure the current window is active
Window.Current.Activate();
// Hide progress ring
MainPage.Current.ResetProgressRingState(false);
}
I suspect that the BindSearchResults method needs to be awaited in order for the ProgressRing to work correctly. If so, what's the easiest way to make that method awaitable, if not please advise what I am missing here.
If so, what's the easiest way to make that method awaitable, if not please advise what I am missing here.
Mark it as async and have it return Task. Within that method, use await on other asynchronous operations.

How to submit HTML and receive a bitmap?

I have an app that allows a user to use JQuery and Javascript to add images and position them in a div dynamically.
I would like to be able to submit the div with all the HTML to a WebService and receive back an image so we have a bitmap of the result of the end user's work.
I would prefer a solution in .Net as this is what I am most familiar with but am open to pretty much anything?
I would like to be able to submit the div with all the HTML to a WebService and receive back an image
Try http://browsershots.org!
Browsershots makes screenshots of your web design in different operating systems and browsers. It is a free open-source online web application providing developers a convenient way to test their website's browser compatibility in one place.
How about this. You load the html into a webbrowser control and then use the DrawToBitmap method. It doesn't show up on intellisense and this is probably not the best solution, but it works. Observe the DocumentCompleted event and add the following code:
private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
var bmp = new Bitmap(100, 100);
var rect = new Rectangle(webBrowser.Location.X, webBrowser.Location.Y, webBrowser.Width, webBrowser.Height);
webBrowser.DrawToBitmap(bmp, rect);
bmp.Save("test.jpg", ImageFormat.Jpeg);
}
You'll probably want to change the width and height of that bitmap object (do it in some smart way or something). Hope this helps.
EDIT: I see now that you are using a webservice for this, hence this solution probably won't work. I'll leave it here just for information's sake.
I was not able to figure out how to do this by submitting the html and receiving an image but I was able to create and ASHX handler that returns a png file based on this blog post
which was good enough for my scenario.
He uses CutyCapt to take a screen shot of an existing web page, write the image to a folder on the webserver and return it.

WPF Frames - open links in external browser

I have a Frame (used to display a local html file) in a WPF window. I would like that when the user clicks on a link or such, this is opened in an external browser window ( user's default web browser).
Any ideas how to go about this please?
Just do it:
private void Frame_Navigating(object sender, NavigatingCancelEventArgs e)
{
// You should make sure the links are different.
if (IsExternalLink(e.Uri))
{
// open links in extbrowser.
Process.Start(e.Uri.AbsoluteUri);
// cancel the event, and Frame cannot perform navigation operation.
e.Cancel = true;
}
}
Another solution:
ExternalLinks use the Click event instead of the RequestNavigate event.
<TextBlock>
<Hyperlink NavigateUri="http://www.google.com" TargetName="_top">
Go Google!
</Hyperlink>
</TextBlock>
This is a really informative article Launching the Browser from a Hyperlink and goes some to explaining what you need, read through the bullet points of "Browser (XBAP or Loose XAML)".
Setting the TargetName="_self" will open the link in the current frame, which I gather is what you want.