示例#1
0
        public async override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath)
        {
            FaceState.Current.CurrentPerson = Group.People [indexPath.Section];

            if (!FaceState.Current.Verification.NeedsPerson)
            {
                ParentViewController.PerformSegue(GroupDetailViewController.Segues.PersonDetail, this);
            }
            else
            {
                var choice = await this.ShowActionSheet("Please choose", "What would you like to do with the selected person?", "Use for verification", "Edit");

                switch (choice)
                {
                case "Use for verification":
                    var face = FaceState.Current.CurrentPerson.Faces [indexPath.Row];
                    FaceState.Current.Verification.Face   = face;
                    FaceState.Current.Verification.Person = FaceState.Current.CurrentPerson;
                    FaceState.Current.Verification.Group  = Group;

                    this.PopTo <VerificationViewController> ();

                    break;

                case "Edit":
                    ParentViewController.PerformSegue(GroupDetailViewController.Segues.PersonDetail, this);
                    break;

                default:
                    return;
                }
            }
        }
        private void AddViewController()
        {
            if (ParentViewController == null)
            {
                throw new Exception("No Parent ViewController was found");
            }

            Debug.WriteLine($"vc.v is: {_viewController.View}");


            // TODO: it still thinks the Bounds are 924 wide in portrait mode
            // it's not calculating this correctly after orentation change.  The height is getting updated correctly tho.

            // This is the new ViewController of the new Page to be displayed - give it a parent.
            ParentViewController.AddChildViewController(_viewController);

            // add this new View as a nested view of this current UIVew
            AddSubview(_viewController.View);

            Debug.WriteLine(">>> Set _viewController.View.Frame to Bounds.");
            Debug.WriteLine($"                    Bounds: {Bounds}");
            Debug.WriteLine($"_viewController.View.Frame: {_viewController.View.Frame}");
            _viewController.View.Frame = Bounds;
            _viewController.DidMoveToParentViewController(ParentViewController);
        }
示例#3
0
        partial void HierarchySelectionChanged(NSObject sender)
        {
            var realSender      = (NSSegmentedControl)sender;
            var selectedSegment = realSender.SelectedSegment;

            ParentViewController.UpdateSelectedHierarchy(realSender.GetLabel(selectedSegment));
        }
示例#4
0
        public override void PerformAction(string command, string[] arguments)
        {
            base.PerformAction(command, arguments);

            switch (command)
            {
            case PrivateGeneralConfig.App_URL_Commands_Goto:
            {
                // make sure the argument is for us (and it wants more than just our root page)
                if (arguments[0] == Command_Keyword( ) && arguments.Length > 1)
                {
                    // if they want a "read" page, we support that.
                    if (arguments[1] == PrivateGeneralConfig.App_URL_Page_Read)
                    {
                        if (RockLaunchData.Instance.Data.NoteDB.SeriesList.Count > 0)
                        {
                            // since we're switching to the read notes VC, pop to the main page root and
                            // remove it, because we dont' want back history (where would they go back to?)
                            ParentViewController.ClearViewControllerStack( );

                            NoteController.NoteName = RockLaunchData.Instance.Data.NoteDB.SeriesList[0].Messages[0].Name;
                            NoteController.NoteUrl  = RockLaunchData.Instance.Data.NoteDB.SeriesList[0].Messages[0].NoteUrl;

                            ParentViewController.PushViewController(NoteController, false);
                        }
                    }
                }
                break;
            }
            }
        }
示例#5
0
文件: Task.cs 项目: J3057/MobileApp
 public void HandleAppURL(string appUrl)
 {
     // guard against double taps. (It's possible a second tap will come thru after we've inactivated ourselves)
     if (ParentViewController != null)
     {
         ParentViewController.HandleAppURL(appUrl);
     }
 }
示例#6
0
        public void ShowLoginDialog()
        {
            loginDialog = new TFLLoginViewController(delegate {
                TflTripLog.ClearTflData();
                DownloadTripLog();
            });

            loginController = new UINavigationController(loginDialog);

            ParentViewController.PresentModalViewController(loginController, true);
        }
