Exemplo n.º 1
0
            /// <summary>
            /// Handles the Click event of the nouveauToolStripMenuItem control.
            /// </summary>
            /// <param name="sender">The source of the event.</param>
            /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
            private void nouveauToolStripMenuItem_Click(object sender, EventArgs e)
            {
                if (map != null)
                {
                    string message = "Votre carte n'est pas sauvegardée, voulez-vous la sauvegarder?";
                    string caption = "Sauvegarder";
                    MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                    DialogResult result;

                    // Displays the MessageBox.
                    result = MessageBox.Show(view, message, caption, buttons);
                    if (result == DialogResult.Yes)
                    {
                        if (validator.MapIsValid())
                        {
                            SaveMapAsXML();
                            view.paEditor.Controls.Clear();
                            view.cmbLayer.Items.Clear();
                            map = null;
                        }
                        else
                        {
                            MessageBox.Show("La carte ne peut être sauvegarder car elle est invalide");
                            MapIsInvalid mapIsInvalid = new MapIsInvalid(this, validator.listOfErrors);
                            mapIsInvalid.ShowDialog();
                        }
                    }
                    else
                    {
                        CreateMap createMapWindow = new CreateMap(this);
                        createMapWindow.ShowDialog();
                    }
                }
                else
                {
                    CreateMap createMapWindow = new CreateMap(this);
                    createMapWindow.ShowDialog();
                }
            }
Exemplo n.º 2
0
            /// <summary>
            /// Handles the Click event of the quitterToolStripMenuItem control.
            /// </summary>
            /// <param name="sender">The source of the event.</param>
            /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
            private void quitterToolStripMenuItem_Click(object sender, EventArgs e)
            {
                if (map != null)
                {
                    string message = "Votre carte n'est pas sauvegardée, voulez-vous la sauvegarder?";
                    string caption = "Sauvegarder";
                    MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                    DialogResult result;

                    // Displays the MessageBox.
                    result = MessageBox.Show(view, message, caption, buttons);
                    if (result == DialogResult.Yes)
                    {
                        if (validator.MapIsValid())
                        {
                            SaveMapAsXML();
                            view.Close();
                        }
                        else
                        {
                            MessageBox.Show("La carte ne peut être sauvegarder car elle est invalide");
                            MapIsInvalid mapIsInvalid = new MapIsInvalid(this, validator.listOfErrors);
                            mapIsInvalid.ShowDialog();
                        }

                    }

                }
                else
                {
                    view.Close();
                }
            }
Exemplo n.º 3
0
 /// <summary>
 /// Handles the Click event of the btnValidate control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void btnValidate_Click(object sender, EventArgs e)
 {
     if (validator != null)
     {
         if (validator.MapIsValid())
         {
             MessageBox.Show("La carte est valide");
         }
         else
         {
             MapIsInvalid mapIsInvalid = new MapIsInvalid(this, validator.listOfErrors);
             mapIsInvalid.ShowDialog();
         }
     }
 }