private void buttonSave_Click(object sender, System.EventArgs e)
        {
            string title = StringHelper.Ellipsis(textBoxTitle.Text.Trim(), 600);

            if (title == String.Empty)
            {
                title = textBoxTitle.Text = UNTITLED_PUSHPIN;
            }

            // initialize the pushpin info
            MapPushpinInfo pushpinInfo = new MapPushpinInfo(title);

            // treat an empty title as the same as "Cancel" -- since this dialog dismisses
            // on deactivation we can't really throw up a message-box
            if (pushpinInfo.Title != String.Empty)
            {
                pushpinInfo.Notes       = StringHelper.Ellipsis(textBoxNotes.Text.Trim(), 600);
                pushpinInfo.PhotoUrl    = StringHelper.RestrictLength(UrlHelper.FixUpUrl(textBoxPhotoUrl.Text), 600);
                pushpinInfo.MoreInfoUrl = StringHelper.RestrictLength(UrlHelper.FixUpUrl(textBoxMoreInfoUrl.Text), 600);

                _pushpinEditedHandler(pushpinInfo);
            }

            Close();
        }
        public MapPushpinForm(IWin32Window parentFrame, Point location, MapPushpinEditedHandler pushpinEditedHandler, MapPushpinInfo pushpinInfo)
            : base(parentFrame)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            if (SystemInformation.HighContrast)
            {
                this.BackColor = SystemColors.Control;
            }

            this.labelTitle.Text       = Res.Get(StringId.PushpinTitle);
            this.textBoxTitle.Text     = Res.Get(StringId.PushpinUntitled);
            this.labelNotes.Text       = Res.Get(StringId.PushpinNotes);
            this.labelPhotoUrl.Text    = Res.Get(StringId.PushpinPhotoUrl);
            this.labelMoreInfoUrl.Text = Res.Get(StringId.PushpinMoreInfoUrl);
            this.buttonSave.Text       = Res.Get(StringId.SaveButton);
            this.buttonCancel.Text     = Res.Get(StringId.CancelButton);

            _pushpinEditedHandler = pushpinEditedHandler;

            if (pushpinInfo == null)
            {
                pushpinInfo = new MapPushpinInfo(String.Empty);
            }

            textBoxTitle.Text = pushpinInfo.Title;
            if (textBoxTitle.Text == String.Empty)
            {
                textBoxTitle.Text = UNTITLED_PUSHPIN;
            }

            textBoxNotes.Text       = pushpinInfo.Notes;
            textBoxPhotoUrl.Text    = pushpinInfo.PhotoUrl;
            textBoxMoreInfoUrl.Text = pushpinInfo.MoreInfoUrl;

            if (pushpinInfo.Title == String.Empty)
            {
                Text = Res.Get(StringId.PushpinAdd);
            }
            else
            {
                Text = Res.Get(StringId.PushpinEdit);
            }

            Location = location;
        }
        public MapPushpinForm(IWin32Window parentFrame, Point location, MapPushpinEditedHandler pushpinEditedHandler, MapPushpinInfo pushpinInfo)
            : base(parentFrame)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            if (SystemInformation.HighContrast)
                this.BackColor = SystemColors.Control;

            this.labelTitle.Text = Res.Get(StringId.PushpinTitle);
            this.textBoxTitle.Text = Res.Get(StringId.PushpinUntitled);
            this.labelNotes.Text = Res.Get(StringId.PushpinNotes);
            this.labelPhotoUrl.Text = Res.Get(StringId.PushpinPhotoUrl);
            this.labelMoreInfoUrl.Text = Res.Get(StringId.PushpinMoreInfoUrl);
            this.buttonSave.Text = Res.Get(StringId.SaveButton);
            this.buttonCancel.Text = Res.Get(StringId.CancelButton);

            _pushpinEditedHandler = pushpinEditedHandler;

            if (pushpinInfo == null)
                pushpinInfo = new MapPushpinInfo(String.Empty);

            textBoxTitle.Text = pushpinInfo.Title;
            if (textBoxTitle.Text == String.Empty)
                textBoxTitle.Text = UNTITLED_PUSHPIN;

            textBoxNotes.Text = pushpinInfo.Notes;
            textBoxPhotoUrl.Text = pushpinInfo.PhotoUrl;
            textBoxMoreInfoUrl.Text = pushpinInfo.MoreInfoUrl;

            if (pushpinInfo.Title == String.Empty)
            {
                Text = Res.Get(StringId.PushpinAdd);
            }
            else
            {
                Text = Res.Get(StringId.PushpinEdit);
            }

            Location = location;
        }
        private void buttonSave_Click(object sender, System.EventArgs e)
        {
            string title = StringHelper.Ellipsis(textBoxTitle.Text.Trim(), 600);
            if (title == String.Empty)
            {
                title = textBoxTitle.Text = UNTITLED_PUSHPIN;
            }

            // initialize the pushpin info
            MapPushpinInfo pushpinInfo = new MapPushpinInfo(title);

            // treat an empty title as the same as "Cancel" -- since this dialog dismisses
            // on deactivation we can't really throw up a message-box
            if (pushpinInfo.Title != String.Empty)
            {
                pushpinInfo.Notes = StringHelper.Ellipsis(textBoxNotes.Text.Trim(), 600);
                pushpinInfo.PhotoUrl = StringHelper.RestrictLength(UrlHelper.FixUpUrl(textBoxPhotoUrl.Text), 600);
                pushpinInfo.MoreInfoUrl = StringHelper.RestrictLength(UrlHelper.FixUpUrl(textBoxMoreInfoUrl.Text), 600);

                _pushpinEditedHandler(pushpinInfo);
            }

            Close();
        }
