Running a ClickOnce Application as Administrator

WPF & WinForms

Posted on

7,311 views

3 comments

Using ClickOnce to deploy your Windows application is the easiest way you can imagine.
BUT, as it gets with all automatic process, there are situations when you ran into a problem: my ClickOnce deployed application wouldn't start on Windows 8 operating system.

Get computer IP address - LAN & Internet using C#

WPF & WinForms

Posted on

33,750 views

9 comments

There are two ways to get your IP address!
First is for LAN IP, which indicates your computer address in local network, while the second way is to get your INTERNET IP, which is stored in your router.

#1 - Get computer LAN address like 192.168.1.3
#2 - Get computer INTERNET address like 93.136.91.7

Check if Internet connection is available using C#

WPF & WinForms

Posted on

8,962 views

2 comments

There can be situations when you need to check, whether your application has Internet access.
Maybe you have to download/upload some file or database, or just run some application check.

Many developers are solving that "problem" just by ping-ing Google.com. Well...? :/ That will work in most (99%) cases, but how professional is to rely work of Your application on some external web service?

Instead of pinging Google.com, there is an very interesting Windows API function called InternetGetConnectedState(), that recognizes whether You have access to Internet or not.

Accessing Controls running in different Thread

WPF & WinForms

Posted on

2,432 views

If you worked with System.Threading.Thread in desktop applications, you probably ran into problem, where you wanned to access some control, and update her condition / property.

Controls in Windows Forms are bound to a specific thread and are not thread safe. Therefore, if you are calling a control's method from a different thread, you must use one of the control's invoke methods to marshal the call to the proper thread.