Exemplo n.º 1
0
        public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
        {
            if (segue.DestinationViewController.GetType() == typeof(UINavigationController))
            {
                if (sender != null && sender.GetType() == typeof(NSIndexPath))
                {
                    UINavigationController navigationController = (UINavigationController)segue.DestinationViewController;
                    AddURLViewController   addURLViewController = (AddURLViewController)navigationController.TopViewController;

                    ArExperience selectedArExperience = arExperienceGroup.ArExperiences[((NSIndexPath)sender).Row];
                    addURLViewController.EditExistingArExperience(selectedArExperience);
                }
            }
        }
Exemplo n.º 2
0
        public void ComeBackFromAddURLViewController(UIStoryboardSegue segue)
        {
            if (segue.SourceViewController.GetType() == typeof(AddURLViewController))
            {
                AddURLViewController addURLViewController = (AddURLViewController)segue.SourceViewController;
                if (addURLViewController.GetState() == AddURLViewController.State.Created)
                {
                    ArExperience arExperience = addURLViewController.CreatedArExperience();
                    arExperienceGroup.ArExperiences.Insert(0, arExperience);

                    TableView.InsertRows(new NSIndexPath[] { NSIndexPath.Create(new int[] { 0, 0 }) }, UITableViewRowAnimation.Top);
                }
                else if (addURLViewController.GetState() == AddURLViewController.State.Edited)
                {
                    ArExperience updatedArExperience = addURLViewController.UpdatedArExperience();
                    int          index = arExperienceGroup.ArExperiences.FindIndex(x => x == updatedArExperience);
                    arExperienceGroup.ArExperiences[index] = addURLViewController.CreatedArExperience();
                    TableView.ReloadRows(new NSIndexPath[] { NSIndexPath.Create(new int[] { 0, index }) }, UITableViewRowAnimation.Automatic);
                }
                ArExperienceManager.WriteToFile(persitentArExperienceGroupFilePath, arExperienceGroup);
            }
        }