public override void ViewDidLoad() { PullToRefresh = false; base.ViewDidLoad(); TableSource = new MyOutletsTableViewSource(); TableSource.ItemSelected += (NSIndexPath arg1, Outlet arg2) => { OutletSelected?.Invoke(arg2); }; TableSource.RowDeleted += (NSIndexPath arg1, Outlet arg2) => { RealmServices.DeleteOutlet(arg2); TableSource.TableItems = RealmServices.GetMyOutlets(); }; TableView.Source = TableSource; var label = LabelWithActivityIndicatorView.Create(); label.BindDataToView("No Outlets", true); TableViewEmptyBackground = label; AddRowViewController FooterView = new AddRowViewController(); FooterView.LabelAddText = Strings.TableViewFooters.table_view_footer_create_new_outlet; FooterView.Clicked += (editing) => { CATransition transition = CATransition.CreateAnimation(); transition.Duration = 0.3; transition.Type = CATransition.TransitionFade; NavigationController.View.Layer.AddAnimation(transition, null); NavigationController.PushViewController(new NewOutletViewController(), false); }; FooterView.View.Frame = new CGRect(0, 0, TableView.Frame.Width, FooterView.GetHeight()); TableView.TableFooterView = FooterView.View; AddChildViewController(FooterView); }
public override void ViewDidLoad() { PullToRefresh = false; base.ViewDidLoad(); TableSource = new NewCardTableViewSource(); TableSource.ItemSelected += (NSIndexPath arg1, NewCardModel arg2) => { if (arg2 == null || String.IsNullOrEmpty(arg2.Title)) { return; } var vc = new ColorPickerViewController(); vc.ModalPresentationStyle = UIModalPresentationStyle.OverFullScreen; vc.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve; vc.LabelTitle = arg2.Title; vc.StartingColor = ColorUtils.FromHexString(arg2.ColorHexString, UIColor.White); vc.ColorPicked += (UIColor obj) => { if (obj == null && String.IsNullOrEmpty(arg2.Title)) { return; } arg2.ColorHexString = ColorUtils.HexStringFromColor(obj); if (arg2.Title.Equals(NewCardShared.new_card_model_border_color, StringComparison.InvariantCultureIgnoreCase)) { Shared.SelectedCard.UpdateStringProperty(() => Shared.SelectedCard.BorderColor, arg2.ColorHexString); Shared.SelectedCard.ShowFront(); } else if (arg2.Title.Equals(NewCardShared.new_card_model_background_color, StringComparison.InvariantCultureIgnoreCase)) { Shared.SelectedCard.UpdateStringProperty(() => Shared.SelectedCard.BackgroundColor, arg2.ColorHexString); Shared.SelectedCard.ShowBack(); } else if (arg2.Title.Equals(NewCardShared.new_card_model_company_name_text_color, StringComparison.InvariantCultureIgnoreCase)) { Shared.SelectedCard.UpdateStringProperty(() => Shared.SelectedCard.CompanyNameTextColor, arg2.ColorHexString); Shared.SelectedCard.ShowBack(); } HeaderView.Update(false); TableView.ReloadRows(new NSIndexPath[] { arg1 }, UITableViewRowAnimation.Automatic); }; var flyingObjectsContainerViewController = new FlyingObjectsContainterViewController(); var clearNavigationController = flyingObjectsContainerViewController.ContainerNavigationController; clearNavigationController.SetViewControllers(new UIViewController[] { vc }, false); PresentViewController(flyingObjectsContainerViewController, false, null); }; TableSource.RowDeleted += (NSIndexPath arg1, NewCardModel arg2) => { if (arg2.Outlet == null) { return; } Shared.SelectedCard.RemoveOutlet(arg2.Outlet); TableSource.TableItems.Remove(arg2); HeaderView.Update(false); }; TableView.Source = TableSource; HeaderView.Editable = true; HeaderView.SelectedCard = Shared.SelectedCard; HeaderView.View.Frame = new CGRect(0, 0, TableView.Frame.Width, CardViewController.GetCalculatedHeight()); AddChildViewController(HeaderView); TableView.TableHeaderView = HeaderView.View; AddRowViewController FooterView = new AddRowViewController(); FooterView.LabelAddText = NewCardShared.AddNewOutlet; FooterView.Clicked += (editing) => { ShowMyOutletsViewController(); }; FooterView.View.Frame = new CGRect(0, 0, TableView.Frame.Width, FooterView.GetHeight()); TableView.TableFooterView = FooterView.View; AddChildViewController(FooterView); }
public override void ViewDidLoad() { PullToRefresh = false; base.ViewDidLoad(); TableSource = new MyCardsTableViewSource(); TableSource.ItemSelected += (NSIndexPath arg1, Card arg2) => { var vc = new SharingViewController(); (vc.TargetViewController as SharingTableViewController).Shared.SelectedCard = arg2; ApplicationExtensions.PushViewController(vc, true); }; TableView.Source = TableSource; TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; var label = LabelWithActivityIndicatorView.Create(); label.BindDataToView("No Cards", true); TableViewEmptyBackground = label; AddRowViewController FooterView = new AddRowViewController(); FooterView.LabelAddText = MyCardsShared.CreateNewCard; FooterView.Clicked += (editingCreateNewCard) => { var vc = new NewCardViewController(); (vc.TargetViewController as NewCardTableViewController).Shared.SelectedCard = Card.Create(); ApplicationExtensions.PushViewController(vc, true); }; FooterView.View.Frame = new CGRect(0, 0, TableView.Frame.Width, FooterView.GetHeight()); TableView.TableFooterView = FooterView.View; AddChildViewController(FooterView); var swipeGesture = new UISwipeGestureRecognizer((obj) => { var swipeLocatioin = obj.LocationInView(TableView); var indexPath = TableView.IndexPathForRowAtPoint(swipeLocatioin); if (indexPath == null) { return; } var cell = TableView.CellAt(indexPath) as MyCardsTableViewCell; if (cell == null) { return; } var model = TableSource.GetModelInList(indexPath); if (model == null) { return; } cell.Flip(model); }); swipeGesture.Direction = UISwipeGestureRecognizerDirection.Left | UISwipeGestureRecognizerDirection.Right; TableView.AddGestureRecognizer(swipeGesture); }