private void OpenDocument(object param)
        {
            var navigationSettings = new NavigationSettings()
            {
                View = "ExampleDocumentNavigationView",
                Title = DocumentTitle,
                Data = DocumentParameter
            };

            PublishDocument(navigationSettings);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a new module to the navigation view. Called by the <see cref="ModuleNavigator"/>.
        /// </summary>
        /// <param name="moduleSettings">Module settings.</param>
        public void AddModule(ModuleSettings moduleSettings)
        {
            var navigationPanelItem = new NavigationPanelItem();
            navigationPanelItem.NavigationPanelItemName = moduleSettings.ModuleName;
            navigationPanelItem.ImageLocation = moduleSettings.ModuleImagePath;

            foreach (ModuleGroup moduleGroup in moduleSettings.ModuleGroups)
            {
                var navigationList = new NavigationList {NavigationListName = moduleGroup.ModuleGroupName};

                foreach (ModuleGroupItem moduleGroupItem in moduleGroup.ModuleGroupItems)
                {
                    var navigationListItems = new NavigationListItem
                    {
                        ItemName = moduleGroupItem.ModuleGroupItemName,
                        ImageLocation = moduleGroupItem.ModuleGroupItemImagePath
                    };

                    navigationListItems.ItemClicked += GroupListItemItemClicked;
                    navigationList.NavigationListItems.Add(navigationListItems);

                    var navigationSettings = new NavigationSettings
                    {
                        Title = moduleGroupItem.TargetViewTitle,
                        View = moduleGroupItem.TargetView
                    };

                    string navigationKey = String.Format("{0}.{1}.{2}",
                        navigationPanelItem.NavigationPanelItemName,
                        navigationList.NavigationListName,
                        navigationListItems.ItemName);

                    navigationListItems.Tag = navigationKey;
                    navigationSettingsList.Add(navigationKey, navigationSettings);
                }

                navigationPanelItem.NavigationList.Add(navigationList);
            }

            navigationPanel.NavigationPanelItems.Add(navigationPanelItem);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Build up a Uri string based on the <see cref="NavigationSettings"/> argument,
        /// assign it a navigation id and store as a key value pair in the navigation settings list. 
        /// Then navigate to that view using the navigation id.
        /// </summary>
        /// <param name="navigationSettings">
        /// <see cref="NavigationSettings"/> contains information about the target view 
        /// such as the view type, view title, parameters and navigation history.
        /// </param>
        public void NavigateDocumentRegion(NavigationSettings navigationSettings)
        {
            if (String.IsNullOrEmpty(navigationSettings.View))
            {
                throw new Exception("Navigation Manager Exception : Target view not specified.");
            }

            var query = new UriQuery();
            query.Add("Title", navigationSettings.Title ?? navigationSettings.View);
            query.Add("Navigation", navigationSettings.NavigationHistory ?? String.Empty);

            string partialUri = navigationSettings.View + query.ToString();
            navigationSettings.PartialUri = partialUri;
            var navigationSettingsClone = (NavigationSettings)navigationSettings.Clone();
            string navigationId = String.Empty;
            lock (lockNavigationList)
            {
                var existingNavigationSetting = navigationSettingsList.Values.FirstOrDefault(
                    ns => ns.PartialUri.Equals(partialUri) 
                        && (ns.Data == null || ns.Data.Equals(navigationSettings.Data)));
                if (existingNavigationSetting != null)
                {
                    navigationId = existingNavigationSetting.NavigationId;
                }
                else
                {
                    navigationId = GetNewNavigationSettingsListKey();
                    query.Add("NavigationId", navigationId);
                    var viewUri = navigationSettings.View + query.ToString();
                    navigationSettingsClone.NavigationId = navigationId;
                    navigationSettingsClone.ViewUri = viewUri;
                    navigationSettingsList.Add(navigationId, navigationSettingsClone);
                }
            }

            NavigateDocumentRegion(navigationId); 
        }
Exemplo n.º 4
0
 /// <summary>
 /// Handles the Publish event raised by the view model to open a new document.
 /// </summary>
 /// <param name="sender">The view model.</param>
 /// <param name="e">Navigation settings.</param>
 protected void Publish(object sender, NavigationSettings e)
 {
     ViewContext.NavigationManager.NavigateDocumentRegion(e);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Called to publish a new document. Calls the <see cref="Publish"/> 
        /// event which is handled on the <see cref="ViewBase"/>.
        /// </summary>
        /// <param name="navigationSettings">Navigation settings for the new document.</param>
        protected void PublishDocument(NavigationSettings navigationSettings)
        {
            var publish = Publish;
            if (publish != null)
            {
                var navigationTarget = new NavigationTarget(navigationId, Title);
                if (navigationHistory.Count > 0)
                {
                    navigationTarget.AppendNavigationHistory(navigationHistory.Select(t => t.Target).ToArray());
                }

                navigationSettings.NavigationHistory = navigationTarget.NavigationHistory;
                publish(this, navigationSettings);
            }
        }