Advertisement
Guest User

Untitled

a guest
Oct 15th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. using Android.App;
  7. using Android.Content;
  8. using Android.OS;
  9. using Android.Runtime;
  10. using Android.Views;
  11. using Android.Widget;
  12.  
  13. namespace Login
  14. {
  15.     public class OnSignUpEventArgs : EventArgs
  16.     {
  17.         private string name;
  18.         private string surname;
  19.         private string email;
  20.         private string username;
  21.         private string password;
  22.  
  23.  
  24.         public string Name
  25.         {
  26.             get { return name; }
  27.             set { name = value; }
  28.         }
  29.         public string Surname
  30.         {
  31.             get { return surname; }
  32.             set { surname = value; }
  33.         }
  34.         public string Email
  35.         {
  36.             get { return email; }
  37.             set { email = value; }
  38.         }
  39.         public string Username
  40.         {
  41.             get { return username; }
  42.             set { username = value; }
  43.         }
  44.         public string Password
  45.         {
  46.             get { return password; }
  47.             set { password = value; }
  48.         }
  49.  
  50.  
  51.         public OnSignUpEventArgs(string name, string surname, string email, string username,string password ):base()
  52.         {
  53.             this.name = name;
  54.             this.surname = surname;
  55.             this.email = email;
  56.             this.username = username;
  57.             this.password = password;
  58.  
  59.         }
  60.        
  61.     }
  62.     public class Dialog : DialogFragment
  63.     {
  64.         private EditText name;
  65.         private EditText surname;
  66.         private EditText email;
  67.         private EditText username;
  68.         private EditText password;
  69.         private Button signUpBtn;
  70.  
  71.         public EventHandler<OnSignUpEventArgs> signUpComplete;
  72.         public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
  73.         {
  74.              base.OnCreateView(inflater, container, savedInstanceState);
  75.             var view = inflater.Inflate(Resource.Layout.dialog_sign_up, container, false);
  76.  
  77.             name = view.FindViewById<EditText>(Resource.Id.popup_name);
  78.             surname = view.FindViewById<EditText>(Resource.Id.popup_surname);
  79.             email = view.FindViewById<EditText>(Resource.Id.popup_email);
  80.             username = view.FindViewById<EditText>(Resource.Id.popup_username);
  81.             password = view.FindViewById<EditText>(Resource.Id.popup_password);
  82.            
  83.          
  84.  
  85.             signUpBtn = view.FindViewById<Button>(Resource.Id.popup_register_button);
  86.  
  87.             signUpBtn.Click += SignUpBtn_Click;
  88.  
  89.             return view;
  90.         }
  91.  
  92.         private void SignUpBtn_Click(object sender, EventArgs e)
  93.         {
  94.            
  95.                 signUpComplete.Invoke(this, new OnSignUpEventArgs(name.Text, surname.Text, username.Text, email.Text, password.Text));
  96.                 this.Dismiss();
  97.            
  98.         }
  99.  
  100.         public override void OnActivityCreated(Bundle savedInstanceState)
  101.         {
  102.             Dialog.Window.RequestFeature(WindowFeatures.NoTitle);
  103.             base.OnActivityCreated(savedInstanceState);
  104.             Dialog.Window.Attributes.WindowAnimations = Resource.Style.dialog_anim;
  105.         }
  106.  
  107.  
  108.      
  109.     }
  110.    
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement