BeatMachine.Model.DataModel.LoadCatalogId C# (CSharp) Method

LoadCatalogId() public method

Ensures Model.CatalogId is populated. Will try the following: 1. Try loading it from the "CatalogId" setting in storage 2. If (1) is successful, it will try reading 1 song from the catalog to make sure it is there on the web service 3. If (1) or (2) fails, it will create a new catalog on the web service
public LoadCatalogId ( object state ) : void
state object
return void
        public void LoadCatalogId(object state)
        {
            bool loadedId = false;
            string id;

            if (String.IsNullOrEmpty(CatalogId))
            {
                if (new SafeIsolatedStorageSettings().
                    TryGetValue<string>(CatalogIdPropertyName, out id))
                {
                    loadedId = true;
                    logger.Debug("Loaded CatalogId {0} from isolated storage",
                        id);
                }
            }
            else
            {
                loadedId = true;
                id = CatalogId;
                logger.Debug("Loaded CatalogId {0} from memory", id);
            }

            if (!loadedId)
            {
                LoadCatalogIdNeedsToCreateCatalog();
            }
            else
            {
                LoadCatalogIdNeedsToCheckCatalogId(id);
            }
        }