private void ActivateEntry(NavigationEntry entry)
        {
            activeEntryIndex = 0;

            for (int i = 0; i < historyList.Count; i++)
            {
                if (historyList[i] == entry)
                {
                    historyList[i].IsActive = true;
                    activeEntryIndex        = i;
                }
                else
                {
                    historyList[i].IsActive = false;
                }
            }

            if (activeEntryIndex > 0)
            {
                CanGoBack = true;
            }
            else
            {
                CanGoBack = false;
            }

            if (activeEntryIndex < historyList.Count - 1)
            {
                CanGoForward = true;
            }
            else
            {
                CanGoForward = false;
            }
        }
        public void ApplySmartPartInfo(object smartPart, ISmartPartInfo smartPartInfo)
        {
            workspace.ApplySmartPartInfo(smartPart, smartPartInfo);

            NavigationEntry entry = FindEntryForSmartPart(smartPart);

            entry.SmartPartInfo = smartPartInfo;
        }
Esempio n. 3
0
        public void OnShow(UIElement smartPart, SmartPartInfo smartPartInfo)
        {
            NavigationEntry data = new NavigationEntry();

            data.SmartPart     = smartPart;
            data.SmartPartInfo = smartPartInfo;
            internalWorkspaceDataCollection.Add(data);

            Activate(smartPart);
        }
Esempio n. 4
0
        public void OnClose(UIElement smartPart)
        {
            OnHide(smartPart);

            NavigationEntry dataToRemove = null;

            foreach (NavigationEntry data in internalWorkspaceDataCollection)
            {
                if (data.SmartPart == smartPart)
                {
                    dataToRemove = data;
                    break;
                }
            }

            if (dataToRemove == null)
            {
                internalWorkspaceDataCollection.Remove(dataToRemove);
            }
        }
        private void SmartPartActivatedEventHandler(object sender, WorkspaceEventArgs e)
        {
            NavigationEntry entry = FindEntryForSmartPart(e.SmartPart);

            if (entry == null)
            {
                entry           = new NavigationEntry();
                entry.SmartPart = e.SmartPart;

                historyList.Add(entry);
                navigationEntryCollection.Insert(0, entry);
            }

            ActivateEntry(entry);

            if (SmartPartActivated != null)
            {
                SmartPartActivated(this, e);
            }
        }
        private void SmartPartClosingEventHandler(object sender, WorkspaceCancelEventArgs e)
        {
            NavigationEntry entry = FindEntryForSmartPart(e.SmartPart);

            historyList.Remove(entry);
            navigationEntryCollection.Remove(entry);

            if (historyList.Count > 1)
            {
                Activate(historyList[0].SmartPart);
            }
            else
            {
                if (historyList.Count > 0)
                {
                    ActivateEntry(historyList[0]);
                }
            }

            if (SmartPartClosing != null)
            {
                SmartPartClosing(this, e);
            }
        }