Example #1
0
        public Complejo(double a = 0.0, double b = 1.0,
            Forma forma = Forma.Binomica)
        {
            this.a = a;
            this.b = b;
            this.forma = forma;
            this.precision = 2;

            if (forma == Forma.Polar)
            {
                // correccion del angulo asi queda siempre entre 0 < b < 2 pi
                if (Math.Abs(b) >= PI_2)
                    this.b = b % PI_2;

                if (this.b < 0.0)
                    this.b += 2 * Math.PI;
            }
        }
 public abstract bool sonVecinos(Forma f);
 public abstract void unirVecinos(Condicion c, Forma f);
        public override bool sonVecinos(Forma f)
        {
            bool son_vecinos = false;

            return(son_vecinos);
        }
 public override void unirVecinos(Condicion c, Forma f)
 {
 }
Example #6
0
        private static async void Bot_OnMessage(object sender, MessageEventArgs e)        //ПРИНЯТИЕ СООБЩЕНИЙ ОТ БОТА
        {
            var text = e?.Message?.Text;

            if (text == null)
            {
                return;
            }
            int    count = 0;
            string vrem  = text;

            while (vrem.IndexOf("#") != -1)//ПРОС7МОТР ЕСЛИ СООБЩЕНИЕ ЯВЛЯЕТСЯ ОТЗЫВОМ
            {
                count++; vrem = vrem.Substring(vrem.IndexOf("#") + 1);
            }
            switch (text)
            {
            case "/start":    //СООБЩЕНИЕ ПРИ НАЧАЛЕ РАБОТЫ С БОТОМ
                await Bot.SendTextMessageAsync(chatId : e.Message.Chat,
                                               text : $"Привет! Я Бот компании Норбит! здесь вы можете оставить свой отзыв об опыте использования нашими товарами и услугами").ConfigureAwait(false);

                await Bot.SendTextMessageAsync(chatId : e.Message.Chat,
                                               text : $"Вот команды которые я могу выполнять:    \n\r/form").ConfigureAwait(false);

                break;

            case "/form":    //КОГДА ПОЛЬЗОВАТЕЛЬ РЕШИЛ ОТПРАВИТЬ ОТЗЫВ
                await Bot.SendTextMessageAsync(chatId : e.Message.Chat,
                                               text : $"Хорошо. Отзыв так отзыв.\n\r Для того что бы ваш отзыв был сохранен и отправлен, пожалуйста, заполните форму согласно примеру ниже.\n\r" +
                                               $"---------------- Шаблон ------------------ " +
                                               $"\n\r# Номер вашего телефона" +
                                               $"\n\r# Адрес электронной почты" +
                                               $"\n\r# Ваш отзыв" +
                                               $"\n\r--------------- Пример ------------- " +
                                               $"\n\r# 8123457890" +
                                               $"\n\r# [email protected]" +
                                               $"\n\r# Норбит - превосходная IT компания, знающая толк в своем деле!").ConfigureAwait(false);

                Console.WriteLine($"Полученный текст '{text}' в чате'{e.Message.Chat.Id}'");
                break;

            default:                                       //проверка номера, проверка почты
                if (count == 3 && text.IndexOf('@') != -1) //ЕСЛИ ОТПРАВИЛИ ОТЗЫВ, ТО ОБРАБАТЫВАЕМ ЕГО
                {
                    Forma persona = new Forma();
                    text = text.Substring(1);
                    int position = text.IndexOf('#');
                    persona.phone   = text.Substring(0, position - 1);
                    text            = text.Substring(position);//-----
                    text            = text.Substring(1);
                    position        = text.IndexOf('#');
                    persona.email   = text.Substring(0, position - 1);
                    text            = text.Substring(position);//-----
                    text            = text.Substring(1);
                    persona.message = text;
                    persona.first   = e?.Message?.From?.FirstName.ToString();
                    persona.second  = e?.Message?.From?.LastName.ToString();
                    persona.kogda   = new DateTime(e.Message.Date.Year, e.Message.Date.Month, e.Message.Date.Day, e.Message.Date.Hour + 3, e.Message.Date.Minute, e.Message.Date.Second);
                    await Bot.SendTextMessageAsync(chatId : e.Message.Chat,
                                                   text : $"Спасибо за Ваш отзыв! Мы сделаем все, что в наших силах, что бы стать лучше!!!").ConfigureAwait(false);//ИНФОРМИРУЕМ ПОЬЗОВАТЕЛЯ О ТОМ ЧТО ОТЗЫВ ПРИНЯТ

                    //Console.WriteLine($"В итоге мы имеем {persona.email}   {persona.first}   {persona.second}   {persona.kogda}  {persona.message}   {persona.phone}");
                    // SendEmailAsync(persona).GetAwaiter();
                    SendContact(persona.phone, persona.email, persona.first, persona.second, persona.message);
                }
                else
                {
                    await Bot.SendTextMessageAsync(chatId : e.Message.Chat, text : $"Ненененене, я могу только поприветствовать тебя и отправить твой отзыв.\n\r" +
                                                   $"Не стесняйся и нажми сюда -> /form <- то бы заполнить форму и оставить отзыв.").ConfigureAwait(false);//В СЛУЧАЕ КАКОГО НИБУДЬ ДРУГОГО СООЩЕНИЯ(НЕ РАБОТАЕТ НА МЕДИА ФАЙЛЫ)

                    //Console.WriteLine(e?.Message?.From?.Id);
                }
                //await Bot.SendTextMessageAsync(chatId: e.Message.Chat,text: $"Ммм... это что то новенькое\n\rВы сказали {text}").ConfigureAwait(false);
                break;
            }
        }
Example #7
0
 public void PintarForma(Forma forma)
 {
     forma.Pintar();
 }
Example #8
0
 public double CalcularVolumen()
 {
     return(Altura * Forma.CalcularArea());
 }
Example #9
0
        public Complejo Convertir(Forma aForma)
        {
            if (this.forma == Forma.Binomica)
            {
                if (aForma == Forma.Polar)
                {
                    return new Complejo(
                        Math.Sqrt(Math.Pow(a, 2.0) + Math.Pow(b, 2.0)),
                        Math.Atan2(b, a),
                        Forma.Polar);
                }
                else if (aForma == Forma.Binomica)
                {
                    return this;
                }
            }
            else if (this.forma == Forma.Polar)
            {
                if (aForma == Forma.Binomica)
                    return new Complejo(
                        a * Math.Cos(b),
                        a * Math.Sin(b),
                        Forma.Binomica);
                else if (aForma == Forma.Polar)
                    return this;
            }

            throw new Exception("Conversion no esperada a " + aForma);
        }
Example #10
0
 public virtual void PripremiPrikaz()
 {
     GrafickiObjekt = Forma.CreateGraphics();
     PostaviDimenzije();
     _NacrtajOkvir();
 }