Esempio n. 1
0
        private void OnButtonClick(object sender, EventArgs e)
        {
            switch (((Button)sender).Name)
            {
            case "btnOk":
                (bool success, string guid)result = (false, "");
                switch (_newObjectName.NameType)
                {
                case FisheryObjectNameType.CatchLocalName:
                    result = Names.SaveNewLocalName(_newObjectName);
                    break;

                case FisheryObjectNameType.GearLocalName:
                    result = Gears.SaveNewLocalName(_newObjectName);
                    break;

                case FisheryObjectNameType.GearVariationName:
                    result = Gears.SaveNewVariationName(_newObjectName, _gearClassGuid);
                    break;

                case FisheryObjectNameType.FishingAccessory:
                    result.success = Gears.AddAccessory(_newObjectName.NewName);
                    break;

                case FisheryObjectNameType.FishingExpense:
                    result.success = Gears.AddExpense(_newObjectName.NewName);
                    break;
                }

                if (result.success)
                {
                    DialogResult = DialogResult.OK;
                }
                break;

            case "btnCancel":
                DialogResult = DialogResult.Cancel;
                break;
            }
            Close();
        }