/// <summary>
        /// Logins the specified user name.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <returns></returns>
        public bool Login(string userName, string password)
        {
            authHandler                       = new AuthentificationHandler();
            this.websockerHandler             = new InnogyWebSocketHandler();
            this.websockerHandler.InnogyEvent = websh_InnogyEvent;

            this.IsInitialized = false;
            authHandler.Login(userName, password);

            if (!authHandler.CredentialsCorrect)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        public static void Authentification()
        {
            var dh = new AuthentificationHandler();

            if (!File.Exists(ConstantKeeper.PathToKeys))
            {
                CreateQuestion("Ключ не найден. Это первый запуск? (Y - да)");
                if ((ConstantKeeper.CurrentArea is YesNoArea yn && !yn.Yes) ||
                    !(ConstantKeeper.CurrentArea is YesNoArea))
                {
                    ConstantKeeper.CurrentArea = new Area(
                        "Файл с ключом не найден! Введите путь до файла с ключом:",
                        () =>
                    {
                        ConstantKeeper.PathToKeys = Console.ReadLine();
                        Authentification();
                    });
                }
                else
                {
                    ConstantKeeper.CurrentArea = new Area(
                        "Подготовка...", ChangePassword);
                }
            }