Esempio n. 1
0
        public void save_ans()
        {
            SaveFileDialog sv = new SaveFileDialog();

            sv.FileName         = "ans.dx";
            sv.InitialDirectory = @"\saved";
            sv.Filter           = "DexESparkOrient files (*.dx)|*.dx";
            if (sv.ShowDialog() == DialogResult.OK)
            {
                string ans_name = sv.FileName;
                Console.WriteLine(sv.FileName);
                StreamWriter w1 = new StreamWriter(ans_name);
                w1.Write(fl.get_text(@"inner_temp\response.dx"));
                w1.Close();
            }
        }
Esempio n. 2
0
        private void AnswerScreen_Load(object sender, EventArgs e)
        {
            menuStrip1.ForeColor = Color.White;
            FilesLoader fl = new FilesLoader();

            byte[] text = Encoding.UTF8.GetBytes(fl.get_text(@"inner_temp\response.dx"));
            answer_text.Text = Encoding.UTF8.GetString(text);
            if (answer_text.Text == string.Empty)
            {
                MessageBox.Show("Something went wrong(Enter you question in another way or check you internet connection and try again later)", "Sorry x_x!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }
        private void send_q_Click(object sender, EventArgs e)
        {
            string user    = username.Text;
            string pass    = passwrd.Text;
            string To      = to.Text;
            string Message = message_text.Text;

            File.WriteAllText(@"mail_data\username.edxf", string.Empty);
            File.WriteAllText(@"mail_data\passwrd.edxf", string.Empty);
            File.WriteAllText(@"mail_data\to_mail.edxf", string.Empty);
            File.WriteAllText(@"mail_data\message.edxf", string.Empty);
            File.WriteAllText(@"mail_data\response.dx", string.Empty);



            if (user != "" && pass != "" && Message != "")
            {
                fl.set_text(user, @"mail_data\username.edxf");
                fl.set_text(pass, @"mail_data\passwrd.edxf");
                fl.set_text(To, @"mail_data\to_mail.edxf");
                fl.set_text(Message, @"mail_data\message.edxf");
                process_exec ps = new process_exec(@"Python\python.exe", @"scripts\SendMail.py");
                ps.process();
            }
            else
            {
                MessageBox.Show("Please, fill all the fields", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            string result = fl.get_text(@"mail_data\response.dx");

            if (result == "success")
            {
                MessageBox.Show("Message sent successfully", "Success (:", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (result == "error")
            {
                MessageBox.Show("Something went wrong, Please try again later.", "Sorry x_x", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }