Example #1
0
 public void Link(WordFillerOptions options)
 {
     _packetName = options.PacketName;
     _linker = new Linker();
     _linker.LinkObjectToControl(this, options);
 }
Example #2
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            DialogResult = saveDialogResult;

            if (NeedTranslit())
                ConvertAllToTranslit();

            _linker.MoveDataToObject();

            var errors = new List<string>();
            var criticalStop = false;
            foreach (var checker in CheckersFactory.EnumCheckers())
            {
                if (!checker.Check(_person))
                {
                    errors.Add(checker.WarningMessage);
                    if (checker.IsCritical)
                    {
                        criticalStop = true;
                        break;
                    }
                }
            }
            if (errors.Count > 0)
            {
                var frm = new CheckResultForm();
                frm.Init(errors, criticalStop);
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    DialogResult = DialogResult.None;
                    return;
                }
            }

            if (FormMode == Mode.Edit)
            {
                if (AutoSavePerson)
                    PersonStorage.Instance.Save(_person);
                ShowSavedLabel();
                if (saveDialogResult != DialogResult.None)
                    Close();
                return;
            }

            if (PersonCreated != null) PersonCreated(_person, EventArgs.Empty);
            ShowSavedLabel();

            _linker = null;
            CreateNewPerson();
            _linker = new Linker();
            InitActionFactory();
            if (_linker == null) return;
            _linker.LinkObjectToControl(this, _person, bgModeBtn.Checked);
            _linker.MoveDataFromObject();
            _linker.MoveDataToObject();

            if (saveDialogResult != DialogResult.None)
                Close();

            panel1.ScrollControlIntoView(surname);
            surname.Focus();
        }
Example #3
0
 private void HeaderForm_Load(object sender, EventArgs e)
 {
     _linker = new Linker();
     if (_person != null) _linker.LinkObjectToControl(this, _person);
 }
Example #4
0
 private void PersonForm_Load(object sender, EventArgs e)
 {
     _linker = new Linker();
     InitActionFactory();
     if (FormMode == Mode.Create)
     {
         CreateNewPerson();
     }
     if (_person != null) _linker.LinkObjectToControl(this, _person, bgModeBtn.Checked);
 }