ReloadMap when no form is used

Jun 4, 2009 at 11:48 AM

Hi all,

according to the developer, the Form.Shown event should get handled and the map should get reloaded at that time. See the example in

      // on shown, do not forget this! ;}
      private void MainForm_Shown(object sender, EventArgs e)
      {
         MainMap.ReloadMap();
      }

But what, if I wanted to provide a custom map control, as UserControl instead of having a ready-made form?

I have found that this works: Use a Forms Timer, register to the UserControl.Load event, start the timer with an interval of 1millisecond , then handle the tick event. In the tick event handler, stop the timer first, then call the ReloadMap() on the map.

        /// <summary>
        /// Handles the Tick event of the _reloadTimer control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        void _reloadTimer_Tick(object sender, EventArgs e)
        {
            _reloadTimer.Stop(); //only use once
            this.ReloadMap();
        }

@Radioman: Probably you could introduce such code already in the GMap control?

 

Best Regards, Marcel

 

Jun 4, 2009 at 1:29 PM

well your custom contorol also can contain that function ;} MainMap.ReloadMap();

Jun 4, 2009 at 3:08 PM
Yes, but why bother the user of my control with calling specific code at
the form.shown event?

He/She could easily forget to do so, and then my control does not show
the map. I prefer to hide this behaviour from the user of my control.

Best Regards, Marcel

On Thu, 2009-06-04 at 05:29 -0700, radioman wrote:
> From: radioman
>
> well your custom contorol also can contain that
> function ;} MainMap.ReloadMap();
>
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion
> on CodePlex. You can unsubscribe or change your settings on
> codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any
> posts to this discussion will also be available online at codeplex.com
>
>
Jun 4, 2009 at 7:43 PM

is the new version ok?

Jun 8, 2009 at 9:37 AM

Hi radioman,

Yes, it works fine.

There are some other changes though that disturbed me first. For example, there seems to be now more than one type of Size, that Microsoft one and your one. Are really both needed?

Br, Marcel

Jun 8, 2009 at 9:40 AM

just don't use what you dont need, i use them, because winforms & wpf use diff 'points', 'sizes', etc...

Sep 30, 2009 at 8:33 PM

Hello!

I'm using a User Control and the GMap doesn't show automatly :S And I'm using MainMap.ReloadMap() all the time...

The map only shows when I pass the mouse over the map.

Could someone help me pls?

 

Tks a lot

Sep 30, 2009 at 8:33 PM

Hello!

I'm using a User Control and the GMap doesn't show automatly :S And I'm using MainMap.ReloadMap() all the time...

The map only shows when I pass the mouse over the map.

Could someone help me pls?

 

Tks a lot

Sep 30, 2009 at 8:36 PM

?

Sep 30, 2009 at 8:42 PM
radioman wrote:

?

Yes, that's it.

I map doesn't appear until I pass the mouse there :S

I tried to reload the map in different places but no luck

 

Sep 30, 2009 at 8:44 PM

does demos too need 'mouse over' ?

Sep 30, 2009 at 8:54 PM

I'm not sure, but I don't think so.

I think the problem is: I'm using a User Control not a Windows Form.

What do u think?

 

Sep 30, 2009 at 8:56 PM

hm..

Oct 1, 2009 at 8:44 AM

Here's what I don't understand, what's the point of a timer ticker when it's used only once? You still have to run that timer thread, so you still have to call it, so you still have code that you have to expose to the user. You just replace one call with another call that basically does the same thing right?