Пример #1
0
        private void Form5_View_Group_Load(object sender, EventArgs e)
        {
            FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Group Names.txt";

            FileReadWrite.LoadDataFromFileInComboBox(comboBox_Group_Name);

            comboBox_Group_Name.SelectedIndex = 0;
        }
Пример #2
0
        private void add_multiple_contacts_Click(object sender, EventArgs e)
        {
            Add_Multiple_Contacts AMC = new Add_Multiple_Contacts();

            AMC.ShowDialog();

            // Loading group names in combobox
            FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Group Names.txt";

            comboBox_to.Items.Clear();
            FileReadWrite.LoadDataFromFileInComboBox(comboBox_to);
        }
Пример #3
0
        private void button_Create_Group_Click(object sender, EventArgs e)
        {
            FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Group Names.txt";

            FileReadWrite.WriteInFileTextBoxContent(textBox_Group_Name.Text);

            FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Groups\\" + textBox_Group_Name.Text + ".txt";

            FileReadWrite.WriteInFileFromCheckListBox(checkedListBox_Group_Email_IDs.CheckedItems);

            MessageBox.Show("Group Created Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            comboBox_Group_Name.Items.Add(textBox_Group_Name.Text);
            checkedListBox_New_Group_ID_Collection.Items.Clear();
            textBox_Group_Name.Clear();
        }
Пример #4
0
        private void button_Save_Edit_List_Click(object sender, EventArgs e)
        {
            flag = true;

            FileNameBeforeEditing = comboBox_to.SelectedItem.ToString();

            FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Groups\\__" + comboBox_to.SelectedItem.ToString() + "(Edited).txt";

            FileReadWrite.WriteInFileFromCheckListBox(checkedListBox_Edit_Recipients.CheckedItems);

            comboBox_to.Items.Add("__" + comboBox_to.SelectedItem.ToString() + "(Edited)");
            comboBox_to.SelectedIndex = 0;

            checkedListBox_Edit_Recipients.Visible = false;
            button_Save_Edit_List.Visible          = false;
            button_Close_Editing.Visible           = false;
            button_edit_group_list.Enabled         = true;
        }
Пример #5
0
        private void Save_Sent_Mail()
        {
            // Creating New Directory for last Sent Mail as named "Mail <mail number>"
            DirectoryInfo di = new DirectoryInfo(FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Sent Mails\\Mail " + ++Total_Mail_Sent);

            di.Create();

            // Setting Path for File to read where contacts are stored of last sent mail
            string path1 = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Groups\\" + comboBox_to.SelectedItem.ToString() + ".txt";

            // Setting Path for storing last mail sent reciepients ID
            string path2 = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Sent Mails\\Mail " + Total_Mail_Sent.ToString() + "\\To.txt";

            // Create a file to write to Reciepients of last mail.
            using (StreamWriter sw = File.CreateText(path2))
            {
                //Open the file to read from.
                using (StreamReader sr = File.OpenText(path1))
                {
                    string s = "";
                    while ((s = sr.ReadLine()) != null)
                    {
                        sw.WriteLine(s);
                    }
                }
            }


            FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Sent Mails\\Mail " + Total_Mail_Sent.ToString() + "\\Subject.txt";
            FileReadWrite.WriteInFileTextBoxContent(textBox_subject.Text);

            FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Sent Mails\\Mail " + Total_Mail_Sent.ToString() + "\\Content.txt";
            FileReadWrite.WriteInFileFromRichTextBox(richTextBox_content.Lines);

            // Writing of Total Mails Sent in "Total Mail Sent Quota File"
            string path3 = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Total Mails Sent Quota.txt";

            // Create a file to write to.
            using (StreamWriter sw = File.CreateText(path3))
            {
                sw.WriteLine(Total_Mail_Sent.ToString());
            }
        }
Пример #6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (!CheckForInternetConnection())   //Check for "system is not connected to the internet" is true
            {
                MessageBox.Show("No Internet Connection. Data will be saved offline.", "No Internet", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            System.Windows.Forms.Label l1 = new System.Windows.Forms.Label();
            l1.Text     = "Application is Loading. Please Wait ...";
            l1.AutoSize = true;
            l1.Location = new Point(20, 20);

            Form f1 = new Form();

            f1.Width         = 500;
            f1.Height        = 100;
            f1.StartPosition = FormStartPosition.CenterScreen;
            f1.Controls.Add(l1);
            f1.BackColor   = Color.Linen;
            f1.MinimizeBox = false;
            f1.MaximizeBox = false;
            f1.Show();

            //   UserCredential credential;
            try
            {
                using (var stream =
                           new FileStream("client_secret.json", FileMode.Open, FileAccess.Read))
                {
                    credPath = System.Environment.GetFolderPath(
                        System.Environment.SpecialFolder.Personal);
                    credPath = Path.Combine(credPath, ".credentials/main");

                    credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                        GoogleClientSecrets.Load(stream).Secrets,
                        Scopes,
                        "user",
                        CancellationToken.None,
                        new FileDataStore(credPath, true)).Result;
                }
                f1.Close();
                MessageBox.Show("Authorization Completed Successfully", "Mail Client Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception t)
            {
                MessageBox.Show("Authorization Failed\n" + t.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            System.Drawing.Color y = Color.FromArgb(31, 65, 119);
            //label_step1.ForeColor = y;
            //label_step2.ForeColor = y;
            label_to.ForeColor      = y;
            label_subject.ForeColor = y;
            label_content.ForeColor = y;

            button_authorize.FlatAppearance.BorderColor = y;
            button_authorize.ForeColor = y;

            button_edit_group_list.FlatAppearance.BorderColor = y;
            button_edit_group_list.ForeColor = y;

            button_send_mail.FlatAppearance.BorderColor = y;
            button_send_mail.ForeColor = y;

            button_clear.FlatAppearance.BorderColor = y;
            button_clear.ForeColor = y;

            button_exit.FlatAppearance.BorderColor = y;
            button_exit.ForeColor = y;

            send_mail_menu.ForeColor = y;

            comboBox_to.ForeColor = y;

            textBox_subject.ForeColor = y;

            richTextBox_content.ForeColor = y;

            System.Drawing.Color x = Color.FromArgb(140, 197, 67);
            //menuStrip1.BackColor = x;

            // Loading
            FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Group Names.txt";

            FileReadWrite.LoadDataFromFileInComboBox(comboBox_to);

            // Reading Total Mail Sent Quota and storing in variable
            string path1 = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Total Mails Sent Quota.txt";

            //Open the file to read from.
            using (StreamReader sr = File.OpenText(path1))
            {
                Total_Mail_Sent = Convert.ToInt32(sr.ReadLine());
            }
        }
Пример #7
0
 private void comboBox_to_DropDown(object sender, EventArgs e)
 {
     comboBox_to.Items.Clear();
     FileReadWrite.LoadDataFromFileInComboBox(comboBox_to);
 }
Пример #8
0
        private void button_Add_Bulk_Email_IDs_Click(object sender, EventArgs e)
        {
            string path     = null;
            int    counter  = 0;
            int    counter2 = 0;

            string[] Mail_IDs_Collection = richTextBox_Bulk_Email_IDs.Lines;
            int      Total_Email_IDs     = Mail_IDs_Collection.Length;
            int      Total_Group         = 0;
            int      Mail_ID_Number      = 0;
            bool     Is_Last_Group_Have_Less_Than_90_Emails;

            progressBar1.Maximum = Total_Email_IDs - 1;

            if (Total_Email_IDs % 90 == 0)
            {
                Total_Group = Total_Email_IDs / 90;
                Is_Last_Group_Have_Less_Than_90_Emails = false;
            }
            else
            {
                Total_Group = (Total_Email_IDs / 90) + 1;
                Is_Last_Group_Have_Less_Than_90_Emails = true;
            }

            for (counter = 1; counter <= Total_Group; counter++)
            {
                if (counter == Total_Group && Is_Last_Group_Have_Less_Than_90_Emails)
                {
                    path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Groups\\" + textBox_Groups_Name.Text + " " + counter.ToString() + "_(Contains " + (Total_Email_IDs - Mail_ID_Number).ToString() + " Mail IDs).txt";

                    FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Group Names.txt";

                    FileReadWrite.WriteInFileTextBoxContent(textBox_Groups_Name.Text + " " + counter.ToString() + "_(Contains " + (Total_Email_IDs - Mail_ID_Number).ToString() + " Mail IDs)");
                }
                else
                {
                    path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Groups\\" + textBox_Groups_Name.Text + " " + counter.ToString() + ".txt";

                    FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Group Names.txt";

                    FileReadWrite.WriteInFileTextBoxContent(textBox_Groups_Name.Text + " " + counter.ToString());
                }

                // Create a file to write to.
                using (StreamWriter sw = File.CreateText(path))
                {
                    for (counter2 = 1; counter2 <= 90; counter2++)
                    {
                        sw.WriteLine(Mail_IDs_Collection[Mail_ID_Number]);
                        Mail_ID_Number++;

                        progressBar1.PerformStep();
                        if (Mail_ID_Number == Total_Email_IDs)
                        {
                            break;
                        }
                    }
                }
            }

            MessageBox.Show("All Mail Ids Added Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            textBox_Groups_Name.Clear();
            richTextBox_Bulk_Email_IDs.Clear();
            progressBar1.Value = 0;
        }