protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         HeaderView?.Dispose();
         HeaderView = null;
     }
 }
        public override void ViewDidLoad()
        {
            PullToRefresh = false;

            base.ViewDidLoad();

            TableSource = new SharingTableViewSource();
            ((SharingTableViewSource)TableSource).ShowsAccessory = Shared.SelectedCard.IsMine();
            TableSource.ItemSelected += (arg1, arg2) =>
            {
                if (Shared.SelectedCard.IsMine())
                {
                    var footer = ChildViewControllers.Where(c => c.GetType() == typeof(CardSharingStatusViewController)).FirstOrDefault() as CardSharingStatusViewController;
                    if (footer == null)
                    {
                        return;
                    }
                    if (footer.Sharing)
                    {
                        return;
                    }

                    Shared.OutletSelected(arg2);
                    TableView.ReloadRows(new NSIndexPath[] { arg1 }, UITableViewRowAnimation.Automatic);

                    HeaderView.Update(false);

                    footer.Update();
                    return;
                }

                ApplicationExtensions.OpenApplicationFromOutlet(arg2);
            };
            TableView.Source = TableSource;

            HeaderView = new CardViewController();
            HeaderView.SelectedCard   = Shared.SelectedCard;
            HeaderView.View.Frame     = new CGRect(0, 0, TableView.Frame.Width, CardViewController.GetCalculatedHeight());
            TableView.TableHeaderView = HeaderView.View;
            AddChildViewController(HeaderView);
            HeaderView.DidMoveToParentViewController(this);

            if (Shared.SelectedCard.IsMine())
            {
                CardSharingStatusViewController footerView = new CardSharingStatusViewController();
                footerView.SelectedCard   = Shared.SelectedCard;
                footerView.View.Frame     = new CGRect(0, 0, TableView.Frame.Width, footerView.GetHeight());
                TableView.TableFooterView = footerView.View;
                AddChildViewController(footerView);
            }
        }
Exemple #3
0
        public override void ViewDidLoad()
        {
            LocationEnabled = true;

            base.ViewDidLoad();

            //adds a stationary circle around phone
            CAShapeLayer first = new CAShapeLayer();

            first.Bounds      = new CGRect(0, 0, PhoneImageView.Frame.Width, PhoneImageView.Frame.Height);
            first.Position    = new CGPoint(PhoneImageView.Frame.Width / 2, PhoneImageView.Frame.Height / 2);
            first.Path        = UIBezierPath.FromOval(PhoneImageView.Bounds).CGPath;
            first.StrokeColor = UIColor.White.CGColor;
            first.LineWidth   = (nfloat)1;
            first.FillColor   = UIColor.Clear.CGColor;
            PhoneImageView.Layer.AddSublayer(first);

            //Wire up events
            DemoCardView = new UIView();
            DemoCardView.BackgroundColor = UIColor.Clear;

            DemoCardSuperviewHeightConstraint.Constant = CardViewController.GetCalculatedHeight();
            DemoCardSuperview.AddSubview(DemoCardView);
            DemoCardSuperview.SetNeedsLayout();
            DemoCardSuperview.LayoutIfNeeded();
            DemoCardSuperview.BackgroundColor = UIColor.Clear;

            StatusButton.Hidden = true;
            StatusButton.TitleLabel.TextAlignment = UITextAlignment.Center;
            StatusButton.TitleLabel.LineBreakMode = UILineBreakMode.WordWrap;
            StatusButton.TitleLabel.Lines         = 2;

            RightArrowImageView.Transform = CGAffineTransform.MakeScale(-1, 1);

            HideCardViews(true);

            //clear notifications
            var persistantStorageService = ServiceLocator.Instance.Resolve <IPersistantStorage>();

            persistantStorageService.SetDiscoverNotificaionCount(0);


            if (IsSufficentPermissionGranted())
            {
                var service = ServiceRunner.SharedInstance.FetchService <GeolocatorService>();
                service.Start();
            }

            StartLocationManager();
        }
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (disposing)
            {
                HeaderView?.Dispose();
                HeaderView = null;

                TableViewCardEditingChangedNotification?.Dispose();
                TableViewCardEditingChangedNotification = null;

                NoOutletsTappedNotification?.Dispose();
                NoOutletsTappedNotification = null;
            }
        }
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (disposing)
            {
                SlinkLogoImageView?.Dispose();
                SlinkLogoImageView = null;

                CardImageView?.Dispose();
                CardImageView = null;

                CardVC?.View?.RemoveFromSuperview();
                CardVC?.RemoveFromParentViewController();
                CardVC.Dispose();
                CardVC = null;

                DidBecomeActiveNotificaion?.Dispose();
                DidBecomeActiveNotificaion = null;
            }
        }
