Beispiel #1
0
        private void FormOrthoChart_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!_hasChanged)
            {
                return;
            }
            else if (DialogResult != DialogResult.OK &&
                     _hasChanged && !MsgBox.Show(this, MsgBoxButtons.YesNo, "Unsaved changes will be lost. Would you like to save changes instead?"))
            {
                return;
            }
            if (_showSigBox && gridMain.SelectedCell.Y != -1)
            {
                SaveSignatureToDict(gridMain.SelectedCell.Y);
            }
            if (_showSigBox)
            {
                //Don't save the signature if the user tried to sign an empty ortho chart.
                for (int i = _dictOrthoCharts.Keys.Count - 1; i >= 0; i--)
                {
                    if (_dictOrthoCharts[_dictOrthoCharts.Keys.ElementAt(i)].All(x => (_sigTableOrthoColIdx > -1 && x.FieldName == _listDisplayFieldNames[_sigTableOrthoColIdx]) || x.FieldValue == ""))
                    {
                        _dictOrthoCharts.Remove(_dictOrthoCharts.Keys.ElementAt(i));
                    }
                }
            }
            List <OrthoChart> listNewOrthoCharts = new List <OrthoChart>();

            foreach (KeyValuePair <DateTime, List <OrthoChart> > kvPair in _dictOrthoCharts)
            {
                listNewOrthoCharts.AddRange(kvPair.Value);
            }
            OrthoCharts.Sync(_patCur, listNewOrthoCharts, _listOrthDisplayFields, _listOrthDisplayFields.Find(x => x.InternalName == "Signature"));
        }