public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); Title = Strings.PageTitles.page_title_select_an_outlet; var convertedDataSource = CollectionView.WeakDataSource as NewOutletCollectionViewDataSource; if (convertedDataSource != null) { convertedDataSource.CollectionItems = RealmServices.GetAllAvailableOutlets(); } CollectionView.ReloadData(); }
public override void ViewDidLoad() { base.ViewDidLoad(); RemoveBackBarButtonTitle(); CollectionView.RegisterNibForCell(UINib.FromName("NewOutletCollectionViewCell", NSBundle.MainBundle), NewOutletCollectionViewCell.Key); CollectionView.WeakDataSource = new NewOutletCollectionViewDataSource(); var delegateFlowLayout = new NewOutletCollectionViewDelegateFlowLayout(); delegateFlowLayout.ItemClicked += (UICollectionView arg1, NSIndexPath arg2) => { var items = RealmServices.GetAllAvailableOutlets(); var item = items[arg2.Row]; if (item == null) { return; } if (!item.AvailbleForAddition) { ShowDuplcateAccountAlert("For now, you can only have 1 " + item.Type + " account. We're working on it"); return; } if (item.Type.Equals(Outlet.outlet_type_phone)) { NavigationController.PushViewController(new EnterPhoneNumberViewController(), true); return; } if (item.Type.Equals(Outlet.outlet_type_email)) { NavigationController.PushViewController(new EnterEmailAddressViewController(), true); return; } if (item.Type.Equals(Outlet.outlet_type_website)) { NavigationController.PushViewController(new WebsiteViewController(), true); return; } if (item.Type.Equals(Outlet.outlet_type_facebook)) { NavigationController.PushViewController(new LoginWithFacebookViewController(), true); return; } if (item.Type.Equals(Outlet.outlet_type_linkedIn)) { NavigationController.PushViewController(new LinkedInWebViewController(), true); return; } if (item.Type.Equals(Outlet.outlet_type_github)) { NavigationController.PushViewController(new GithubWebViewController(), true); return; } if (item.Type.Equals(Outlet.outlet_type_instagram)) { NavigationController.PushViewController(new InstagramWebViewController(), true); return; } if (item.Type.Equals(Outlet.outlet_type_google)) { NavigationController.PushViewController(new LoginWithGoogleViewController(), true); return; } if (item.Type.Equals(Outlet.outlet_type_twitter)) { ShowTwitterAuthenticationFlow(); return; } if (item.Type.Equals(Outlet.outlet_type_pinterest)) { NavigationController.PushViewController(new PinterestWebViewController(), true); return; } }; CollectionView.WeakDelegate = delegateFlowLayout; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.GridView, container, false); Activity.Title = Strings.PageTitles.page_title_select_an_outlet; var gridView = view.FindViewById <GridView>(Resource.Id.GridView); gridView.ItemClick += (sender, e) => { var items = RealmServices.GetAllAvailableOutlets(); var item = items[e.Position]; if (item == null) { return; } if (!item.AvailbleForAddition) { ShowDuplcateAccountAlert("For now, you can only have 1 " + item.Type + " account. We're working on it"); return; } if (item.Type.Equals(Outlet.outlet_type_phone)) { ((BaseActivity)Activity).AddFragmentOver(new EnterPhoneNumberFragment()); return; } if (item.Type.Equals(Outlet.outlet_type_email)) { ((BaseActivity)Activity).AddFragmentOver(new EnterEmailAddressFragment()); return; } if (item.Type.Equals(Outlet.outlet_type_website)) { ((BaseActivity)Activity).AddFragmentOver(new WebsiteFragment()); return; } if (item.Type.Equals(Outlet.outlet_type_facebook)) { //NavigationController.PushViewController(new LoginWithFacebookViewController(), true); return; } if (item.Type.Equals(Outlet.outlet_type_linkedIn)) { ((BaseActivity)Activity).AddFragmentOver(new LinkedInWebViewFragment()); return; } if (item.Type.Equals(Outlet.outlet_type_github)) { ((BaseActivity)Activity).AddFragmentOver(new GithubWebViewFragment()); return; } if (item.Type.Equals(Outlet.outlet_type_instagram)) { ((BaseActivity)Activity).AddFragmentOver(new InstagramWebViewFragment()); return; } if (item.Type.Equals(Outlet.outlet_type_google)) { ((BaseActivity)Activity).AddFragmentOver(new GoogleFragment()); return; } if (item.Type.Equals(Outlet.outlet_type_twitter)) { ShowTwitterAuthenticationFlow(); return; } if (item.Type.Equals(Outlet.outlet_type_pinterest)) { ((BaseActivity)Activity).AddFragmentOver(new PinterestWebViewFragment()); return; } }; var GridViewAdapter = new NewOutletGridViewAdapter(); GridViewAdapter.Context = Activity; GridViewAdapter.ListItems = RealmServices.GetAllAvailableOutlets(); gridView.Adapter = GridViewAdapter; return(view); }