示例#7
0
        public TFLLoginViewController(NSAction afterDataLoaded) : base(null, false)
        {
            NavigationItem.Title = "TfL Login";

            //TableView.BackgroundColor = UIColor.FromPatternImage(StockImages.GradientBackground);
            //TableView.BackgroundColor = UIColor.Clear;


            _username = TflTripLog.TflUsername;
            _password = TflTripLog.TflPassword;

            login = new EntryElement("Username", "Your TfL login", _username);


            login.KeyboardType           = UIKeyboardType.EmailAddress;
            login.AutoCorrectionType     = UITextAutocorrectionType.No;
            login.AutoCapitalizationType = UITextAutocapitalizationType.None;


            password = new EntryElement("Password", "Your password", _password, true);
            password.KeyboardType           = UIKeyboardType.Default;
            password.AutoCorrectionType     = UITextAutocorrectionType.No;
            password.AutoCapitalizationType = UITextAutocapitalizationType.None;



            RootElement root = new RootElement("TfL Login")
            {
                new Section("", "Enter your TfL credentials. Normally your email address and a password")
                {
                    login,
                    password
                }
            };

            Root = root;

            NavigationItem.RightBarButtonItem = new UIBarButtonItem("Login", UIBarButtonItemStyle.Bordered, delegate {
                this.login.FetchValue();
                this.password.FetchValue();

                TflTripLog.TflUsername = login.Value;
                TflTripLog.TflPassword = password.Value;

                ParentViewController.DismissModalViewControllerAnimated(true);

                afterDataLoaded();
            });


            NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Bordered, delegate {
                this.ParentViewController.DismissModalViewControllerAnimated(true);
            });
        }
示例#8
0
        void AddViewController()
        {
            if (ParentViewController == null)
            {
                throw new Exception("No Parent View controller was found");
            }

            ParentViewController.AddChildViewController(_viewController);
            AddSubview(_viewController.View);

            _viewController.View.Frame = Bounds;
            _viewController.DidMoveToParentViewController(ParentViewController);
        }
示例#9
0
文件: Task.cs 项目: J3057/MobileApp
        /// <summary>
        /// The root function to call when changing view controllers within a task. If changing in code,
        /// directly call this from the view controller. If using a storyboard, hook the segue to TaskTransition
        /// in ContainerViewController.cs, which will cause this function to be called.
        /// </summary>
        /// <param name="sourceViewController">Source view controller.</param>
        /// <param name="destinationViewController">Destination view controller.</param>
        public void PerformSegue(UIViewController sourceViewController, UIViewController destinationViewController, bool animated = true)
        {
            // take this opportunity to give the presenting view controller a pointer to the active task
            // so it can receive callbacks.
            TaskUIViewController viewController = destinationViewController as TaskUIViewController;

            if (viewController == null)
            {
                throw new InvalidCastException("View Controllers used by Activities must be of type TaskUIViewController");
            }

            ParentViewController.PushViewController(destinationViewController, animated);
        }
示例#10
0
        private void DisplayUserDetails(UITableView tableView, NSIndexPath indexPath)
        {
            // Instantiate view controller
            var userDetailsViewController = ParentViewController.
                                            Storyboard.InstantiateViewController("UserDetailsViewController") as UserDetailsViewController;

            // Pass selected user
            userDetailsViewController.User = UsersRepository.GetById(GetUserId(indexPath));

            // Present view controller
            ParentViewController.PresentViewController(
                userDetailsViewController,
                true,
                () => ReloadRow(tableView, indexPath));
        }
示例#11
0
        public override void PerformAction(string command, string[] arguments)
        {
            base.PerformAction(command, arguments);

            switch (command)
            {
            // is this a goto command?
            case PrivateGeneralConfig.App_URL_Commands_Goto:
            {
                // make sure the argument is for us
                if (arguments[0] == Command_Keyword( ) && arguments.Length > 1)
                {
                    // check for groupfinder, because we support that one.
                    if (PrivateGeneralConfig.App_URL_Page_GroupFinder == arguments[1])
                    {
                        // since we're switching to the read notes VC, pop to the main page root and
                        // remove it, because we dont' want back history (where would they go back to?)
                        ParentViewController.ClearViewControllerStack( );

                        // create and launch the group finder. It's fine to create it here because we always dynamically create this controller.
                        TaskUIViewController viewController = Storyboard.InstantiateViewController("GroupFinderViewController") as TaskUIViewController;
                        ParentViewController.PushViewController(viewController, false);
                    }
                    else
                    {
                        List <ConnectLink> engagedEntries = ConnectLink.BuildGetEngagedList( );
                        ConnectLink        connectLink    = engagedEntries.Where(e => e.Command_Keyword == arguments[1]).SingleOrDefault( );

                        if (connectLink != null)
                        {
                            // clear out the stack and push the main connect page onto the stack
                            ParentViewController.ClearViewControllerStack( );
                            ParentViewController.PushViewController(MainPageVC, false);

                            // now go to the requested URL (and do not animate it--that could allow a race condition if this action is called rapidly
                            TaskWebViewController.HandleUrl(false, true, connectLink.Url, this, MainPageVC, false, false, false, false);
                        }
                    }
                }
                break;
            }
            }
        }
