Example #1
0
 private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (!end)
     {
         if (e.LeftButton == MouseButtonState.Pressed)
         {
             try
             {
                 Point p = e.GetPosition(this);
                 if (points.Count >= 1)
                 {
                     double            l        = Math.Sqrt(Math.Pow(Math.Max(p.X - 10, points[0].X) - Math.Min(p.X - 10, points[0].X), 2) + Math.Pow(Math.Max(p.Y - 10, points[0].Y) - Math.Min(p.Y - 10, points[0].Y), 2));
                     InputBox.InputBox inputBox = new InputBox.InputBox();
                     if (l < 30)
                     {
                         lens.Add(decimal.Parse(inputBox.getString().Replace(".", ",")));
                         rez.Text = calk().ToString();
                         draw();
                         end = true;
                         return;
                     }
                     else
                     {
                         lens.Add(decimal.Parse(inputBox.getString().Replace(".", ",")));
                     }
                 }
                 points.Add(new Point(p.X - 10, p.Y - 30));
             }
             catch (Exception ex) { MessageBox.Show(ex.Message); }
         }
         draw();
     }
 }
Example #2
0
 private void calk(object sender, RoutedEventArgs e)
 {
     if (points.Count != lens.Count)
     {
         InputBox.InputBox inputBox = new InputBox.InputBox();
         lens.Add(decimal.Parse(inputBox.getString().Replace(".", ",")));
     }
     rez.Text = calk().ToString();
     draw();
     end = true;
 }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Форма для ввода имени
            InputBox.InputBox inputBox = new InputBox.InputBox();
            String            s        = inputBox.getString(); // Строка, введенная пользователем

            if (s != null)
            {
                listBox1.Items.Add(new APS(s));
            }
            textBoxCount.Text = APS.count.ToString();
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            // Форма для ввода имени
            InputBox.InputBox inputBox = new InputBox.InputBox();
            String            s        = inputBox.getString(); // Строка, введенная пользователем

            if (s != null)
            {
                APS newAbstractAPS = new APS(s);
                collect.Add(newAbstractAPS);
                textBoxIndex.Text = (collect.Count - 1).ToString();
                buttonSelect_Click(null, null);
            }
            textBoxCount.Text = APS.count.ToString();
        }
        private string GetUserName()
        {
            string name = "";

            InputBox.InputBox inputBox = new InputBox.InputBox();
            inputBox.TextMessage   = "Input name(minimum " + Defines.minLenghtName.ToString() + " characters, A-Z, a-z, 0-9):";
            inputBox.TextMaxLenght = Defines.maxLenghtName;
            name = inputBox.getString();
            while (!CorrectName(name))
            {
                MessageBox.Show("You have entered the correct name. The name must contain at least " + Defines.minLenghtName.ToString() + " characters including numbers and letters of the English language.", "Not a valid input.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                name = inputBox.getString();
            }
            return(name);
        }
Example #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            BinaryFormatter formatter = new BinaryFormatter();

            using (var fs = new Files("Data.dat").FileStreamCreate())
            {
                Person newPerson  = (Person)formatter.Deserialize(fs);
                string login      = newPerson.Login;
                string password   = newPerson.Password;
                string userMail   = newPerson.Email;
                string userName   = newPerson.Name;
                string SecretCode = "";
                fs.Close();



                MailAddress from = new MailAddress("*****@*****.**", "SpaceFileManager");
                MailAddress to   = new MailAddress(userMail);
                MailMessage m    = new MailMessage(from, to);
                m.Subject    = "PASSWORD RECOVERY";
                m.Body       = "<h2>" + userName + "'s user data for entering the SpasFileManager: LOGIN = "******"  PASSWORD = "******"smtp.yandex.ru", 25);
                smtp.Credentials = new NetworkCredential("SpaceFileManager", "suxhupmszwxjzofc");
                smtp.EnableSsl   = true;
                try
                {
                    MessageBox.Show("Check your e-mail and copy code to this window");
                    smtp.Send(m);
                    InputBox.InputBox inputBox = new InputBox.InputBox();
                    SecretCode = inputBox.getString();
                    if (SecretCode == password)
                    {
                        MessageBox.Show("Your account settings has been deleted");
                        new Files("Data.dat").Delete();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Incorrect code");
                    }
                }
                catch { MessageBox.Show("Operation failed. Please check your internet connection and try again later."); }
            }
        }
Example #7
0
        private decimal calk()
        {
            if (height == 0)
            {
                InputBox.InputBox inputBox = new InputBox.InputBox("Введите высоту");
                height = decimal.Parse(inputBox.getString().Replace(".", ","));
            }
            decimal rezult = 0;

            foreach (decimal d in lens)
            {
                rezult += d * height;
            }
            foreach (Grid g in otv.Items)
            {
                rezult -= decimal.Parse(((TextBox)g.Children[0]).Text.Replace(".", ",")) * decimal.Parse(((TextBox)g.Children[1]).Text.Replace(".", ","));
            }
            return(rezult);
        }