Exemplo n.º 1
0
        private void RetrieveDBMail()
        {
            EmailsToRead = "";
            DBManagerHelper dbmgr      = new DBManagerHelper(this);
            DatabaseUpdates tblEmail   = new DatabaseUpdates();
            var             eListAdapt = new EmailListAdapter(this, tblEmail.EmailOBJ());

            eListAdapt.NotifyDataSetChanged();

            var emailListView = FindViewById <ListView>(Resource.Id.lvEmailList);

            emailListView.Adapter = eListAdapt;
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.EmailForm);
            // Create your application here

            isRecording = false;

            //initialize speech to text (input)
            InitSTTMethod();
            //initialize text to speech (read/speak)
            InitTTSMethod();

            var backButton = FindViewById <Button>(Resource.Id.btnBackEmailForm);

            backButton.Click += delegate { Finish(); };


            var btnGetEmails = FindViewById <Button>(Resource.Id.btnGetMailPOP3EmailForm);

            btnGetEmails.Click += delegate
            {
                var progressDialog = ProgressDialog.Show(this, "Please wait...", "Connecting to GDSS Mail Server", true);
                progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner);
                new Thread(new ThreadStart(delegate
                {
                    //LOAD METHOD TO GET ACCOUNT INFO
                    RunOnUiThread(() => {
                        Toast.MakeText(this, "Email Sync: Connecting to Server", ToastLength.Long).Show();
                    });
                    //RetrievePOP3Mail();
                    RunOnUiThread(() => RetrievePOP3Mail());
                    RunOnUiThread(() => {
                        Toast.MakeText(this, "Email Sync: Successful", ToastLength.Long).Show();
                    });
                    RunOnUiThread(() => RetrieveDBMail());
                    //HIDE PROGRESS DIALOG
                    RunOnUiThread(() => progressDialog.Hide());
                })).Start();
            };

            var btnResetEmailForm = FindViewById <Button>(Resource.Id.btnResetEmailForm);

            btnResetEmailForm.Click += delegate
            {
                Finish();
                StartActivity(typeof(EmailActivity));
            };

            var lvEmail = FindViewById <ListView>(Resource.Id.lvEmailList);

            lvEmail.ItemClick += (sender, e) => {
                EmailListAdapter EmailList = ((EmailListAdapter)lvEmail.Adapter);
                EmailObject      item      = EmailList[e.Position];

                var actEmalReader = new Intent(this, typeof(EmailReaderActivity));
                actEmalReader.PutExtra("emlFrom", item.From);
                actEmalReader.PutExtra("emlCC", item.CC);
                actEmalReader.PutExtra("emlDate", item.date.ToString());
                actEmalReader.PutExtra("emlSubject", item.Subject);
                actEmalReader.PutExtra("emlBody", item.Body);
                actEmalReader.PutExtra("curPos", e.Position);
                actEmalReader.PutExtra("maxPos", EmailList.Count);
                actEmalReader.PutExtra("autoRead", 1);
                actEmalReader.SetFlags(ActivityFlags.ReorderToFront);
                StartActivity(actEmalReader);
            };

            ActivityStatus = "Created";

            RetrieveDBMail();
        }