public void Change()
        {
            bool reindex = false;
            lock (mutex)
            {
                Changer changer = new Changer(this.mTags, AccountLogin.DecryptPassword(this.mUserName, this.mEncryptedToken, this.mPasswordKey, this.mPasswordIV), this.mUserName);
                changer.ev_ExceptionThrown += new Changer.ExceptionThrown(changer_ev_ExceptionThrown);
                this.ValidateDatabaseFile(ref mDataPath, ref database);
                Changer.PictureChangerInfo newPicture = changer.ChangePhoto(database, Application.UserAppDataPath, this.mWallpaperSize);
                if (newPicture.Path.Length > 0 && newPicture.ID.Length > 0 && newPicture.Title.Length > 0)
                {
                    Program.ChangePicture(changer.ChangePhoto(database, Application.UserAppDataPath, this.mWallpaperSize));
                }
                else if (database.Photo.Count == 0)
                {
                    reindex = true;
                }
                changer.ev_ExceptionThrown -= new Changer.ExceptionThrown(changer_ev_ExceptionThrown);
                changer.Dispose();
                changer = null;

            }
            if (reindex)
                this.Reindex(true);
        }
        private void Reindex(bool reindexAll)
        {
            
            lock (mutex)
            {
                if(reindexAll)
                    this.UpdateStatus("Currently reindexing all photos");
                else
                    this.UpdateStatus("Currently checking for new photos");
                Changer changer = new Changer(this.mTags, AccountLogin.DecryptPassword(this.mUserName, this.mEncryptedToken, this.mPasswordKey, this.mPasswordIV), this.mUserName);
                changer.ev_ExceptionThrown += new Changer.ExceptionThrown(changer_ev_ExceptionThrown);
                
                this.ValidateDatabaseFile(ref mDataPath, ref database);
                changer.Reindex(ref this.database, reindexAll);
                changer.Dispose();
                changer = null;

                this.mNumberOfPictures = database.Photo.Count;
                
                this.mReindexedDate = DateTime.Now;
                
                PhotoDataSet.LogRow header = null;

                // Get the last updated date
                try
                {
                    header = this.database.Log.Rows[0] as PhotoDataSet.LogRow;
                    header.LastModified = DateTime.Now;
                }
                catch
                {

                    header = this.database.Log.NewLogRow();
                    header.LastModified = DateTime.Now;
                    this.database.Log.AddLogRow(header);
                }
                this.database.WriteXml(this.mDataPath);
                this.UpdateStatus("Currently waiting to change pictures");
                this.UpdateNumberOfPhotosIndexed("There are "+this.mNumberOfPictures.ToString()+" photos available");
                this.UpdateLastIndexed("Last Updated " + DateTime.Now.ToShortDateString());

            }
        }