protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ViewContact);

            // Get passed information
            string[] splitName = Intent.GetStringExtra("contact").Split('/');
            contactName = splitName[splitName.Length - 1];
            //Toast.MakeText(ApplicationContext, contactName, ToastLength.Long).Show();

            // Set the global UI variables here
            getMessagesBtn     = FindViewById <Button>(Resource.Id.button1);
            generateEntropyBtn = FindViewById <Button>(Resource.Id.button2);
            messageText        = FindViewById <TextView>(Resource.Id.textView1);
            sendMessageText    = FindViewById <EditText>(Resource.Id.editText1);
            sendMessageBtn     = FindViewById <Button>(Resource.Id.button3);

            getMessagesBtn.Click     += GetMessagesBtn_Click;
            sendMessageBtn.Click     += SendMessageBtn_Click;
            generateEntropyBtn.Click += GenKeyBtn_Click;

            // Instantiate the WebClient we will be using to make requests to the API
            wc = new WebClient();

            // Initialize pad manager
            pm = new PadManager(GetExternalFilesDir(null).ToString());
            Toast.MakeText(ApplicationContext, contactName, ToastLength.Long).Show();
        }
Exemplo n.º 2
0
        protected override void OnResume()
        {
            base.OnResume();

            if (keys == null)
            {
                keys = new System.Collections.Generic.List <string>();
            }

            if (NfcAdapter.ActionNdefDiscovered == Intent.Action)
            {
                ProcessIntent(Intent);
            }
            if (progBar.Progress < 100 && _sensorManager == null)
            {
                registerSensors(); //reset sensors on resume
            }
            if (pm == null)
            {
                pm = new PadManager(GetExternalFilesDir(null).ToString());
            }
        }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.KeyGen);

            text        = FindViewById <TextView>(Resource.Id.textView1);
            progBar     = FindViewById <ProgressBar>(Resource.Id.progBar);
            finishedGen = FindViewById <Button>(Resource.Id.button1);
            startGen    = FindViewById <Button>(Resource.Id.button2);

            pm   = new PadManager(GetExternalFilesDir(null).ToString());
            keys = new System.Collections.Generic.List <string>();


            SetProgressBarIndeterminate(false);
            progBar.Progress    = 0;
            progBar.Max         = 100;
            finishedGen.Enabled = false;
            startGen.Click     += StartGen_Click;
            finishedGen.Click  += StartNfc_Click;

            _nfcAdapter = NfcAdapter.GetDefaultAdapter(this);
            if (_nfcAdapter == null)
            {
                text.Text = "NFC not available";
            }
            if (pm == null)
            {
                text.Text = "Pad manager is null";
            }

            // Get the contact name passed in through the intent when ViewContactActivity launches this intent
            contactName = Intent.GetStringExtra("contactName"); // stored in key "contactName"
            Identity.LoadUsername(GetExternalFilesDir(null).ToString());
            myName    = Identity.Username;
            text.Text = contactName;
        }