Exemplo n.º 1
0
        //public override string UsageEventName
        //{
        //    get { return "data_browser"; }
        //}

        //public override bool AllowClose()
        //{
        //    if (Detached) return false;
        //    return base.AllowClose();
        //}

        //protected override void DisallowedClose()
        //{
        //    Detached = true;
        //}

        private void LoadDataFromNode()
        {
            bool             loaded     = false;
            var              tabdataobj = m_selectedObject.FindTabularDataObject();
            ITabularDataView data       = null;

            if (tabdataobj != null)
            {
                data = tabdataobj.GetTabularData(ConnPack);
            }
            if (data == null && m_selectedObject != null && m_selectedObject.HasTabularData)
            {
                data = m_selectedObject.GetTabularData();
                if (data != null)
                {
                    data.ChangeConnection(ConnPack);
                }
            }
            if (data != null)
            {
                string key = data.GetConnectionKey();
                try
                {
                    m_currentTableKey = key + "#" + data.TableSource.Database.DatabaseName + "#" + data.TableSource.FullName.ToString() + "#" + data.FixedPerspective;
                }
                catch
                {
                    try
                    {
                        m_currentTableKey = key + "#" + data.TableSource.FullName.ToString() + "#" + data.FixedPerspective;
                    }
                    catch
                    {
                        m_currentTableKey = null;
                    }
                }
                if (m_currentTableKey == null)
                {
                    State = new TableRelatedState();
                }
                else
                {
                    if (m_tablesCache.ContainsKey(m_currentTableKey))
                    {
                        State = m_tablesCache[m_currentTableKey];
                        State.HistoryPosition = 0;
                    }
                    else
                    {
                        State = new TableRelatedState();
                        m_tablesCache[m_currentTableKey] = State;
                    }
                }
                DataStatePer.TableData = data;
                if (data != null && data.FixedPerspective != null)
                {
                    DataStatePer.UseFixedPerspective(data.FixedPerspective);
                }
                RefreshCurrentView();
                loaded = true;
            }

            if (!loaded)
            {
                TabularData = null;
            }
            UpdateHint();
            UpdateCellDataView();
            UpdateState();
        }