|
|
Posted :
5/25/2004 4:52:00 AM
by Matthieu Laban
Category :
Aviation
[This entry has been imported from my old blog, therefore, links and images might now show correctly. Sorry about that]
Found this very interesting article this morning. It'll sure help a lot of people :-) It shows how to update the user interface from threads, and explains how Invoke/BeginInvoke methods work internally.
http://weblogs.asp.net/justin_rogers/articles/126345.aspx
++
|
Posted :
5/21/2004 8:11:00 AM
by Matthieu Laban
Category :
Aviation
[This entry has been imported from my old blog, therefore, links and images might now show correctly. Sorry about that]
On Smartphone devices, users interact with your application using a MainMenu control that is created and added to your main form when you create an application. There is one thing that drove me crazy a few month ago, it was a problem with this MainMenu. I wanted to add sub-menus to my two main menu items and it turned out it was not possible. I was getting the following exception :
An unhandled exception of type 'System.NotSupportedException' occurred in System.Windows.Forms.dll
Additional information: NotSupportedException
on this line :
//
// Form1
//
> this.Menu = this.mainMenu1; this.Text = "Form1";
The problem was that I added submenus to both left and right soft keys menu items, which is not possible, by design apparently. The Smartphone SDK Documentation says so: « The .NET Compact Framework MainMenu components are operated by the Smartphone soft keys. To conform to the Smartphone user interface, the MenuItem class has the following restrictions:
- You can have no more than two top-level menu items.
- Only the second top-level menu item, on the right side of the form, can have submenus.
Note The .NET Compact Framework does not enforce these restrictions at design time but does throw an NotSupportedException at run time.”
So to get rid of this exception, just remove the SubMenus from your left soft key menu item.
?>
|
Posted :
5/21/2004 7:30:00 AM
by Matthieu Laban
Category :
Aviation
[This entry has been imported from my old blog, therefore, links and images might now show correctly. Sorry about that]
If you are developing Winforms Applications, there is one thing that I’m sure you will come across one day or another.
When coding your applications, you often create new classes within the same file as those declaring Forms. One way to do this could be the following:
using System.Windows.Forms;
using System.Data;
namespace ExceptionTest
{
public class
{
public int i = 0;
}
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
…
This is not the way to go, why? Well, at first, you will not notice why, the project still compiles without any warning or errors, even though there is a big problem underneath. After you have created this class, try adding a new control to the form. Visual Studio will show a message box telling you that the class declaring the form must be first in the source file. The exact error message is : “The class Form1 can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.” You will get the same error message in the task list, if you close and reopen the solution. Well, we can admit that since it is warning you that there is something wrong. However, in some cases, it will not.
The only error message you will get is an exception not related to you problem at all! Last time I got one of these, it was about some resource not found in my assembly. I could not recreate the case today, but I remember exactly what was causing the problem.
My code went like that :
using System.Windows.Forms;
using System.Data;
namespace ExceptionTest
{
public delegate void MyDelegate();
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{ …
Even though this code does not cause any error/warning messages, you will eventually get one. In my case, it was ages after I added my delegate declaration. After several compilations, I ran the application and I got a ResourceNotFoundException or some other resource related exception at form load … I spent a whole afternoon trying to understand what in the world could be the problem here! I rolled back to some previous versions of my code, (still containing this delegate on top of the file) and the exception was still here. Finally, I tried to remove this delegate from the top of the file, and put it below the Form1 class; I thought that maybe it was the same problem as for classes … and bingo! The exception did not show anymore!
So one thing to remember: Do not write anything before your Windows class declarations!
edit: the exception i was refering to is : MissingManifestResourceException ?>
|
Posted :
5/15/2004 7:33:00 AM
by Matthieu Laban
Category :
Aviation
[This entry has been imported from my old blog, therefore, links and images might now show correctly. Sorry about that]
I'm going to try to post in english for once ;-)
Last night, i had a little time to kill, so i decided to go back to some old things i hadn't done in a very long while, that is, Online Flying with Flight Simulator. Back in 2001, when i had a lot of spare time, i used to fly online, on the VATSIM network. (www.vatsim.net) Vatsim is a group that enables virtual pilots from all over the world to fly online, directed by controllers, just like in reality. When you want to fly, you connect to a server, file a flight plan and ask IFR Clearances, permissions to taxi, take off and so on. The cool thing about this is that there are many places where controllers are available. These controllers are not computers, but actual people, most of the time real world ATC operators! Besides controllers and yourself, there are also many pilots flying at the same time!
Therefore, last night I decided that I would take a few hops in South California, under the control of these guys ;-) At that time, these controllers where online: Los Angeles Center (A big control area around Los Angeles) Los Angeles Tower + Ground (Control Tower for take offs and landings, + ground control to guide you to the runway) Ontario Approach (East of Los Angeles. The approach control that will guide you through the first/last miles of your flight, when arriving to, or departing Ontario Airport). Burbank Tower (North of Los Angeles, just a few miles off the Hollywood sign, and the place where they used to shoot the show Friends) Long Beach Tower (South of Los Angeles, opened late this night) San Diego Approach (The approach control of San Diego, when you are in San Diego Airspace.
Let us talk about how I proceeded for one of the flights I did from KONT (ICAO code for Ontario Airport) to KSAN (San Diego). Both approach controllers were online at the time I decided to fly, so the first thing I did, was to file a flight plan and sent it to the ATC (Air Traffic Control). Once I did that, I contacted Ontario Approach. To do this, pilots use a program to communicate with the controllers, by either voice or text. Both are not easy when you fly. For text you need to leave the joystick a few seconds for typing, and for voice, well.... it’s in English ! I tried to contact the controller on voice, "Ontario, this is N123KB, ready at parking for VFR flight to San Diego". And the guy actually replied! :) "N123KB, taxi to runway 25L, squawk 1200". This means that I’m cleared to taxi to the active runway, and that I must set the transponder to 1200. This is the code for a VFR flight (Visual Flight). Controllers use this code to locate aircrafts on their radars. Then I took off and turned heading San Diego, flying along the pacific coast line ;-) (I recommend you Mega Scenery Volume 1 for Flight Simulator, it covers all south California with beautiful high res satellite images). When I was a few miles out of Ontario, the controller told me to switch to San Diego Approach before entering their area, and cleared me off his airspace. After a dozen miles, I contacted San Diego Approach, a nice man from New Zealand! He cleared me direct to San Diego Airport, calling me to report when I would have the airfield in sight, which I did, a few seconds later. He instructed me to make a right downwind runway 27, and then cleared me to land! At that time, 3 other aircrafts were in approach, and about 300 in the whole world!
I know people are going to make fun of me for this post, but whatever, I really had fun! :-) You will find more information on http://www.vatsim.net
See you there ! ?>
?>
|
|
|
|