Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
 internal MobeelizerFileService(MobeelizerApplication application)
 {
     this.application = application;
 }
 public MobeelizerSyncServicePerformer(MobeelizerApplication application, bool syncAll)
 {
     this.application = application;
     this.isAllSynchronization = syncAll;
     this.dataFileService = new MobeelizerDataFileService(application);
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 5
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();
        }
 private void SetRoleAndInstanceGuidInDatabase(MobeelizerApplication application, string role, string instanceGuid)
 {
     application.InternalDatabase.SetRoleAndInstanceGuid(application.Instance, application.User, application.Password, role, instanceGuid);
 }
 private string[] GetRoleAndInstanceGuidFromDatabase(MobeelizerApplication application)
 {
     return application.InternalDatabase.GetRoleAndInstanceGuid(application.Instance, application.User, application.Password);
 }
Ejemplo n.º 8
0
 public MobeelizerSyncServicePerformer(MobeelizerApplication application, bool syncAll)
 {
     this.application          = application;
     this.isAllSynchronization = syncAll;
     this.dataFileService      = new MobeelizerDataFileService(application);
 }
Ejemplo n.º 9
0
 private void ClearRoleAndInstanceGuidInDatabase(MobeelizerApplication application)
 {
     application.InternalDatabase.ClearRoleAndInstanceGuid(application.Instance, application.User);
 }
Ejemplo n.º 10
0
 private bool IsInitialSyncRequired(MobeelizerApplication application, string instanceGuid)
 {
     return(application.InternalDatabase.IsInitialSyncRequired(application.Instance, instanceGuid, application.User));
 }
Ejemplo n.º 11
0
 public MobeelizerRealConnectionManager(MobeelizerApplication application)
 {
     this.application       = application;
     this.connectionService = new MobeelizerConnectionService(application);
 }
Ejemplo n.º 12
0
 private string[] GetRoleAndInstanceGuidFromDatabase(MobeelizerApplication application)
 {
     return(application.InternalDatabase.GetRoleAndInstanceGuid(application.Instance, application.User, application.Password));
 }
Ejemplo n.º 13
0
 private void SetRoleAndInstanceGuidInDatabase(MobeelizerApplication application, string role, string instanceGuid)
 {
     application.InternalDatabase.SetRoleAndInstanceGuid(application.Instance, application.User, application.Password, role, instanceGuid);
 }
Ejemplo n.º 14
0
 public MobeelizerDataFileService(MobeelizerApplication application)
 {
     this.application = application;
 }
Ejemplo n.º 15
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();
 }
Ejemplo n.º 16
0
 internal MobeelizerTombstoningManager(MobeelizerApplication application)
 {
     this.application = application;
 }
Ejemplo n.º 17
0
 internal MobeelizerFileService(MobeelizerApplication application)
 {
     this.application = application;
 }
Ejemplo n.º 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();
 }
 private void ClearRoleAndInstanceGuidInDatabase(MobeelizerApplication application)
 {
     application.InternalDatabase.ClearRoleAndInstanceGuid(application.Instance, application.User);
 }
Ejemplo n.º 20
0
 public MobeelizerDataFileService(MobeelizerApplication application)
 {
     this.application = application;
 }
 private bool IsInitialSyncRequired(MobeelizerApplication application, string instanceGuid)
 {
     return application.InternalDatabase.IsInitialSyncRequired(application.Instance, instanceGuid, application.User);
 }
Ejemplo n.º 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);
        }
 public MobeelizerRealConnectionManager(MobeelizerApplication application)
 {
     this.application = application;
     this.connectionService = new MobeelizerConnectionService(application);
 }
 internal MobeelizerTombstoningManager(MobeelizerApplication application)
 {
     this.application = application;
 }