private void WidgetLinkButton_Click(object sender, RoutedEventArgs e)
 {
     if (sender is HyperlinkButton)
     {
         string     title  = (string)(sender as HyperlinkButton).Tag;
         WidgetBase widget = WidgetManager.FindWidgetByTitle(title);
         if (widget != null)
         {
             widget.IsOpen = true;
         }
     }
 }
 private void WidgetMenuItem_Click(object sender, MenuItemClickEventArgs e)
 {
     if (sender is ContextMenuItem)
     {
         string     title  = (sender as ContextMenuItem).Text;
         WidgetBase widget = WidgetManager.FindWidgetByTitle(title);
         if (widget != null)
         {
             widget.IsOpen = true;
         }
     }
 }
        private void SubmitReportButton_Click(object sender, RoutedEventArgs e)
        {
            if (lstGraphicWidget.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a widget with selected graphic", "Message", MessageBoxButton.OK);
                return;
            }

            double bufferDistance = 0;

            if (!double.TryParse(txtBufferDistance.Text, out bufferDistance))
            {
                MessageBox.Show("Buffer distance is invalid. Please input a valid number", "Message", MessageBoxButton.OK);
                return;
            }

            string     widgetTitle = (string)lstGraphicWidget.SelectedItem;
            WidgetBase widget      = WidgetManager.FindWidgetByTitle(widgetTitle);

            Graphic centerGraphic        = widget.SelectedGraphic;
            GeoFeatureCollection dataset = widget.FindFeatureSetWithSelection();
            string displayField          = (dataset != null) ? dataset.DisplayFieldName : "";
            string featureLayer          = (dataset != null) ? dataset.FeatureLayerName : "";

            if (centerGraphic.Attributes.ContainsKey("Address")) //Locator
            {
                addressValue = (string)centerGraphic.Attributes["Address"];
            }
            else if (centerGraphic.Attributes.ContainsKey(displayField))
            {
                addressValue = (string)centerGraphic.Attributes[displayField];
            }

            if (bufferDistance > 0)
            {
                this.IsBusy = true;
                string bufUnits = (string)(lstBufferUnits.SelectedItem as ComboBoxItem).Content;
                locationName = string.Format("{0} {1} around {2}", txtBufferDistance.Text, bufUnits.ToLower(), featureLayer);
                CreateBufferZone(bufferDistance, centerGraphic, bufUnits, locationName);
            }
            else if (centerGraphic.Geometry is Polygon)
            {
                this.IsBusy = true;
                centerGraphic.Geometry.SpatialReference = new SpatialReference(this.MapSRWKID);
                locationName = string.Format("Within {0}", featureLayer);
                centerGraphic.Attributes.Add("AREA_ID", locationName);
                AuthenticateUser(centerGraphic);
            }
        }