public ArcGISOnline()
    {
      Group = new AGOLGroup(this);
      Content = new AGOLContent(this);
      User = new AGOLUser(this);

      // re-initialize portal if user signs in or out
      User.SignedInOut += (o, e) =>
        {
            if (IsInitialized && !m_ignoreSignInOut)
                Initialize(Url, UrlSecure);
        };
    }
        public ArcGISOnline()
        {
            Group   = new AGOLGroup(this);
            Content = new AGOLContent(this);
            User    = new AGOLUser(this);

            // re-initialize portal if user signs in or out
            User.SignedInOut += (o, e) =>
            {
                if (IsInitialized && !m_ignoreSignInOut)
                {
                    Initialize(Url, UrlSecure);
                }
            };
        }
Пример #3
0
        private void LoadWebMap_GetMapCompleted(object sender, GetMapCompletedEventArgs e)
        {
            ESRI.ArcGIS.Client.WebMap.Document doc = (ESRI.ArcGIS.Client.WebMap.Document)sender;

            if (e.Error == null && e.Map != null)
            {
                attemptingReload = false;
                Map.InitializeFromWebMap(e, l_InitializationFailed);
                Map.GetMapUnitsAsync(SetScaleBarMapUnit, getMapUnitsFailed);

                doc.GetItemCompleted -= LoadWebMap_GetItemCompleted;
                doc.GetItemCompleted += LoadWebMap_GetItemCompleted;
                doc.GetItemAsync(loadWebMapID, e);
            }
            else
            {
                loadingWebMap = false;
                if (attemptingReload)
                {
                    attemptingReload = false;
                    loadWebMapCallback(e);
                    return;
                }
                initializeAgolFromDocument(doc, (agol) =>
                    {
                            // Attempt to sign in from isolated storage
                            AGOLUser user = new AGOLUser(agol);
                            user.SignInFromLocalStorage((o, a) =>
                            {
                                if (user.Token != null)
                                {
                                    // Sign in was successful - try loading web map again
                                    doc.Token = user.Token;
                                    attemptingReload = true;
                                    loadWebMap(loadWebMapID, doc, loadWebMapCallback, e.UserState);
                                }
                                else
                                {
                                    // Try signing into ArcGIS Online/Portal
                                    if (_signInCommand == null)
                                    {
                                        // Initialize sign-on command
                                        _signInCommand = new SignInToAGSOLCommand();
                                        _signInCommand.SignedIn += (o2, a2) =>
                                        {
                                            doc.Token = _signInCommand.ArcGISOnline.User.Token;
                                            attemptingReload = true;
                                            loadWebMap(loadWebMapID, doc, loadWebMapCallback, e.UserState);
                                        };

                                        _signInCommand.Cancelled += (o2, a2) =>
                                        {
                                            if (loadWebMapCallback != null)
                                                loadWebMapCallback(e);
                                        };
                                    }

                                    _signInCommand.ArcGISOnline = agol;
                                    _signInCommand.Execute(null);
                                }
                            });
                    });
            }
        }