Esempio n. 1
0
        public void CancelBtnClicked(object sender, EventArgs e)
        {
            if (ChangesMade() == false)
            {
                // No edit is done.
                // No need to show messageBox.
                ShowSelectionGroupBox();
                return;
            }

            var result = ParentControl.ShowDialog(
                "Discard the changes to config?",
                MsgBoxIcon.Warning,
                "",
                DefaultButton.Button1,
                "Discard", "Save", "Cancel");

            if (result == MsgBoxResult.Button1)
            {
                ShowSelectionGroupBox();
            }
            else if (result == MsgBoxResult.Button2)
            {
                SaveConfig(this, EventArgs.Empty);
            }
        }
Esempio n. 2
0
        public void DeleteConfig(object sender, EventArgs e)
        {
            var reg = SelectedRegistration;

            if (reg == null)
            {
                return;
            }

            var configs = profiles.AcConfigs;
            var item    = configs.Find(reg);
            var path    = item.FilePath;
            var ac      = item.Config.AC;

            var result = ParentControl.ShowDialog(
                $"Permanently delete {reg} ({ac}) ?",
                MsgBoxIcon.Warning,
                "",
                DefaultButton.Button2,
                "Delete", "Cancel");

            if (result == MsgBoxResult.Button1 && TryDeleteConfig(path))
            {
                configs.Remove(reg);
                AddToDeletedDefaultAc(path, reg);
                ReadShadowedProfile(reg);
                RefreshListView();
                AircraftsChanged?.Invoke(this, EventArgs.Empty);
            }
        }