private void AuthenticateUser(Graphic graphic)
        {
            AuthenticationTask authTask = new AuthenticationTask();

            //  Wire up async event handlers
            authTask.Failed += new EventHandler <TaskFailedEventArgs>(BAOTask_Failed);

            //  Execute this code block when the async response returns successfully
            authTask.ExecuteCompleted += (object sender, AuthenticationEventArgs args) =>
            {
                if (graphic != null)
                {
                    FeatureSet fset = new FeatureSet();
                    fset.Features.Add(graphic);
                    fset.GeometryType     = GeometryType.Polygon;
                    fset.SpatialReference = graphic.Geometry.SpatialReference;
                    CreateSummaryReports(fset, args.Token);
                }
            };

            if (widgetConfig != null)
            {
                authTask.ExecuteAsync(widgetConfig.Username, widgetConfig.Password, "User Authorization");
            }
        }
Ejemplo n.º 2
0
 public AuthenticationTests()
 {
     task = new AuthenticationTask(CreateClient(), null);
 }