Beispiel #1
0
 private void NavigateBack()
 {
     // since we're in the edit page, we need to pop twice
     controller.PopViewControllerAnimated(false);
     controller.PopViewControllerAnimated(true);
     root.Dispose();
 }
Beispiel #2
0
        public void NavigateToDetail(UIViewController vc, MXTouchAnimation direction)
        {
            CATransition transition = new CATransition();

            transition.Duration = 0.5;
            transition.Type     = CATransition.TransitionMoveIn;
            if (direction == MXTouchAnimation.Left)
            {
                transition.Subtype = CATransition.TransitionFromRight;
            }
            else
            {
                transition.Subtype = CATransition.TransitionFromLeft;
            }

            if (_splitViewController != null)
            {
                // ipad -- set pane, we just change out the panes depending on the master
                _detailNavigationController.PopViewControllerAnimated(false);

                _detailNavigationController.View.Layer.AddAnimation(transition, CALayer.Transition);
                _detailNavigationController.PushViewController(vc, false);

                _splitViewControllerDelegate.ReplaceDetailNavigationViewController();
                _splitViewControllerDelegate.HidePopover();
            }
            else
            {
                _masterNavigationController.PopViewControllerAnimated(false);

                _masterNavigationController.View.Layer.AddAnimation(transition, CALayer.Transition);
                _masterNavigationController.PushViewController(vc, false);
            }
        }
Beispiel #3
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            // if this is a new list, delete just does the same thing as cancel
            if (list == null)
            {
                CancelButton_Click(sender, e);
                return;
            }

            MessageBoxResult result = MessageBox.Show(String.Format("delete {0}?", list.Name), "confirm delete", MessageBoxButton.OKCancel);

            if (result != MessageBoxResult.OK)
            {
                return;
            }

            // enqueue the Web Request Record
            RequestQueue.EnqueueRequestRecord(RequestQueue.UserQueue,
                                              new RequestQueue.RequestRecord()
            {
                ReqType = RequestQueue.RequestRecord.RequestType.Delete,
                Body    = list
            });

            // reobtain the current folder (it may have been replaced by a GetUser operations since the ListEditor was invoked)
            Folder currentFolder = App.ViewModel.LoadFolder(list.FolderID);

            // remove the item from the viewmodel
            list = currentFolder.Items.Single(i => i.ID == list.ID);
            currentFolder.Items.Remove(list);

            // save the changes to local storage
            StorageHelper.WriteFolder(currentFolder);

            // trigger a sync with the Service
            App.ViewModel.SyncWithService();

            // trace page navigation
            TraceHelper.StartMessage("ListEditor: Navigate back");

            // Pop twice and navigate back to the list page
            controller.PopViewControllerAnimated(false);
            NavigateBack();
        }
Beispiel #4
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            // if this is a new folder, delete just does the same thing as cancel
            if (folder == null)
            {
                CancelButton_Click(sender, e);
                return;
            }

            MessageBoxResult result = MessageBox.Show("delete this folder?", "confirm delete", MessageBoxButton.OKCancel);

            if (result != MessageBoxResult.OK)
            {
                return;
            }

            // enqueue the Web Request Record
            RequestQueue.EnqueueRequestRecord(RequestQueue.UserQueue,
                                              new RequestQueue.RequestRecord()
            {
                ReqType = RequestQueue.RequestRecord.RequestType.Delete,
                Body    = folder
            });

            // remove the item from the viewmodel
            App.ViewModel.Folders.Remove(folder);
            App.ViewModel.FolderDictionary.Remove(folder.ID);

            // save the changes to local storage
            StorageHelper.WriteFolders(App.ViewModel.Folders);
            StorageHelper.DeleteFolder(folder);

            // trigger a sync with the Service
            App.ViewModel.SyncWithService();

            // trace page navigation
            TraceHelper.StartMessage("FolderEditor: Navigate back");

            // Pop twice and navigate back to the folder page
            controller.PopViewControllerAnimated(false);
            NavigateBack();
        }
        public TankMix_CalculationCreateFill_2(Fill fill, UINavigationController naiv)
            : base(UITableViewStyle.Grouped, null)
        {
            this.Pushing = true;
            Root = new RootElement ("TankMix_CalculationCreateFill_2");

            var section = new Section (){
                new StringElement("back ",()=>{
                    naiv.PopViewControllerAnimated(true);
                }),
            };
        }
        void InteractionBegan(PointF point)
        {
            UIViewController viewController = ((APLCollectionViewController)navigationController.TopViewController).NextViewControllerAtPoint(point);

            if (viewController != null)
            {
                navigationController.PushViewController(viewController, true);
            }
            else
            {
                navigationController.PopViewControllerAnimated(true);
            }
        }
Beispiel #7
0
        public void NavigateToDetail(UIViewController vc)
        {
            // first time through!
            if (_splitViewController == null && _masterNavigationController == null)
            {
                Init(vc);
                return;
            }

            if (_splitViewController != null)
            {
                // ipad -- set pane, we just change out the panes depending on the master
                _detailNavigationController.PopViewControllerAnimated(false);
                _detailNavigationController.PushViewController(vc, false);
                _splitViewControllerDelegate.ReplaceDetailNavigationViewController();
                _splitViewControllerDelegate.HidePopover();
            }
            else
            {
                _masterNavigationController.PushViewController(vc, true);
            }
        }