Exemple #6
0
        public void NextCardForCardView()
        {
            var item = Shared.GetNextCard();

            if (item == null)
            {
                Console.WriteLine("Item is null");
                return;
            }

            Console.WriteLine("Item is NOT null");

            var vc = new CardViewController();

            vc.HideTitle    = true;
            vc.Editable     = false;
            vc.SelectedCard = item.Card;
            vc.View.Frame   = DemoCardView.Bounds;

            AddChildViewController(vc);
            DemoCardView.AddSubview(vc.View);
            vc.DidMoveToParentViewController(this);
        }
        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);
        }
        void StartPartTwo(Action completed)
        {
            if (Cancelled)
            {
                return;
            }

            var beingBy = GetDefaultLabel(Strings.Onboarding.begin_by);

            beingBy.Frame = new CGRect(100, 50, 200, 25);
            beingBy.Alpha = 0;
            View.AddSubview(beingBy);

            var card = new Card();

            card.UUID = Guid.NewGuid().ToString();
            card.Name = Strings.Basic.new_card;

            CardVC              = new CardViewController();
            CardVC.Editable     = true;
            CardVC.SelectedCard = card;
            CardVC.View.Frame   = new CGRect(0, 100, View.Frame.Width, CardViewController.GetCalculatedHeight());
            CardVC.View.Alpha   = 0;
            AddChildViewController(CardVC);
            View.AddSubview(CardVC.View);
            CardVC.AddUserImage(null);

            var nameAndImage = GetDefaultLabel(Strings.Onboarding.add_your_name_and_image);

            nameAndImage.Frame = new CGRect(20, CardVC.View.Frame.GetMaxY() + 50, View.Frame.Width - 40, 100);
            View.AddSubview(nameAndImage);

            UIView.Animate(animationDuration / 2, () =>
            {
                beingBy.Alpha = 1;
            }, () =>
            {
                if (Cancelled)
                {
                    return;
                }
                UIView.Animate(animationDuration / 2, () =>
                {
                    CardVC.View.Alpha = 1;
                }, async() =>
                {
                    await Task.Delay(TimeSpan.FromSeconds(animationDuration / 2));
                    if (Cancelled)
                    {
                        return;
                    }
                    UIView.Animate(animationDuration, () =>
                    {
                        nameAndImage.Alpha = 1;
                    }, () =>
                    {
                        AnimateUserNameAndPicture(async() =>
                        {
                            await Task.Delay(TimeSpan.FromSeconds(animationDuration / 2));
                            if (Cancelled)
                            {
                                return;
                            }
                            UIView.Animate(animationDuration, () =>
                            {
                                nameAndImage.Alpha = 0;
                            }, () =>
                            {
                                nameAndImage.Text = Strings.Onboarding.color_border;
                                if (Cancelled)
                                {
                                    return;
                                }
                                UIView.Animate(animationDuration, () =>
                                {
                                    nameAndImage.Alpha = 1;
                                }, async() =>
                                {
                                    ChangeBorderColor(UIColor.Blue);
                                    await Task.Delay(TimeSpan.FromSeconds(animationDuration / 2));
                                    if (Cancelled)
                                    {
                                        return;
                                    }
                                    UIView.Animate(animationDuration, () =>
                                    {
                                        nameAndImage.Alpha = 0;
                                    }, () =>
                                    {
                                        nameAndImage.Text = Strings.Onboarding.add_phone_number;
                                        if (Cancelled)
                                        {
                                            return;
                                        }
                                        UIView.Animate(animationDuration, () =>
                                        {
                                            nameAndImage.Alpha = 1;
                                        }, async() =>
                                        {
                                            AddEmptyPhoneNumber();
                                            await Task.Delay(TimeSpan.FromSeconds(animationDuration / 2));
                                            if (Cancelled)
                                            {
                                                return;
                                            }
                                            UIView.Animate(animationDuration, () =>
                                            {
                                                nameAndImage.Alpha = 0;
                                            }, () =>
                                            {
                                                nameAndImage.Text = Strings.Onboarding.add_social_media;
                                                if (Cancelled)
                                                {
                                                    return;
                                                }
                                                UIView.Animate(animationDuration, () =>
                                                {
                                                    nameAndImage.Alpha = 1;
                                                }, async() =>
                                                {
                                                    AddEmptySocialMedia();
                                                    await Task.Delay(TimeSpan.FromSeconds(animationDuration / 2));
                                                    if (Cancelled)
                                                    {
                                                        return;
                                                    }
                                                    UIView.Animate(animationDuration, () =>
                                                    {
                                                        nameAndImage.Alpha = 0;
                                                    }, () =>
                                                    {
                                                        nameAndImage.Text = Strings.Onboarding.add_a_name;
                                                        if (Cancelled)
                                                        {
                                                            return;
                                                        }
                                                        UIView.Animate(animationDuration, () =>
                                                        {
                                                            nameAndImage.Alpha = 1;
                                                        }, () =>
                                                        {
                                                            AnimateName(() =>
                                                            {
                                                                CardImageView = CardVC.CreateSnapshot();
                                                                removeAllSubviews(true, () =>
                                                                {
                                                                    completed?.Invoke();
                                                                });
                                                            });
                                                        });
                                                    });
                                                });
                                            });
                                        });
                                    });
                                });
                            });
                        });
                    });
                });
            });
        }
 public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
 {
     return(CardViewController.GetCalculatedHeight());
 }