protected override async void OnCreate(Bundle savedInstanceState) { //EMILY TEST TWO MWHAHAHAHAHHAHAHA base.OnCreate(savedInstanceState); var acquaintanceDetailLayout = LayoutInflater.Inflate(Resource.Layout.AcquaintanceDetail, null); SetContentView(acquaintanceDetailLayout); SetSupportActionBar(FindViewById <Toolbar>(Resource.Id.toolbar)); // ensure that the system bar color gets drawn Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); // enable the back button in the action bar SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // extract the acquaintance id fomr the intent var acquaintanceId = Intent.GetStringExtra(GetString(Resource.String.acquaintanceDetailIntentKey)); // fetch the acquaintance based on the id _Acquaintance = await _AcquaintanceDataSource.GetItem(acquaintanceId); // set the activity title and action bar title Title = SupportActionBar.Title = _Acquaintance.DisplayName; SetupViews(acquaintanceDetailLayout, savedInstanceState); SetupAnimations(); }
/// <summary> /// Update the cell's child views' values and presentation. /// </summary> /// <param name="acquaintance">Acquaintance.</param> public void Update(Acquaintance acquaintance) { // use FFImageLoading library to: ImageService.Instance .LoadFileFromApplicationBundle(String.Format(acquaintance.PhotoUrl)) // get the image from the app bundle .LoadingPlaceholder("placeholderProfileImage.png") // specify a placeholder image .Transform(new CircleTransformation()) // transform the image to a circle .Into(ProfilePhotoImageView); // load the image into the UIImageView // use FFImageLoading library to asynchronously: // ImageService // .LoadUrl(acquaintance.SmallPhotoUrl) // get the image from a URL // .LoadingPlaceholder("placeholderProfileImage.png") // specify a placeholder image // .Transform(new CircleTransformation()) // transform the image to a circle // .IntoAsync(ProfilePhotoImageView); // load the image into the UIImageView NameLabel.Text = acquaintance.DisplayLastNameFirst; CompanyLabel.Text = acquaintance.Company; JobTitleLabel.Text = acquaintance.JobTitle; // set disclousure indicator accessory for the cell Accessory = UITableViewCellAccessory.DisclosureIndicator; // add the colored border to the image double min = Math.Min(ProfilePhotoImageView.Frame.Height, ProfilePhotoImageView.Frame.Height); ProfilePhotoImageView.Layer.CornerRadius = (float)(min / 2.0); ProfilePhotoImageView.Layer.MasksToBounds = false; ProfilePhotoImageView.Layer.BorderColor = UIColor.FromRGB(84, 119, 153).CGColor; ProfilePhotoImageView.Layer.BorderWidth = 3; ProfilePhotoImageView.BackgroundColor = UIColor.Clear; ProfilePhotoImageView.ClipsToBounds = true; }
public AcquaintanceDetailViewModel(Acquaintance acquaintance = null) { _CapabilityService = DependencyService.Get <ICapabilityService>(); _Geocoder = new Geocoder(); if (acquaintance == null) { _IsNewAcquaintance = true; Acquaintance = new Acquaintance(); } else { _IsNewAcquaintance = false; Acquaintance = acquaintance; } Title = _IsNewAcquaintance ? "New Acquaintance" : _Acquaintance.DisplayLastNameFirst; _AddressString = Acquaintance.AddressString; SubscribeToSaveAcquaintanceMessages(); SubscribeToAcquaintanceLocationUpdatedMessages(); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var acquaintanceEditLayout = LayoutInflater.Inflate(Resource.Layout.AcquaintanceEdit, null); SetContentView(acquaintanceEditLayout); SetSupportActionBar(FindViewById <Toolbar>(Resource.Id.toolbar)); // ensure that the system bar color gets drawn Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); // enable the back button in the action bar SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // extract the acquaintance id from the intent var acquaintanceId = Intent.GetStringExtra(GetString(Resource.String.acquaintanceEditIntentKey)); // fetch the acquaintance based on the id _Acquaintance = await MainApplication.AcquaintanceDataSource.GetItem(acquaintanceId); Title = SupportActionBar.Title = ""; SetupViews(acquaintanceEditLayout, savedInstanceState); }
public void SetAcquaintance(Acquaintance acquaintance, AcquaintanceTableViewController listViewController = null) { Acquaintance = acquaintance; if (listViewController != null) { _ListViewController = listViewController; } }
public AcquaintanceDetailViewModel(Acquaintance acquaintance) { _CapabilityService = DependencyService.Get <ICapabilityService>(); _Geocoder = new Geocoder(); Acquaintance = acquaintance; SubscribeToSaveAcquaintanceMessages(); }
public AcquaintanceDetailViewModel(Acquaintance acquaintance) { _CapabilityService = DependencyService.Get <ICapabilityService>(); _Geocoder = new Geocoder(); Acquaintance = acquaintance; SubscribeToSaveAcquaintanceMessages(); Analytics.TrackEvent("AcquaintanceDetail", new System.Collections.Generic.Dictionary <string, string> { { "Acquaintance", acquaintance.DisplayName } }); }
async protected override void OnResume() { base.OnResume(); // fetch the acquaintance based on the id _Acquaintance = await MainApplication.AcquaintanceDataSource.GetItem(_AcquaintanceId); // set the activity title and action bar title Title = SupportActionBar.Title = _Acquaintance.DisplayName; SetupViews(_MainLayout, _SavedInstanceState); SetupAnimations(); }
public AcquaintanceEditViewModel(Acquaintance acquaintance = null) { if (acquaintance == null) { Acquaintance = new Acquaintance(); _IsNewAcquaintance = true; } else { Mapper.Initialize(cfg => cfg.CreateMap <Acquaintance, Acquaintance>()); // Use AutoMapper to make a copy of the Acquaintance. // On the edit screen, we want to only deal with this copy until we're ready to save. // If we didn't make this copy, then the item would be updated instantaneously without saving, // by virtue of the ObservableObject type that the Acquaint model inherits from. Acquaintance = Mapper.Map <Acquaintance>(acquaintance); } }
protected override async void OnResume() { base.OnResume(); _DataSource = ServiceLocator.Current.GetInstance <IDataSource <Acquaintance> >(); // extract the acquaintance id from the intent _AcquaintanceId = Intent.GetStringExtra(GetString(Resource.String.acquaintanceDetailIntentKey)); // fetch the acquaintance based on the id _Acquaintance = await _DataSource.GetItem(_AcquaintanceId); // set the activity title and action bar title Title = SupportActionBar.Title = _Acquaintance.DisplayName; SetupViews(); SetupAnimations(); }
/// <summary> /// Update the cell's child views' values and presentation. /// </summary> /// <param name="acquaintance">Acquaintance.</param> public void Update(Acquaintance acquaintance) { // set disclousure indicator accessory for the cell Accessory = UITableViewCellAccessory.DisclosureIndicator; NameLabel.Text = acquaintance.DisplayLastNameFirst; CompanyLabel.Text = acquaintance.Company; JobTitleLabel.Text = acquaintance.JobTitle; InvokeOnMainThread(async() => { // use FFImageLoading library to asynchronously: await ImageService .Instance .LoadUrl(acquaintance.SmallPhotoUrl, TimeSpan.FromHours(Settings.ImageCacheDurationHours)) // get the image from a URL .LoadingPlaceholder("placeholderProfileImage.png") // specify a placeholder image .Transform(new CircleTransformation()) // transform the image to a circle .Error(e => System.Diagnostics.Debug.WriteLine(e.Message)) .IntoAsync(ProfilePhotoImageView); }); }
public AcquaintanceEditViewModel(Acquaintance acquaintance = null) { if (acquaintance == null) { Acquaintance = new Acquaintance(); _IsNewAcquaintance = true; } else { Mapper.Initialize(cfg => cfg.CreateMap <Acquaintance, Acquaintance>()); // Use AutoMapper to make a copy of the Acquaintance. // On the edit screen, we want to only deal with this copy until we're ready to save. // If we didn't make this copy, then the item would be updated instantaneously without saving, // by virtue of the ObservableObject type that the Acquaint model inherits from. Acquaintance = Mapper.Map <Acquaintance>(acquaintance); } Analytics.TrackEvent("AcquaintanceEdit", new System.Collections.Generic.Dictionary <string, string> { { "Acquaintance", acquaintance?.DisplayName } }); }
protected override async void OnResume() { base.OnResume(); // extract the acquaintance id from the intent var acquaintanceId = Intent.GetStringExtra(GetString(Resource.String.acquaintanceEditIntentKey)); _DataSource = ServiceLocator.Current.GetInstance <IDataSource <Acquaintance> >(); if (acquaintanceId == null) { _Acquaintance = new Acquaintance(); _IsNewAcquaintance = true; } else { // fetch the acquaintance based on the id _Acquaintance = await _DataSource.GetItem(acquaintanceId); } SetupViews(); }
public void DeleteAcquaintance(Acquaintance acquaintance) { _AcquaintanceTableViewSource.DeleteAcquaintance(acquaintance); _AcquaintanceTableViewSource.LoadAcquaintances(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { var item = e.Parameter as Acquaintance; Item = item; }
public async Task DeleteAcquaintance(Acquaintance acquaintance) { await _AcquaintanceTableViewSource.DeleteAcquaintance(acquaintance); await _AcquaintanceTableViewSource.LoadAcquaintances(); }
public void SaveAcquaintance(Acquaintance acquaintance) { Acquaintance = acquaintance; }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); _FirstNameField.Text = _Acquaintance?.FirstName; _LastNameField.Text = _Acquaintance?.LastName; _CompanyNameField.Text = _Acquaintance?.Company; _JobTitleField.Text = _Acquaintance?.JobTitle; _PhoneNumberField.Text = _Acquaintance?.Phone; _EmailAddressField.Text = _Acquaintance?.Email; _StreetField.Text = _Acquaintance?.Street; _CityField.Text = _Acquaintance?.City; _StateField.Text = _Acquaintance?.State; _ZipField.Text = _Acquaintance?.PostalCode; NavigationItem.RightBarButtonItem.Clicked += async(sender, e) => { if (string.IsNullOrWhiteSpace(_FirstNameField.Text) || string.IsNullOrWhiteSpace(_LastNameField.Text)) { UIAlertController alert = UIAlertController.Create("Invalid name!", "A acquaintance must have both a first and last name.", UIAlertControllerStyle.Alert); // cancel button alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(alert, true, null); } else if (!RequiredAddressFieldCombinationIsFilled) { UIAlertController alert = UIAlertController.Create("Invalid address!", "You must enter either a street, city, and state combination, or a postal code.", UIAlertControllerStyle.Alert); // cancel button alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(alert, true, null); } else { if (_Acquaintance == null) { _Acquaintance = new Acquaintance(); } _Acquaintance.FirstName = _FirstNameField.Text; _Acquaintance.LastName = _LastNameField.Text; _Acquaintance.Company = _CompanyNameField.Text; _Acquaintance.JobTitle = _JobTitleField.Text; _Acquaintance.Phone = _PhoneNumberField.Text; _Acquaintance.Email = _EmailAddressField.Text; _Acquaintance.Street = _StreetField.Text; _Acquaintance.City = _CityField.Text; _Acquaintance.State = _StateField.Text; _Acquaintance.PostalCode = _ZipField.Text; if (_IsNew) { await _DataSource.AddItem(_Acquaintance); } else { await _DataSource.UpdateItem(_Acquaintance); } NavigationController.PopViewController(true); } }; }
public async Task DeleteAcquaintance(Acquaintance acquaintance) { await _AcquaintanceDataSource.DeleteItem(acquaintance.Id); }
public async Task SaveAcquaintance(Acquaintance acquaintance) { await _AcquaintanceDataSource.SaveItem(acquaintance); }
public void SaveAcquaintance(Acquaintance acquaintance) { _AcquaintanceTableViewSource.SaveAcquaintance(acquaintance); _AcquaintanceTableViewSource.LoadAcquaintances(); }