Beispiel #8
0
        public void DoneButtonClicked(object sender, EventArgs args)
        {
            var contact = new Contact();

            // Photo
            if (_profilePhoto != null)
            {
                contact.ImageName = Guid.NewGuid().ToString() + ".jpg";
                var directory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                var imagePath = System.IO.Path.Combine(directory, contact.ImageName);

                NSData  imgData = _profilePhoto.AsJPEG();
                NSError err     = null;
                if (!imgData.Save(imagePath, false, out err))
                {
                    throw new Exception(err.LocalizedDescription);
                }
            }

            // Name
            contact.FirstName    = ((EntryElement)_nameSection[0]).Value ?? null;
            contact.MiddleName   = ((EntryElement)_nameSection[1]).Value ?? null;
            contact.LastName     = ((EntryElement)_nameSection[2]).Value ?? null;
            contact.Organization = ((EntryElement)_nameSection[3]).Value ?? null;

            DatabaseManager.AddNewContact(contact);
            _rootContainerNavigationController.PopViewControllerAnimated(false);
            _rootContainerNavigationController.PushViewController(new AllContactsScreen(), false);
            NavigationController.DismissViewController(true, null);

            // Phone numbers
            for (int i = 0; i <= _phoneSection.Count - 1; i++)
            {
                if (_phoneSection[i].GetType() == typeof(EntryElement))
                {
                    if (i >= 1)
                    {
                        var phoneType   = (StyledStringElement)_phoneSection[i - 1];
                        var phoneNumber = (EntryElement)_phoneSection[i];

                        if (!string.IsNullOrEmpty(phoneNumber.Value))
                        {
                            Console.WriteLine("type:" + phoneType.Caption + " number:" + phoneNumber.Value);
                        }
                    }
                }
            }
        }
Beispiel #9
0
 private void NavigateBack(bool animated = false)
 {
     navigationContext.PopViewControllerAnimated(animated);
 }
 public override void CloseModalViewController()
 {
     _masterNavigationController.PopViewControllerAnimated(true);
 }
Beispiel #11
0
 public virtual void CloseModalViewController()
 {
     _masterNavigationController.PopViewControllerAnimated(true);
 }
Beispiel #12
0
 void doneBtn_Clicked(object sender, EventArgs e)
 {
     SetTargetColor();
     navigation.PopViewControllerAnimated(true);
 }
        public void ShowAddContactController(UINavigationController navigationController, User user)
        {
            ABNewPersonViewController abController = new ABNewPersonViewController ();

            ABPerson person = new ABPerson ();

            KeyValuePair <string, string> namePair = GetFirstAndLastName (user);

            person.FirstName = namePair.Key;
            person.LastName = namePair.Value;

            if (!string.IsNullOrEmpty (user.Company))
            {
                person.Organization = user.Company;
            }

            if (!string.IsNullOrEmpty (user.Phone))
            {
                ABMutableMultiValue<string> phones = new ABMutableStringMultiValue();
                phones.Add(user.Phone, ABPersonPhoneLabel.Main);
                person.SetPhones(phones);
            }

            if (!string.IsNullOrEmpty (user.Email))
            {
                ABMutableMultiValue<string> emails = new ABMutableStringMultiValue();
                emails.Add(user.Email, null);
                person.SetEmails(emails);
            }

            // Get any image from cache
            byte [] data = Engine.Instance.ImageCache.FindAny (user);

            if (data != null && data.Length > 0)
            {
                person.Image = NSData.FromArray(data);
            }

            abController.DisplayedPerson  = person;

            abController.NewPersonComplete += delegate {
                navigationController.PopViewControllerAnimated (true);
            };

            navigationController.PushViewController (abController, true);

            if (OnAddContactCompleted != null)
                OnAddContactCompleted ();
        }
Beispiel #14
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow (UIScreen.MainScreen.Bounds);
            window.BackgroundColor = UIColor.White;

            table = new UITableViewController();

            NavController = new UINavigationController();

            // Add the [+] button
            statusButton = new UIBarButtonItem (UIBarButtonSystemItem.Add);
            statusButton.Clicked += delegate
            {
                usvc = new UpdateStatusViewController();
                NavController.PushViewController(usvc, true);
            };
            table.NavigationItem.SetRightBarButtonItem (statusButton, false);

            FacebookAuthorizationViewController fac =
                new FacebookAuthorizationViewController(
                      clientId
                    , new string[] {"read_stream", "publish_stream"} //, "user_groups"}
                    , FbDisplayType.Touch);

            fac.AccessToken +=
            delegate(string accessToken, DateTime expires)
            {
                token = accessToken;

                //Logged in, got your accessToken here and when it expires!
                NavController.PopViewControllerAnimated(true);

                //Do something else here (eg: Save the accessToken and expiry date to be used in your Graph API calls)
                Console.WriteLine("### Get json");
                System.Net.WebClient wc = new System.Net.WebClient();

                var b = wc.DownloadData(
                    new Uri("https://graph.facebook.com/me/home?access_token=" + token)
                );
                var s = Encoding.UTF8.GetString(b);

                //Console.WriteLine("### Output json");
                Console.WriteLine(s);

                // http://www.brettnagy.com/post/2009/11/21/Using-JsonNET-with-MonoTouch.aspx
                var posts = JsonConvert.DeserializeObject<Posts>( s );

            //				foreach(var p in posts.data)
            //				{
            //					Console.WriteLine("name: " + p.from.name);
            //				}

                table.Title = "Facebook";
                table.TableView.Source = new TableViewSource(posts);

            };

            NavController.PushViewController(table, false);
            NavController.PushViewController(fac, true);
            NavController.NavigationBar.TintColor = new UIColor(0.27f,0.52f,0.73f,1f);

            window.AddSubview(NavController.View);

            window.MakeKeyAndVisible ();
            return true;
        }