示例#5
0
            private void _mapPushpinAddedHandler(MapPushpinInfo pushpinInfo)
            {
                int nextPinId = 1;
                for (nextPinId = 1; _mapControl.GetPushpin(nextPinId.ToString(CultureInfo.InvariantCulture)) != null; nextPinId++) ;

                _mapControl.AddPushpin(
                    new VEPushpin(nextPinId.ToString(CultureInfo.InvariantCulture), new VELatLong(_event.Latitude, _event.Longitude, _event.Reserved),
                                  _mapOptions.PushpinUrl, pushpinInfo.Title, pushpinInfo.Notes, pushpinInfo.MoreInfoUrl,
                                  pushpinInfo.PhotoUrl));
            }
示例#6
0
 private void _mapPushpinEditedHandler(MapPushpinInfo pushpinInfo)
 {
     VEPushpin oldPushpin = _mapControl.GetPushpin(_pushpinId);
     if (oldPushpin != null)
         _mapControl.UpdatePushpin(
             new VEPushpin(_pushpinId, oldPushpin.VELatLong, oldPushpin.ImageFile, pushpinInfo.Title, pushpinInfo.Notes,
                           pushpinInfo.MoreInfoUrl, pushpinInfo.PhotoUrl));
 }
示例#7
0
 private void EditPushpin()
 {
     VEPushpin pushpin = _mapControl.GetPushpin(_pushpinId);
     if (pushpin != null)
     {
         MapPushpinInfo pushpinInfo = new MapPushpinInfo(pushpin.Title);
         pushpinInfo.Notes = pushpin.Details;
         pushpinInfo.MoreInfoUrl = pushpin.MoreInfoUrl;
         pushpinInfo.PhotoUrl = pushpin.PhotoUrl;
         MapPushpinForm pushpinForm =
             new MapPushpinForm(_mapForm, _mapControl.PointToScreen(new Point(_event.X, _event.Y)),
                                new MapPushpinEditedHandler(_mapPushpinEditedHandler), pushpinInfo);
         pushpinForm.Show();
         pushpinForm.FloatAboveOwner(_mapForm);
     }
 }