Exemplo n.º 1
0
        private bool CloseFile(string tableName)
        {
            var tbl = StaticReference.GetTableByFullName(tableName);

            if (tbl == null)
            {
                return(true);
            }

            if (tbl.Altered)
            {
                string q = string.Format(LanguageManager.Get("Message_SaveConfirmChanges"), tableName);

                switch (StaticReference.ShowQuestion(this, q))
                {
                case DialogResult.Yes:
                    tbl.Save();     // save
                    break;

                case DialogResult.Cancel:
                    return(false);
                }
            }

            try
            {
                /* Clear edited cell value if exist */
                var page = GetTabPageByFilename(tableName);
                var view = GetViewFromTabPage(page);
                if (_editedCells.ContainsKey(view))
                {
                    _editedCells.Remove(view);
                    view.Invalidate();
                }
                ClearNewRowHighlight(view);
                StaticReference.RemoveTableByFullName(tableName);
            }
            catch
            {
                // ignored
            }

            return(true);
        }