void HandleAddButton(object sender, EventArgs e)
        {
            try {
                var addC = new QueryController(Service, new UserQuery());
                var navC = new UINavigationController(addC);

                addC.Done += delegate {
                    var q = new UserQuery {
                        Filter    = addC.Filter,
                        FeedId    = addC.Feed.Id,
                        Name      = addC.Name,
                        OrderBy   = addC.OrderBy,
                        ServiceId = Service.Id
                    };

                    using (var repo = new Repo()) {
                        repo.Add(q);
                    }

                    addC.DismissModalViewControllerAnimated(true);
                };

                NavigationController.PresentModalViewController(navC, true);
            } catch (Exception error) {
                Log.Error(error);
            }
        }
        void HandleEdit(object sender, EventArgs e)
        {
            try {
                UserService service = null;

                using (var repo = new Repo()) {
                    service = repo.GetService(Query.ServiceId);
                }

                var editC = new QueryController(service, Query);
                var navC  = new UINavigationController(editC);

                editC.Done += delegate {
                    editC.DismissModalViewControllerAnimated(true);

                    Query.Filter  = editC.Filter;
                    Query.FeedId  = editC.Feed.Id;
                    Query.Name    = editC.Name;
                    Query.OrderBy = editC.OrderBy;

                    using (var repo = new Repo()) {
                        repo.Save(Query);
                    }

                    _numGets = 0;
                    _index   = 0;
                    Sections.Clear();

                    _loadSection = new DialogSection();
                    _loadSection.Add(_loadElement);
                    _loadElement.Start();
                    Sections.Add(_loadSection);

                    GetMore();
                };

                NavigationController.PresentModalViewController(navC, true);
            } catch (Exception error) {
                Log.Error(error);
            }
        }
Example #3
0
        void HandleEdit(object sender, EventArgs e)
        {
            try {

                UserService service = null;

                using (var repo = new Repo()) {
                    service = repo.GetService(Query.ServiceId);
                }

                var editC = new QueryController (service, Query);
                var navC = new UINavigationController (editC);

                editC.Done += delegate {

                    editC.DismissModalViewControllerAnimated (true);

                    Query.Filter = editC.Filter;
                    Query.FeedId = editC.Feed.Id;
                    Query.Name = editC.Name;
                    Query.OrderBy = editC.OrderBy;

                    using (var repo = new Repo ()) {
                        repo.Save (Query);
                    }

                    _numGets = 0;
                    _index = 0;
                    Sections.Clear ();

                    _loadSection = new DialogSection ();
                    _loadSection.Add (_loadElement);
                    _loadElement.Start ();
                    Sections.Add (_loadSection);

                    GetMore ();
                };

                NavigationController.PresentModalViewController (navC, true);

            } catch (Exception error) {
                Log.Error (error);
            }
        }
Example #4
0
        void HandleAddButton(object sender, EventArgs e)
        {
            try {

                var addC = new QueryController (Service, new UserQuery());
                var navC = new UINavigationController (addC);

                addC.Done += delegate {

                    var q = new UserQuery {
                        Filter = addC.Filter,
                        FeedId = addC.Feed.Id,
                        Name = addC.Name,
                        OrderBy = addC.OrderBy,
                        ServiceId = Service.Id
                    };

                    using (var repo = new Repo ()) {
                        repo.Add (q);
                    }

                    addC.DismissModalViewControllerAnimated (true);
                };

                NavigationController.PresentModalViewController (navC, true);

            } catch (Exception error) {
                Log.Error (error);
            }
        }