void ProfileSvc_ProfileLoaded(AsyncOperationInstance operation)
        {
            ProfileSvc.ProfileLoaded -= ProfileSvc_ProfileLoaded;
            var project = ProfileSvc.ProjectID;

            var paths = Settings.getOptions().Paths;


            if (CM.truncateSyncTable())
            {
                CM.disconnectFromMobileDB();
                SessionMgr.endSession();
                SessionMgr.startSession();
                var workingPaths = SessionMgr.createCleanWorkingCopies(paths);
                CM.connectToMobileDB(workingPaths);
            }
            else
            {
                if (CurrentOperation != null)
                {
                    CurrentOperation.failure("Actions_Error_CouldntTruncateSync", "");
                }
                _Log.Info("Could not truncate Sync Table, aborting clean.");
            }


            if (ProfileSvc.ProjectID != project)
            {
                ProfileSvc.ProjectID = project;
            }
            if (CurrentOperation != null)
            {
                CurrentOperation.success();
            }
        }
 private void connectToMobile()
 {
     if (SessionMgr.canResumeSession())
     {
         showYesNoBox("ConnectionsPage_ResumeSession_Title", "ConnectionsPage_ResumeSession_Description", System.Windows.MessageBoxResult.No,
                      (res) =>
         {
             if (res == System.Windows.MessageBoxResult.Yes)
             {
                 new Action <DBPaths>(connectTo).BeginInvoke(SessionMgr.resumeSession(_settings.Paths), null, null);
             }
             else
             {
                 SessionMgr.startSession();
                 new Action <DBPaths>(connectTo).BeginInvoke(SessionMgr.createWorkingCopies(_settings.Paths), null, null);
             }
         });
     }
     else
     {
         SessionMgr.startSession();
         new Action <DBPaths>(connectTo).BeginInvoke(SessionMgr.createWorkingCopies(_settings.Paths), null, null);
     }
 }