Esempio n. 1
0
        /// <summary>
        /// Import
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button4_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Import List of Locations:\r\n" +
                                              "1. First step is to find the file with the list of locations\r\n" +
                                              "2. Second step is to choose from importing methods (Add or Replace)\r\n" +
                                              "\r\nDo you want to continue with importing?", "Notification", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (dr != DialogResult.Yes)
            {
                return;
            }

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "GLOC files (*.gloc)|*.gloc||";

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                MessageBox.Show("Importing was cancelled.");
                return;
            }

            dr = MessageBox.Show("Do you want to ADD selected location file to the current database of locations?\r\n" +
                                 "Press YES for Adding, press NO for replacement of current database with imported file.\r\n" +
                                 "Press CANCEL for not importing at all.", "Importing method", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dr == DialogResult.Cancel)
            {
                return;
            }

            if (TLocationDatabase.ImportFile(ofd.FileName, (dr == DialogResult.No)) == false)
            {
                MessageBox.Show("Importing of file was not succesful.", "Importing progress");
                return;
            }

            // opatovna inicializacia dialog boxu
            listViewLocations.Items.Clear();     // m_wndList.ResetContent();
            m_wndCountry.Items.Clear();

            // setting the current country
            InitCountries();
            m_wndCountry.SelectedIndex = 0;
        }