public static bool save(SettingsModel settings)
        {
            bool result;
            try
            {
                using (XmlTextWriter xmlTextWriter = new XmlTextWriter("settings.xml", Encoding.UTF8))
                {
                    xmlTextWriter.Formatting = Formatting.Indented;
                    xmlTextWriter.Indentation = 4;
                    xmlTextWriter.WriteStartDocument();
                    xmlTextWriter.WriteStartElement("settings");
                    xmlTextWriter.WriteElementString("ip", settings.ip);
                    xmlTextWriter.WriteElementString("password", Cryptography.Encrypt(settings.password));
                    xmlTextWriter.WriteEndElement();
                    xmlTextWriter.WriteEndDocument();
                }
                result = true;
            }
            catch (Exception exception)
            {
                LogManager.WriteToLog(exception.Message);

                result = false;
            }
            return result;
        }
        public static SettingsModel load()
        {
            SettingsModel result = new SettingsModel();
            try
            {
                if (File.Exists("settings.xml").Equals(true))
                {
                    XmlDocument xmlDocument = new XmlDocument();
                    xmlDocument.Load("settings.xml");
                    result = new SettingsModel
                    {
                        ip = xmlDocument.DocumentElement["ip"].InnerText,
                        password = Cryptography.Decrypt(xmlDocument.DocumentElement["password"].InnerText)
                    };
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteToLog(ex.Message);
            }

            return result;
        }
        private void OnLoginCommandExecute()
        {
            MainWindowModel mwm = Application.Current.FindResource("MainWindowModel") as MainWindowModel;

            if (LoginButtonText.Equals("Login"))
            {
                if (SpeedportHybridAPI.getInstance().ip.Equals(ip).Equals(false))
                {
                    SpeedportHybridAPI.getInstance().ip = ip;
                }

                bool login = SpeedportHybridAPI.getInstance().login(password);
                if (login.Equals(true))
                {
                    if (SavePassword.Equals(true))
                    {
                        SettingsModel SettingsModel = new SettingsModel
                        {
                            password = password,
                            ip = SpeedportHybridAPI.getInstance().ip
                        };

                        Settings.save(SettingsModel);
                    }
                    else {
                        SettingsModel SettingsModel = new SettingsModel
                        {
                            password = string.Empty,
                            ip = SpeedportHybridAPI.getInstance().ip
                        };

                        Settings.save(SettingsModel);
                    }

                    LoginFieldsVisibility = Visibility.Hidden;
                    mwm.ButtonOverviewPageIsActive = true;
                    mwm.ButtonDSLPageIsActive = true;
                    mwm.ButtonLteInfoPageIsActive = true;
                    mwm.ButtonSyslogPageIsActive = true;
                    mwm.ButtonTR181PageIsActive = true;
                    mwm.ButtonPhonePageIsActive = true;
                    mwm.ButtonLanPageIsActive = true;
                    mwm.ButtonInterfacePageIsActive = true;
                    mwm.ButtonControlsPageIsActive = true;

                    LoginButtonText = "Logout";
                    mwm.LoginButtonContent = "Logout";
                }
                else {
                    new Thread(() => { MessageBox.Show("Login fehlgeschlagen. Sie haben ein falsches Gerätepasswort eingegeben. Bitte versuchen Sie es erneut und achten Sie auf die korrekte Schreibweise.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error); }).Start();
                    LogManager.WriteToLog("Login Failed, wrong password");
                }
            }
            else {
                if (SpeedportHybridAPI.getInstance().logout().Equals(true))
                {
                    LogoutAction();
                }
            }
        }