async private void  onlineElement_ValueChanged( object sender , EventArgs e)
        {

            if (onlineElement.Value == false)
            {
                MessageBox.ShowMessage(this.View, LocalString.GetString("UserOffline"));
                Application._user.NetworkStatus = DataAccessLayer.NetworkState.Disconnected;
            }
            else
            {

                if (Application._networkstate == DataAccessLayer.NetworkState.Disconnected)
                {
                    onlineElement.Value = false;
                    return;
                }

                // First save the current setting -> We need them if the connection to the new server fails -> then we have to reset to these settings
                CurrentURL = DataAccessLayer.Utilities.ServerIP;
                CurrentNetworkState = Application._networkstate;

                // Just run the Login ViewController if the user has never logged online before
                if (string.IsNullOrEmpty(Application._user.IdSession))
                {
                    Application._user.NetworkStatus = Application._networkstate;
                    DataAccessLayer.Utilities.ServerIP = urlElement.Value.ToString();

                    // Create a VCSelectAnsprechpartnern dialog
                    loginController = Storyboard.InstantiateViewController<LoginController>();
                    loginController.VCSettings = this;
                    loginController.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;

                    PresentViewController(loginController, true, null);

                    return;
                    // After it has finished the LoginController calls UpdateLoggedValues

                }
                else
                {
                    if (await TestConnection() == true)
                    {
                        // connection available and the user is online
                        Application._user.NetworkStatus = Application._networkstate;
                        MessageBox.ShowMessage(this.View, LocalString.GetString("UserOnline"));

                    }
                    else
                    {
                        // No connection
                        onlineElement.Value = false;
                        Application._user.NetworkStatus = DataAccessLayer.NetworkState.Disconnected;

                        MessageBox.ShowErrorMessage(this.View, LocalString.GetString("ConnectionFailedTitle"));

                    }
                }

                if (Application._user.NetworkStatus != DataAccessLayer.NetworkState.Disconnected)
                    offlineTasks = BusinessLayer.Task.HasNewOfflineTasks();

                // Ask to upload any unsync data if the user is online 
                if (offlineTasks != 0 && Application._user.NetworkStatus != DataAccessLayer.NetworkState.Disconnected)
                {
                    OfflineDataSection.RemoveRange(1,3);
                    string UploadLabel = "";
                    if (offlineTasks != 0)
                        UploadLabel = "  (" + LocalString.GetString("UnsynchronizedData_") + " " + offlineTasks.ToString() + ")";
                    uploadDataElement = new ImageStringElement(LocalString.GetString("UploadData") + UploadLabel,UIImage.FromFile("Images/ic_action_upload.png"));
                    uploadDataElement.Tapped += delegate()
                        {
                            UploadData();
                        };

                    OfflineDataSection.Add(uploadDataElement);
                    OfflineDataSection.Add(clearofflineDataElement);

                    UploadData();
                }
            }

        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///
        /// Events of the class
        ///
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////

        #region Class Events

        /// <summary>
        /// Purpose : Main launching event -> Read ServerIP, MainColor -> Apply the Main Theme -> Set the window -> Connectivity observer -> Run the login viewcontroller
        /// </summary>
        /// <returns><c>true</c>, if launching was finisheded, <c>false</c> otherwise.</returns>
        /// <param name="application">Application.</param>
        /// <param name="launchOptions">Launch options.</param>
        public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
        {

            // First initialize and then set the ServerIP
            DataAccessLayer.SQLiteUtilities.Initialize();
            DataAccessLayer.Utilities.ServerIP = BusinessLayer.User.GetUrl();
            DataAccessLayer.Utilities.MainColor = BusinessLayer.User.GetColor();

            if (BusinessLayer.User.GetGunTheme() == 0)
                Application.GunTheme = false;
            else
            {
                Application.GunTheme = true;
                GunmetalTheme.Apply();
            }


            // Apply the theme
            // Override point for customization after application launch.
            Window = new UIWindow(UIScreen.MainScreen.Bounds);
            Application._uiWindow = Window;


            // Here we set the network connection observer
            // This is done by the Reachablity class
            UpdateStatus ();
            Reachability.InternetConnectionStatus (); 
            Reachability.LocalWifiConnectionStatus ();
            Reachability.RemoteHostStatus ();

            // Main point: The eventhandler when network status changes
            Reachability.ReachabilityChanged += (object sender, EventArgs e) =>  { UpdateStatus (); };

            storyboard = UIStoryboard.FromName ("MainStoryboard", null);
            loginController = storyboard.InstantiateInitialViewController () as LoginController;
            Window.RootViewController = loginController;
            Window.MakeKeyAndVisible ();


            return true;

        }