public override void ViewDidLoad() { base.ViewDidLoad(); if (((SharingTableViewController)TargetViewController).Shared.SelectedCard.IsMine()) { NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Edit, (sender, e) => { //this is used to counter the auto reload. See NewCardTableViewController Transporter.SharedInstance.RemoveObject(Transporter.NewOutletAddedTransporterKey); Transporter.SharedInstance.RemoveObject(Transporter.NewOutletAddedValueTransporterKey); var vc = new NewCardViewController(); (vc.TargetViewController as NewCardTableViewController).Shared.SelectedCard = (TargetViewController as SharingTableViewController).Shared.SelectedCard; ApplicationExtensions.PushViewController(vc, true); }); } else { NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Trash, (sender, e) => { ((SharingTableViewController)TargetViewController).Shared.DeleteCard(); NavigationController.PopViewController(true); }); } RemoveBackBarButtonTitle(); }
public override void ViewDidLoad() { PullToRefresh = false; base.ViewDidLoad(); AutomaticallyAdjustsScrollViewInsets = false; TableSource = new SettingsTableViewSource(); TableSource.ItemSelected += (NSIndexPath arg1, SettingsShared.SettingsModel arg2) => { if (arg2 == null || String.IsNullOrEmpty(arg2.Title)) { return; } if (arg2.Title.Equals(SettingsShared.navigation_item_my_outlets, StringComparison.InvariantCultureIgnoreCase)) { //this is used to counter the auto reload. See NewCardTableViewController Transporter.SharedInstance.RemoveObject(Transporter.NewOutletAddedTransporterKey); Transporter.SharedInstance.RemoveObject(Transporter.NewOutletAddedValueTransporterKey); ApplicationExtensions.PushViewController(new MyOutletsViewController(), true); return; } if (arg2.Title.Equals(SettingsShared.navigation_item_edit_profile, StringComparison.InvariantCultureIgnoreCase)) { ApplicationExtensions.PushViewController(new EditProfileViewController(), true); return; } if (arg2.Title.Equals(SettingsShared.navigation_item_design, StringComparison.InvariantCultureIgnoreCase)) { Shared.DesignChanged(); TableView.ReloadRows(new NSIndexPath[] { arg1 }, UITableViewRowAnimation.Automatic); return; } if (arg2.Title.Equals(SettingsShared.navigation_item_logout, StringComparison.InvariantCultureIgnoreCase)) { RealmUserServices.Logout(); if (Profile.CurrentProfile != null) { new LoginManager().LogOut(); } var iPersistant = ServiceLocator.Instance.Resolve <IPersistantStorage>(); iPersistant.RemoveAll(); ApplicationExtensions.LoadStoryboardRoot("Landing", false); return; } }; TableView.Source = TableSource; TableSource.SetItems(TableView, Shared.GetTableItems()); }
void ShowMyOutletsViewController() { Transporter.SharedInstance.SetObject(Transporter.NewOutletAddedTransporterKey, true); var vc = new MyOutletsViewController(); vc.OutletSelected += (Outlet obj) => { AddOutletToCard(obj, true); }; ApplicationExtensions.PushViewController(vc, true); }
public override void ViewDidLoad() { PullToRefresh = false; base.ViewDidLoad(); TableSource = new ConnectionsTableViewSource(); ((ConnectionsTableViewSource)TableSource).CardSelected += (NSIndexPath arg1, Card arg2) => { var vc = new SharingViewController(); vc.Title = arg2.Name; (vc.TargetViewController as SharingTableViewController).Shared.SelectedCard = arg2; ApplicationExtensions.PushViewController(vc, true); }; TableView.Source = TableSource; TableView.SeparatorStyle = UIKit.UITableViewCellSeparatorStyle.None; var label = LabelWithActivityIndicatorView.Create(); label.BindDataToView("No Connections", true); TableViewEmptyBackground = label; 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 = ((ConnectionsTableViewSource)TableSource).GetCardAtIndexPath(indexPath); if (model == null) { return; } cell.Flip(model); }); swipeGesture.Direction = UISwipeGestureRecognizerDirection.Left | UISwipeGestureRecognizerDirection.Right; TableView.AddGestureRecognizer(swipeGesture); }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); CollectionViewTappedNotificaion = NSNotificationCenter.DefaultCenter.AddObserver(new NSString(Strings.InternalNotifications.notification_collection_view_tapped), (obj) => { InvokeOnMainThread(() => { var indexPath = obj.Object as NSIndexPath; if (indexPath == null) { return; } var card = TableSource.GetModelInList(indexPath); var vc = new SharingViewController(); (vc.TargetViewController as SharingTableViewController).Shared.SelectedCard = card; ApplicationExtensions.PushViewController(vc, true); }); }); }
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); }