void TransitionToSignedInState(string emailId,
                                string password) {
   Debug.Assert(this.modelState == ModelState.Initialized);
   this.emailId = emailId;
   this.password = password;
   if (this.LoadingClientsEvent != null) {
     this.LoadingClientsEvent();
   }
   this.gaiaAuthenticator = null;
   this.LoadingClientsEvent = null;
   this.lkgStatePersistor = new LKGStatePersistor(emailId);
   this.clientModels = new ArrayList();
   this.LoadClients();
   this.modelState = ModelState.SignedIn;
   this.lkgStatePersistor.LoadLKGState(this);
   this.BuildModelFlatList();
   this.mailUploader = new MailUploader(this.HttpFactory,
                                        this.emailId,
                                        this.password,
                                        this.ApplicationName,
                                        this);
 }
 /// <summary>
 /// Cleans up the model for disposing
 /// </summary>
 public void Dispose() {
   try {
     GoogleEmailUploaderTrace.EnteringMethod(
         "GoogleEmailUploaderModel.Dispose");
     if (this.modelState == ModelState.Initialized) {
       this.gaiaAuthenticator = null;
     } else if (this.modelState == ModelState.SignedIn) {
       this.emailId = null;
       this.password = null;
       this.lkgStatePersistor.SaveLKGState(this);
       this.lkgStatePersistor = null;
       this.flatStoreModelList = null;
       this.flatFolderModelList = null;
       this.DisposeClientModels();
     } else if (this.modelState == ModelState.Uploading ||
         this.modelState == ModelState.UploadingPause) {
       this.emailId = null;
       this.password = null;
       this.lkgStatePersistor = null;
       this.flatStoreModelList = null;
       this.flatFolderModelList = null;
       this.mailUploader = null;
       this.contactIterator.Dispose();
       this.mailIterator.Dispose();
       this.contactIterator = null;
       this.mailIterator = null;
       if (this.pauseTimer != null) {
         this.pauseTimer.Dispose();
         this.pauseTimer = null;
       }
       this.DisposeClientModels();
     }
   } finally {
     GoogleEmailUploaderTrace.ExitingMethod(
         "GoogleEmailUploaderModel.Dispose");
   }
 }
 void TransitionToInitializedState() {
   this.gaiaAuthenticator =
       new GoogleAuthenticator(this.HttpFactory,
                               AccountType.GoogleOrHosted,
                               this.ApplicationName);
   this.emailId = null;
   this.password = null;
   this.lkgStatePersistor = null;
   this.flatStoreModelList = null;
   this.flatFolderModelList = null;
   this.mailUploader = null;
   this.contactIterator = null;
   this.mailIterator = null;
   this.pauseTimer = null;
   this.modelState = ModelState.Initialized;
 }