private DialogResult ApplyChanges()

in wwauth/Google.Solutions.WWAuth/View/PropertiesDialog.cs [41:72]


        private DialogResult ApplyChanges()
        {
            try
            {
                foreach (var tab in this.Sheets)
                {
                    tab.ViewModel.ValidateChanges();
                }

                foreach (var tab in this.Sheets
                    .Where(t => t.ViewModel.IsDirty))
                {
                    var result = tab.ViewModel.ApplyChanges(this);

                    if (result == DialogResult.OK)
                    {
                        Debug.Assert(!tab.ViewModel.IsDirty);
                    }
                    else
                    {
                        return result;
                    }
                }

                return DialogResult.OK;
            }
            catch (Exception e)
            {
                ErrorDialog.ShowError(this, "Applying changes failed", e);
                return DialogResult.Cancel;
            }
        }