Exemplo n.º 1
0
        public override Restore RecordRestore(object child)
        {
            // Child of a WindowContent must be a Content object
            Content c = child as Content;

            StringCollection next     = new StringCollection();
            StringCollection previous = new StringCollection();

            bool before = true;

            // Fill collections with list of Content before and after parameter
            foreach (Content content in _contents)
            {
                if (content == c)
                {
                    before = false;
                }
                else
                {
                    if (before)
                    {
                        previous.Add(content.Title);
                    }
                    else
                    {
                        next.Add(content.Title);
                    }
                }
            }

            bool selected = false;

            // Is there a selected tab?
            if (_tabControl.SelectedIndex != -1)
            {
                // Get access to the selected Content
                Content selectedContent = _tabControl.SelectedTab.Tag as Content;

                // Need to record if it is selected
                selected = (selectedContent == c);
            }

            // Create a Restore object to handle this WindowContent
            Restore thisRestore = new RestoreWindowContent(null, c, next, previous, selected);

            // Do we have a Zone as our parent?
            if (_parentZone != null)
            {
                // Get the Zone to prepend its own Restore knowledge
                thisRestore = _parentZone.RecordRestore(this, child, thisRestore);
            }

            return(thisRestore);
        }
Exemplo n.º 2
0
        public override Restore RecordRestore(object child) 
        {
            // Child of a WindowContent must be a Content object
            Content c = child as Content;

            StringCollection next = new StringCollection();
            StringCollection previous = new StringCollection();

            bool before = true;

            // Fill collections with list of Content before and after parameter
            foreach(Content content in _contents)
            {
                if (content == c)
                    before = false;
                else
                {
                    if (before)
                        previous.Add(content.Title);
                    else
                        next.Add(content.Title);
                }
            }

            bool selected = false;

            // Is there a selected tab?
            if (_tabControl.SelectedIndex != -1)
            {
                // Get access to the selected Content
                Content selectedContent = _tabControl.SelectedTab.Tag as Content;

                // Need to record if it is selected
                selected = (selectedContent == c);
            }

            // Create a Restore object to handle this WindowContent
            Restore thisRestore = new RestoreWindowContent(null, c, next, previous, selected);

            // Do we have a Zone as our parent?
            if (_parentZone != null)
            {
                // Get the Zone to prepend its own Restore knowledge
                thisRestore = _parentZone.RecordRestore(this, child, thisRestore);
            }

            return thisRestore;
        }