ArcGISWindowsPhoneSDK.EditorTracking.FeatureLayer_Initialized C# (CSharp) Метод

FeatureLayer_Initialized() приватный Метод

private FeatureLayer_Initialized ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
        private void FeatureLayer_Initialized(object sender, EventArgs e)
        {
            FeatureLayer fl = sender as FeatureLayer;
            IdentityManager.Credential credential = IdentityManager.Current.FindCredential(fl.Url);

            if (credential != null || fl.InitializationFailure != null)
            {
                LoginGrid.Visibility = System.Windows.Visibility.Collapsed;
                ShadowGrid.Visibility = System.Windows.Visibility.Collapsed;
                LoggedInGrid.Visibility = System.Windows.Visibility.Visible;

                #region populate the FeatureTypeListBox with the possible templates
                FeatureTypeListBox.Items.Clear();
                IDictionary<object, FeatureType> featureTypes = fl.LayerInfo.FeatureTypes;
                if (fl.Renderer != null)
                {
                    Symbol defaultSymbol = fl.Renderer.GetSymbol(null);
                    if (featureTypes != null && featureTypes.Count > 0)
                    {
                        foreach (KeyValuePair<object, FeatureType> featureTypePairs in featureTypes)
                        {
                            if (featureTypePairs.Value != null && featureTypePairs.Value.Templates != null && featureTypePairs.Value.Templates.Count > 0)
                            {
                                foreach (KeyValuePair<string, FeatureTemplate> featureTemplate in featureTypePairs.Value.Templates)
                                {
                                    string name = featureTypePairs.Value.Name;
                                    if (featureTypePairs.Value.Templates.Count > 1)
                                        name = string.Format("{0}-{1}", featureTypePairs.Value.Name, featureTemplate.Value.Name);
                                    Symbol symbol = featureTemplate.Value.GetSymbol(fl.Renderer) ?? defaultSymbol;

                                    FeatureTypeListBox.Items.Add(new TemplateItem(name, symbol, Convert.ToInt32(featureTypePairs.Value.Id)));
                                }
                            }
                        }
                    }
                }
                #endregion

                if (credential != null)
                {
                    LoggedInUserTextBlock.Text = credential.UserName;
                    fl.EditUserName = credential.UserName;
                }

                //enable the app bar and context menu items
                for (int i = 0; i < ApplicationBar.Buttons.Count; ++i)
                    (ApplicationBar.Buttons[i] as IApplicationBarIconButton).IsEnabled = true;
            }
        }