// Define the view
        private void SetMainView()
        {
            // Set our view from the "Creation" layout resource
            SetContentView(Resource.Layout.Creation);

            // Hide the bloody keyboard by default ?
            Window.SetSoftInputMode(SoftInput.StateAlwaysHidden);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.Save);

            button.Click += Save_Click;
            button        = FindViewById <Button>(Resource.Id.BtnQuit);
            button.Click += Cancel_Click;
            button        = FindViewById <Button>(Resource.Id.btnCoord);
            button.Click += btnCoord_Click;
            button        = FindViewById <Button>(Resource.Id.PickMap);
            button.Click += PickMap_Click;

            // This button is not used anymore
            ImageButton btnimg = FindViewById <ImageButton>(Resource.Id.UpdateEmails);

            btnimg.Visibility = ViewStates.Invisible;
            // If we have no emails, hide the stuff immediately
            if ((_emails == null) || (_emails.Count == 0))
            {
                // Hide the spinner and associated label
                Spinner spinner = FindViewById <Spinner>(Resource.Id.spinnerEmail);
                spinner.Visibility = ViewStates.Invisible;
                TextView txt = FindViewById <TextView>(Resource.Id.lblEmail);
                txt.Visibility = ViewStates.Invisible;
                ImageView img = FindViewById <ImageView>(Resource.Id.imageEmail);
                img.Visibility = ViewStates.Invisible;
            }
            else
            {
                PopulateSpinnerWithEmails(_emails.ToList());
            }

            // Adapter
            _fa = new TypeCacheAdapter(this, new List <TypeCache>());
            var gridview = FindViewById <GridView>(Resource.Id.gridview);

            gridview.Adapter    = _fa;
            gridview.ItemClick += dataview_ItemClick;

            // Create initial list of supported caches
            _allowedtypes = new List <Tuple <int, string, List <string>, int> >
            {
#if (FULL)
                Tuple.Create(2, "Traditional Cache", new List <string>(new string[] { "ctl00$ContentBody$LogNotify$cblLogTypeList$6" }), Resource.Drawable.Tradi),
#endif
                Tuple.Create(3, "Multi-cache", new List <string>(new string[] { "ctl00$ContentBody$LogNotify$cblLogTypeList$6" }), Resource.Drawable.Multi),

                Tuple.Create(8, "Unknown Cache", new List <string>(new string[] { "ctl00$ContentBody$LogNotify$cblLogTypeList$6" }), Resource.Drawable.Unknown),
                Tuple.Create(137, "Earthcache", new List <string>(new string[] { "ctl00$ContentBody$LogNotify$cblLogTypeList$6" }), Resource.Drawable.Earth),
                Tuple.Create(5, "Letterbox Hybrid", new List <string>(new string[] { "ctl00$ContentBody$LogNotify$cblLogTypeList$6" }), Resource.Drawable.Letterbox),
                Tuple.Create(1858, "Wherigo Cache", new List <string>(new string[] { "ctl00$ContentBody$LogNotify$cblLogTypeList$6" }), Resource.Drawable.Wherigo),
                Tuple.Create(4, "Virtual Cache", new List <string>(new string[] { "ctl00$ContentBody$LogNotify$cblLogTypeList$6" }), Resource.Drawable.Virtual),

                Tuple.Create(13, "Cache In Trash Out Event", new List <string>(new string[] { "ctl00$ContentBody$LogNotify$cblLogTypeList$7" }), Resource.Drawable.CITO),
                Tuple.Create(6, "Event Cache", new List <string>(new string[] { "ctl00$ContentBody$LogNotify$cblLogTypeList$7" }), Resource.Drawable.Event),
                Tuple.Create(453, "Mega-Event Cache", new List <string>(new string[] { "ctl00$ContentBody$LogNotify$cblLogTypeList$7" }), Resource.Drawable.Mega),
                Tuple.Create(7005, "Giga-Event Cache", new List <string>(new string[] { "ctl00$ContentBody$LogNotify$cblLogTypeList$7" }), Resource.Drawable.Giga)
            };

#if (LITE)
            Toast.MakeText(this, this.Resources.GetString(Resource.String.OnlyFullTypes), ToastLength.Long).Show();
#endif
            foreach (var tpl in _allowedtypes)
            {
                _typecaches.Add(new TypeCache(tpl.Item2, tpl.Item4));
            }

            // Pass these notifications to the adapter
            _fa.DisplayedTypeCaches = _typecaches;

            // Notify adapter that notifications changed to trigger refresh
            _fa.NotifyDataSetChanged();

            // Store edits for coordinates
            txtCoord              = FindViewById <EditText>(Resource.Id.editCoord);
            lblCoordAllValues     = FindViewById <TextView>(Resource.Id.lblCoordAllValues);
            txtCoord.TextChanged += (sender, e) =>
            {
                lblCoordAllValues.Text = GCStuffs.ConvertCoordinates(txtCoord.Text);
            };

            // Now we perform time consumming activities
            // chec GC account
            // retrieve emails from GC.com
            ThreadPool.QueueUserWorkItem(o => PerformGCActions(null));
        }
Exemple #2
0
 public void AfterTextChanged(IEditable s)
 {
     // update all the 3 coords formats
     et_.Text = GCStuffs.ConvertCoordinates(et_.Text);
 }
Exemple #3
0
        // Define the view
        private void SetMainView()
        {
            // Set our view from the "UpdateCoordLayout" layout resource
            SetContentView(Resource.Layout.UpdateCoordLayout);

            // Get params
            if (Intent.Extras != null)
            {
                _ids = Intent.Extras.GetStringArrayList("selectionids") ?? new string[0];
            }

            // Check validity of parameter
            if ((_ids != null) && (_ids.Count != 0))
            {
                // List is valid, we continue
            }
            else
            {
                // Nothing to do
                // Execute cancel operation
                var intent = new Intent(this, typeof(MainActivity));
                SetResult(Result.Canceled, intent);
                Finish();
            }

            // Hide the bloody keyboard by default ?
            Window.SetSoftInputMode(SoftInput.StateAlwaysHidden);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.Save);

            button.Click += Save_Click;
            button        = FindViewById <Button>(Resource.Id.BtnQuit);
            button.Click += Cancel_Click;
            button        = FindViewById <Button>(Resource.Id.btnCoord);
            button.Click += btnCoord_Click;
            button        = FindViewById <Button>(Resource.Id.PickMap);
            button.Click += PickMap_Click;

            // Store edits for coordinates
            txtCoord              = FindViewById <EditText>(Resource.Id.editCoord);
            lblCoordAllValues     = FindViewById <TextView>(Resource.Id.lblCoordAllValues);
            txtCoord.TextChanged += (sender, e) =>
            {
                lblCoordAllValues.Text = GCStuffs.ConvertCoordinates(txtCoord.Text);
            };

            // Now we perform time consumming activities
            // chec GC account
            ProgressDialog progressDialog = new ProgressDialog(this);

            progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner);
            progressDialog.SetMessage(this.Resources.GetString(Resource.String.LblInitInProgress));
            progressDialog.SetTitle(this.Resources.GetString(Resource.String.OperationInProgress));
            progressDialog.Indeterminate = true;
            progressDialog.SetCancelable(false);
            progressDialog.Show();

            ThreadPool.QueueUserWorkItem(o => PerformInit(progressDialog));
        }