示例#12
0
        public static void Start()
        {
            if (Books2Download != null && Books2Download.Count > 0)
            {
                try
                {
                    // Check to see if there is any book that was downloading or updating in progress.
                    // If there is, then resume downloading and do not sort
                    bool sortRequired = true;
                    foreach (Book book in Books2Download)
                    {
                        if (book.Status == Book.BookStatus.DOWNLOADING || book.Status == Book.BookStatus.UPDATING)
                        {
                            sortRequired = false;
                        }
                    }

                    if (sortRequired)
                    {
                        SortBooks();
                    }

                    InProgress  = true;
                    CurrentBook = Books2Download[0];

                    if (CurrentBook.Status == Book.BookStatus.PENDING2UPDATE)
                    {
                        CurrentBook.Status = Book.BookStatus.UPDATING;
                    }
                    else if (CurrentBook.Status == Book.BookStatus.PENDING2DOWNLOAD)
                    {
                        CurrentBook.Status = Book.BookStatus.DOWNLOADING;
                    }

                    BackgroundWorker downloadWorker = new BackgroundWorker();
                    downloadWorker.WorkerSupportsCancellation = true;
                    downloadWorker.DoWork += async delegate
                    {
                        // Get my stuff for this book
                        if (CurrentBook.Status == Book.BookStatus.DOWNLOADING)
                        {
                            if (!CloudSync.SyncingInProgress)
                            {
                                await eBriefingService.Run(() => CloudSync.PullMyStuffs(CurrentBook));
                            }
                        }

                        List <String> fileUrlsToDownload = new List <String>();

                        // Notify UI the start of the downloading
                        ParentViewController.InvokeOnMainThread(delegate
                        {
                            if (DownloadStartEvent != null)
                            {
                                DownloadStartEvent(CurrentBook.ID);
                            }
                        });

                        // Queue up cover images for the book only if the image version is different
                        if (CurrentBook.Status == Book.BookStatus.UPDATING)
                        {
                            Book deviceBook = BooksOnDeviceAccessor.GetBook(CurrentBook.ID);
                            if (deviceBook != null && (deviceBook.ImageVersion != CurrentBook.ImageVersion))
                            {
                                DownloadedFilesCache.RemoveFile(deviceBook.LargeImageURL);
                                DownloadedFilesCache.RemoveFile(deviceBook.SmallImageURL);

                                fileUrlsToDownload.Add(CurrentBook.LargeImageURL);
                                fileUrlsToDownload.Add(CurrentBook.SmallImageURL);
                            }
                        }

                        // Download chapters
                        await eBriefingService.Run(() => DownloadChaptersWork(CurrentBook.ID, fileUrlsToDownload));

                        // Download pages
                        List <Page> pageList = await eBriefingService.Run(() => DownloadPagesWork(CurrentBook.ID));

                        if (pageList != null)
                        {
                            List <Page> differentPageList = Pages2Download(CurrentBook.ID, pageList);
                            foreach (Page page in differentPageList)
                            {
                                fileUrlsToDownload.Add(page.URL);
                            }
                        }

                        // Filter out those files that are already downloaded (Only if the status is DOWNLOADING, not UPDATING)
                        // CoreServices 2.0 will check for updates too since we can check for version number for each file
                        fileUrlsToDownload = RemoveAlreadyDownloadedFiles(fileUrlsToDownload);

                        // Download Start
                        if (fileUrlsToDownload.Count == 0)
                        {
                            QueueDidFinish(null);
                        }
                        else
                        {
                            DownloadPDFsWork(CurrentBook.ID, fileUrlsToDownload);
                        }
                    };
                    downloadWorker.RunWorkerAsync();
                }
                catch (Exception ex)
                {
                    Logger.WriteLineDebugging("BookUpdater - Start: {0}", ex.ToString());
                }
            }
        }