Ejemplo n.º 1
0
        private void OnEditSketchActivityResult([GeneratedEnum] Result resultCode, Intent data)
        {
            if (resultCode == Result.Ok)
            {
                var strPath = data.GetString(IntentExtensions.Extras.SignatureUriPath);

                if (Sketch == null)
                {
                    Sketch = new WcfService.SerialisablePhotoThumbnail()
                    {
                    };
                }
                Sketch.UriPath = strPath;
                var uriImage = Code.URI.FromPath(strPath);

                imgSketch.SetImageAutoScale(uriImage.GetImage(this));
                IsDirty = true;
            }
        }
Ejemplo n.º 2
0
        private void LoadAndPopulate()
        {
            CurrentMode = (Mode)Intent.GetIntExtra("Mode", (int)Mode.Create);
            string uid = Intent.GetStringExtra("FormUID");

            mguidFormUID = Guid.Parse(uid);

            if (Sketch == null)
            {
                Sketch = new WcfService.SerialisablePhotoThumbnail()
                {
                };
            }

            try
            {
                ctlSurveySheetRoom.mFormUID = mguidFormUID;
                ctlSurveySheetRoom.LoadData(LoggedInUser, mguidFormUID);
                ctlSurveySheetRoom.OnDataLoaded();
            }
            catch (Exception ex)
            {
                new AlertDialog.Builder(this)
                .SetIcon(Resource.Drawable.Icon)
                .SetTitle("Item list could not be loaded.")
                .SetMessage("An unexpected error occurred and the list of items on the form could not be loaded")
                .SetNeutralButton("OK.", (sender, args) => { })
                .Show();
            }

            btnUpload.Enabled = false;
            Android.Net.ConnectivityManager mngrCheckConnectivity = (Android.Net.ConnectivityManager)GetSystemService(Context.ConnectivityService);
            Android.Net.NetworkInfo         CheckActiveConnection = mngrCheckConnectivity.ActiveNetworkInfo;
            if (CheckActiveConnection != null)
            {
                btnUpload.Enabled = true;
            }

            //load and populate here for edit and view modes
            if (CurrentMode != Mode.Create)
            {
                ModeSwitch.Visibility = ViewStates.Visible;
                btnDelete.Visibility  = ViewStates.Visible;

                mobjForm = new BusinessLogic.SurveySheet();
                mobjForm.Load(mguidFormUID);

                txtSheetName.Text         = mobjForm.SheetName;
                txtDate.Text              = mobjForm.Date != DateTime.MinValue ? mobjForm.Date.ToShortDateString() : string.Empty;
                txtJobNumber.Text         = mobjForm.JobNumber;
                txtAddress.Text           = mobjForm.Address;
                txtClient.Text            = mobjForm.Client;
                txtSurveyor.Text          = mobjForm.Surveyor;
                txtTotalSamplesTaken.Text = mobjForm.TotalSamplesTaken.ToString();
                txtReasonForSurvey.Text   = mobjForm.ReasonForSurvey;
                txtWater.Text             = mobjForm.Water;
                txtPower.Text             = mobjForm.Power;
                txtParking.Text           = mobjForm.Parking;
                txtGeneralComments.Text   = mobjForm.GeneralComments;

                if (mobjForm.SketchPath != null || !string.IsNullOrWhiteSpace(mobjForm.SketchPath))
                {
                    Sketch.UriPath = mobjForm.SketchPath;
                    var uriImage = Code.URI.FromPath(Sketch.UriPath);
                    imgSketch.SetImageAutoScale(uriImage.GetImage(this));
                }

                switchMode(CurrentMode);
            }
            else
            {
                txtSheetName.Text = "Survey Sheet - " + LoggedInUser.Name;
                txtDate.Text      = DateTime.Now.ToShortDateString();
            }
        }