コード例 #1
0
        /// <summary>
        /// Restore mobeelizer applicaion state after tombstoning.
        /// Execute this method in your App.xaml.cs when application is activated.
        /// </summary>
        /// <param name="isApplicationInstancePreserved">Indicates whether yuours application instance is preserved.</param>
        public static void OnActivated(bool isApplicationInstancePreserved)
        {
            if (!isApplicationInstancePreserved)
            {
                Instance = MobeelizerApplication.CreateApplication();
                Instance.SyncStatusChanged += OnSyncStatusChanged;
                Instance.GetTombstoningManager().RestoreApplicationState();
            }

            Instance.GetTombstoningManager().ClearSavedState();
        }
コード例 #2
0
 internal MobeelizerFileService(MobeelizerApplication application)
 {
     this.application = application;
 }
コード例 #3
0
 public MobeelizerSyncServicePerformer(MobeelizerApplication application, bool syncAll)
 {
     this.application = application;
     this.isAllSynchronization = syncAll;
     this.dataFileService = new MobeelizerDataFileService(application);
 }
コード例 #4
0
        internal static MobeelizerApplication CreateApplication()
        {
            MobeelizerApplication application = new MobeelizerApplication();
            application.tombstoningManager = new MobeelizerTombstoningManager(application);
            MobeelizerConfigurationSection section = (MobeelizerConfigurationSection)ConfigurationManager.GetSection("mobeelizer-configuration");
            if (section == null)
            {
                throw new ConfigurationException("'mobeelizer-configuration' section not found in app.config file. Check if app.config is not missing and if file Build Action is set to Content.");
            }

            String device;
            String entityPackage;
            String definitionXml;
            String developmentRole;
            String url;
            String stringMode;
            int databaseVersion = 1;
            try
            {
                device = section.AppSettings[META_DEVICE].Value;
            }
            catch (KeyNotFoundException)
            {
                throw new ConfigurationException(META_DEVICE + " must be set in app.config file.");
            }

            try
            {
                entityPackage = section.AppSettings[META_PACKAGE].Value;
            }
            catch (KeyNotFoundException)
            {
                throw new ConfigurationException(META_PACKAGE + " must be set in app.config file.");
            }

            try
            {
                definitionXml = section.AppSettings[META_DEFINITION_ASSET].Value;
            }
            catch (KeyNotFoundException) { definitionXml = "application.xml"; }

            try
            {
                developmentRole = section.AppSettings[META_DEVELOPMENT_ROLE].Value;
            }
            catch (KeyNotFoundException) { developmentRole = null; }

            try
            {
                String strDatabaseVersion = section.AppSettings[META_DATABASE_VERSION].Value;
                if (!Int32.TryParse(strDatabaseVersion, out databaseVersion))
                {
                    throw new ConfigurationException(META_DATABASE_VERSION + " must be natural number.");
                }
            }
            catch (KeyNotFoundException) { databaseVersion = 1; }

            try
            {
                url = section.AppSettings[META_URL].Value;
            }
            catch (KeyNotFoundException) { url = null; }

            try
            {
                stringMode = section.AppSettings[META_MODE].Value;
            }
            catch (KeyNotFoundException)
            {
                throw new ConfigurationException(META_MODE + " must be set in app.config file.");
            }

            application.initApplication(device, entityPackage, developmentRole, definitionXml, databaseVersion, url, stringMode);
            return application;
        }
コード例 #5
0
ファイル: Mobeelizer.cs プロジェクト: mobeelizer/wp7-sdk
        /// <summary>
        /// Restore mobeelizer applicaion state after tombstoning. 
        /// Execute this method in your App.xaml.cs when application is activated.
        /// </summary>
        /// <param name="isApplicationInstancePreserved">Indicates whether yuours application instance is preserved.</param>
        public static void OnActivated(bool isApplicationInstancePreserved)
        {
            if (!isApplicationInstancePreserved)
            {
                Instance = MobeelizerApplication.CreateApplication();
                Instance.SyncStatusChanged += OnSyncStatusChanged;
                Instance.GetTombstoningManager().RestoreApplicationState();
            }

            Instance.GetTombstoningManager().ClearSavedState();
        }
コード例 #6
0
 private void SetRoleAndInstanceGuidInDatabase(MobeelizerApplication application, string role, string instanceGuid)
 {
     application.InternalDatabase.SetRoleAndInstanceGuid(application.Instance, application.User, application.Password, role, instanceGuid);
 }
コード例 #7
0
 private string[] GetRoleAndInstanceGuidFromDatabase(MobeelizerApplication application)
 {
     return application.InternalDatabase.GetRoleAndInstanceGuid(application.Instance, application.User, application.Password);
 }
コード例 #8
0
 public MobeelizerSyncServicePerformer(MobeelizerApplication application, bool syncAll)
 {
     this.application          = application;
     this.isAllSynchronization = syncAll;
     this.dataFileService      = new MobeelizerDataFileService(application);
 }
コード例 #9
0
 private void ClearRoleAndInstanceGuidInDatabase(MobeelizerApplication application)
 {
     application.InternalDatabase.ClearRoleAndInstanceGuid(application.Instance, application.User);
 }
コード例 #10
0
 private bool IsInitialSyncRequired(MobeelizerApplication application, string instanceGuid)
 {
     return(application.InternalDatabase.IsInitialSyncRequired(application.Instance, instanceGuid, application.User));
 }
