예제 #1
0
        private void OnInitialiseMapManagerCompleted(object sender, InitialiseMapManagerEventArgs e)
        {
            if (GetDomainId().HasValue)
            {
                //if the starting NodeUid is provided use that
                if (GetNodeId().HasValue)
                {
                    InitializeNavigator(GetDomainId().Value, GetNodeId().Value);
                }
                //if no starting NodeUid is provided find the domain node and use that
                else
                {
                    _mapManager.AcquireNodesByDomainCompleted.RegisterEvent(GetDomainId().Value, new EventHandler <Proxy.NodesEventArgs>(OnAcquireNodesByDomainCompleted));
                    _mapManager.AcquireNodesByDomainAsync(GetDomainId().Value);
                }
            }
            else
            {
                // If there is no domain ID supplied then provide a dialog box to select one.
                DomainSelectionDialog selectionDialog = new DomainSelectionDialog();
                // TODO: The following lines need to be modded so that the MapManager is passed through rather than the NodeService.
                selectionDialog.DataContext    = _nodeService;
                selectionDialog.MapManager     = _mapManager;
                selectionDialog.HasCloseButton = false;

                selectionDialog.Closed += delegate(object dialog, EventArgs dialogArgs)
                {
                    this.Dispatcher.BeginInvoke(delegate() { InitializeNavigator(selectionDialog.DomainId, selectionDialog.NodeId); });
                };

                selectionDialog.Show();
            }
        }