Beispiel #1
0
        private void comboBoxFileGroup_SelectedValueChanged(object sender, EventArgs e)
        {
            if (Background)
            {
                return;
            }
            var selected = comboBoxFileGroup.SelectedItem as FileGroup;

            if (selected == null)
            {
                fileGroupUserControl1.FileGroup = null;
                return;
            }
            var data = GenDataEditorViewModel.Data;

            if (!GeData.CheckIfDataExists(Path.Combine(selected.FilePath, selected.FileName)))
            {
                var msg = MessageBox.Show("Remove the file group?", "The data file does not exist",
                                          MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                var savedBackground = Background;
                Background = true;
                if (msg == DialogResult.Yes)
                {
                    data.RemoveFileGroup(selected.Name);
                    comboBoxFileGroup.Items.RemoveAt(comboBoxFileGroup.SelectedIndex);
                }
                comboBoxFileGroup.SelectedItem = null;
                Background = savedBackground;
                return;
            }
            data.SetFileGroup(selected.Name);

            EnableControls(false, true, false, false, false, ProfileIsSpecified());
            Loading = true;
            fileGroupUserControl1.FileGroup = selected;
            Loading = false;
            RaiseDataLoaded();
            FileGroupProfileSelected(sender, e);
        }