コード例 #11
0
 public MobeelizerRealConnectionManager(MobeelizerApplication application)
 {
     this.application       = application;
     this.connectionService = new MobeelizerConnectionService(application);
 }
コード例 #12
0
 private string[] GetRoleAndInstanceGuidFromDatabase(MobeelizerApplication application)
 {
     return(application.InternalDatabase.GetRoleAndInstanceGuid(application.Instance, application.User, application.Password));
 }
コード例 #13
0
 private void SetRoleAndInstanceGuidInDatabase(MobeelizerApplication application, string role, string instanceGuid)
 {
     application.InternalDatabase.SetRoleAndInstanceGuid(application.Instance, application.User, application.Password, role, instanceGuid);
 }
コード例 #14
0
 public MobeelizerDataFileService(MobeelizerApplication application)
 {
     this.application = application;
 }
コード例 #15
0
ファイル: Mobeelizer.cs プロジェクト: mobeelizer/wp7-sdk
 /// <summary>
 /// Initialize mobeelizer application. Execute this method in your App.xaml.cs when application is lounching.
 /// </summary>
 public static void OnLaunching()
 {
     Instance = MobeelizerApplication.CreateApplication();
     Instance.SyncStatusChanged += OnSyncStatusChanged;
     Instance.GetTombstoningManager().ClearAndUnlockSavedState();
 }
コード例 #16
0
 internal MobeelizerTombstoningManager(MobeelizerApplication application)
 {
     this.application = application;
 }
コード例 #17
0
 internal MobeelizerFileService(MobeelizerApplication application)
 {
     this.application = application;
 }
コード例 #18
0
 /// <summary>
 /// Initialize mobeelizer application. Execute this method in your App.xaml.cs when application is lounching.
 /// </summary>
 public static void OnLaunching()
 {
     Instance = MobeelizerApplication.CreateApplication();
     Instance.SyncStatusChanged += OnSyncStatusChanged;
     Instance.GetTombstoningManager().ClearAndUnlockSavedState();
 }
コード例 #19
0
 private void ClearRoleAndInstanceGuidInDatabase(MobeelizerApplication application)
 {
     application.InternalDatabase.ClearRoleAndInstanceGuid(application.Instance, application.User);
 }
コード例 #20
0
 public MobeelizerDataFileService(MobeelizerApplication application)
 {
     this.application = application;
 }
コード例 #21
0
 private bool IsInitialSyncRequired(MobeelizerApplication application, string instanceGuid)
 {
     return application.InternalDatabase.IsInitialSyncRequired(application.Instance, instanceGuid, application.User);
 }
コード例 #22
0
        internal static MobeelizerApplication CreateApplication()
        {
            MobeelizerApplication application = new MobeelizerApplication();

            application.tombstoningManager = new MobeelizerTombstoningManager(application);
            MobeelizerConfigurationSection section = (MobeelizerConfigurationSection)ConfigurationManager.GetSection("mobeelizer-configuration");

            if (section == null)
            {
                throw new ConfigurationException("'mobeelizer-configuration' section not found in app.config file. Check if app.config is not missing and if file Build Action is set to Content.");
            }

            String device;
            String entityPackage;
            String definitionXml;
            String developmentRole;
            String url;
            String stringMode;
            int    databaseVersion = 1;

            try
            {
                device = section.AppSettings[META_DEVICE].Value;
            }
            catch (KeyNotFoundException)
            {
                throw new ConfigurationException(META_DEVICE + " must be set in app.config file.");
            }

            try
            {
                entityPackage = section.AppSettings[META_PACKAGE].Value;
            }
            catch (KeyNotFoundException)
            {
                throw new ConfigurationException(META_PACKAGE + " must be set in app.config file.");
            }

            try
            {
                definitionXml = section.AppSettings[META_DEFINITION_ASSET].Value;
            }
            catch (KeyNotFoundException) { definitionXml = "application.xml"; }

            try
            {
                developmentRole = section.AppSettings[META_DEVELOPMENT_ROLE].Value;
            }
            catch (KeyNotFoundException) { developmentRole = null; }

            try
            {
                String strDatabaseVersion = section.AppSettings[META_DATABASE_VERSION].Value;
                if (!Int32.TryParse(strDatabaseVersion, out databaseVersion))
                {
                    throw new ConfigurationException(META_DATABASE_VERSION + " must be natural number.");
                }
            }
            catch (KeyNotFoundException) { databaseVersion = 1; }

            try
            {
                url = section.AppSettings[META_URL].Value;
            }
            catch (KeyNotFoundException) { url = null; }

            try
            {
                stringMode = section.AppSettings[META_MODE].Value;
            }
            catch (KeyNotFoundException)
            {
                throw new ConfigurationException(META_MODE + " must be set in app.config file.");
            }

            application.initApplication(device, entityPackage, developmentRole, definitionXml, databaseVersion, url, stringMode);
            return(application);
        }
コード例 #23
0
 public MobeelizerRealConnectionManager(MobeelizerApplication application)
 {
     this.application = application;
     this.connectionService = new MobeelizerConnectionService(application);
 }
コード例 #24
0
 internal MobeelizerTombstoningManager(MobeelizerApplication application)
 {
     this.application = application;
 }