public FrmMission()
        {
            InitializeComponent();
            this.Text = this.Text + " " + CommonTools.Gui.LoginData.ApplicationVersion;

            Database.DataConfiguration.init();
            m_mission = new Mission();
            m_dlgEditXml = null;
            m_dlgReport = null;
            m_dlgSearch = new CommonTools.Gui.DlgSearch();
            m_dlgSearch.configure(Net7.Tables.missions);
            m_fieldChangesMuted = false;

            configureTabs();
            setState(State.View);
        }
        public void loadMission(String missionId)
        {
            Boolean wasMuted;
            setMuteFieldChanges(true, out wasMuted);
            Cursor = Cursors.WaitCursor;
            if (missionId != null)
            {
                guiStatusLbl.Text = "Retrieving mission " + missionId;
                this.Refresh();
                m_mission = Database.Database.getMission(missionId);
            }
            if (m_mission == null)
            {
                MessageBox.Show("The mission id '" + missionId + "' does not exist");
            }
            else
            {
                try
                {
                    DateTime start = DateTime.Now;
                    guiStatusLbl.Text = "Parsing mission " + m_mission.getId();
                    guiStatusLbl.Refresh(); // Needed to display the status text
                    m_mission.parseXml();

                    String error;
                    Boolean dataIsValid = Database.DataConfiguration.validate(out error);

                    TimeSpan timeSpan = DateTime.Now - start;
                    guiStatusLbl.Text = timeSpan.TotalMilliseconds.ToString() + " milliseconds";
                    m_tabMission.setMission(m_mission);
                    m_tabStages.setMission(m_mission);

                    if (!dataIsValid)
                    {
                        throw (new Exception(error));
                    }
                    m_currentMissionId = m_mission.getId();
                    guiSearchTxt.Text = m_currentMissionId;
                }
                catch (XmlException xmlEx)
                {
                    MessageBox.Show(xmlEx.Message);
                    //reloadMission(mission.getXml());
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    //reloadMission(mission.getXml());
                }
            }
            Cursor = Cursors.Default;
            setMuteFieldChanges(wasMuted, out wasMuted);
        }
 private void onRecordAdd(object sender, EventArgs e)
 {
     setState(State.Add);
     if (m_mission == null)
     {
         m_mission = new Mission();
     }
     m_mission.clear();
     m_mission.setId(Database.Database.getNextMissionId());
     m_mission.setName("");
     Boolean wasMuted;
     setMuteFieldChanges(true, out wasMuted);
     m_tabMission.setMission(m_mission);
     m_tabStages.setMission(m_mission);
     setMuteFieldChanges(wasMuted, out wasMuted);
     guiTabControl.SelectedIndex = 0;
 }