コード例 #1
0
 private void Compose_Message(object sender, RoutedEventArgs e)
 {
     currentwindow = this;
     currentwindow.Hide();
     composemessage = new ComposeMessage(email, password, currentwindow);
     composemessage.Show();
 }
コード例 #2
0
 /// <summary>
 /// When Open are Delete button is clicked for each mail.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Open_Message(object sender, RoutedEventArgs e)
 {
     currentwindow = this;
     currentwindow.Hide();
     openmessage = new OpenMessage(email, password, username, currentwindow, ((Button)sender).Tag.ToString());
     openmessage.Show();
 }
コード例 #3
0
 public ComposeMessage(String email, String password, AfterLogin prev_window, String subject = "Subject", String content = "Your Message goes here...")
 {
     InitializeComponent();
     this.email            = email;
     this.password         = password;
     original_message.Text = content;
     this.subject.Text     = subject;
     previouswindow        = prev_window;
 }
コード例 #4
0
 public OpenMessage(String email, String password, String username, AfterLogin prev_window, String id)
 {
     InitializeComponent();
     this.email     = email;
     this.password  = password;
     this.id        = int.Parse(id);
     this.username  = username;
     previouswindow = prev_window;
     OpenMessageText();
 }
コード例 #5
0
        private void Handle()
        {
            String email = "";

            Email.Dispatcher.Invoke(new Action(() => email = Email.Text.ToLower()));
            String password = "";

            TPassword.Dispatcher.Invoke(new Action(() => password = TPassword.Password));
            if (SecureTravel.Signup.IsValidEmail(email) == false)
            {
                DisplayWarning("Not a valid Mail id!");
                this.Dispatcher.Invoke(new Action(() => Loginbt.IsEnabled  = true));
                this.Dispatcher.Invoke(new Action(() => forgotbt.IsEnabled = true));
                this.Dispatcher.Invoke(new Action(() => signupbt.IsEnabled = true));
                return;
            }
            if (password.Equals(""))
            {
                DisplayWarning("Password is empty!");
                this.Dispatcher.Invoke(new Action(() => Loginbt.IsEnabled  = true));
                this.Dispatcher.Invoke(new Action(() => forgotbt.IsEnabled = true));
                this.Dispatcher.Invoke(new Action(() => signupbt.IsEnabled = true));
                return;
            }
            Client     = new MongoClient("mongodb://*****:*****@ds016068.mlab.com:16068/securetravel");
            Database   = Client.GetDatabase("securetravel");
            Collection = Database.GetCollection <BsonDocument>("user");
            var builder = Builders <BsonDocument> .Filter;
            var filter  = builder.Eq("mailid", email) & builder.Eq("password", Hash(password));

            results = Collection.Find(filter).ToList();
            if (results.Count == 1)
            {
                this.Dispatcher.Invoke(new Action(() => afterlogin = new AfterLogin(email, password, results[0]["username"].ToString())));
                afterlogin.Dispatcher.Invoke(new Action(() => afterlogin.Show()));
                this.Dispatcher.Invoke(new Action(() => this.Close()));
            }
            else
            {
                DisplayWarning("Mail id or Password is wrong");
                this.Dispatcher.Invoke(new Action(() => Loginbt.IsEnabled  = true));
                this.Dispatcher.Invoke(new Action(() => forgotbt.IsEnabled = true));
                this.Dispatcher.Invoke(new Action(() => signupbt.IsEnabled = true));
            }
        }