public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            // Don't attempt to refresh if we're loading this controller from startup
            if (!_loadedFromStartup && Settings.Current.NeedsUpdate())
            {
                if (!IsOnline())
                {
                    ModalDialog.Alert("No or slow internet connection", "An update is available for the feeds, but no connection is currently available");
                    ShowFirstItem();
                }
                else
                {
                    Settings.Current.LastItemId       = "";
                    Settings.Current.LastControllerId = "";

                    // Show the modal update dialog
                    _loadingView = new LoadingFeedsView();
                    _loadingView.LoadingComplete += new EventHandler(LoadingViewComplete);
                    _loadingView.Stopped         += LoadingViewStopped;
                    _loadingView.Frame            = new RectangleF(_loadingView.Bounds.Location, new SizeF(300, 400));
                    _loadingView.Initialize();
                }
            }
            else
            {
                ShowFirstItem();
            }
        }
示例#2
0
        private void EmailButtonTouchDown(object sender, EventArgs e)
        {
            if (File.Exists(Settings.Current.LogFile))
            {
                if (MFMailComposeViewController.CanSendMail)
                {
                    NSData data = NSData.FromFile(Settings.Current.LogFile);

                    MFMailComposeViewController mailController = new MFMailComposeViewController();
                    mailController.SetSubject("Really simple iPhone error report");
                    mailController.SetToRecipients(new string[] { "*****@*****.**" });
                    mailController.SetMessageBody("Really simple error report", false);
                    mailController.AddAttachmentData(data, "text/plain", "error.log");
                    mailController.Finished += HandleMailFinished;
                    this.PresentModalViewController(mailController, true);
                }
                else
                {
                    ModalDialog.Alert("No email account found", "Please configure an email account before sending an error report");
                }
            }
            else
            {
                ModalDialog.Alert("No log file was found", "The error log was empty. Please try sending this again after the error occurs.");
            }
        }
示例#3
0
        private void AddDebugButtons()
        {
            _containerView       = new UIView();
            _containerView.Frame = new RectangleF(10, 280, 300, 100);

            // Add send email button
            _emailButton       = UIButton.FromType(UIButtonType.RoundedRect);
            _emailButton.Frame = new RectangleF(10, 0, 300, 40);
            _emailButton.SetTitle("  Send error report by email", UIControlState.Normal);
            _emailButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            _emailButton.TouchDown          += new EventHandler(EmailButtonTouchDown);
            _containerView.AddSubview(_emailButton);

            // Debug details
            _debugButton       = UIButton.FromType(UIButtonType.RoundedRect);
            _debugButton.Frame = new RectangleF(10, 45, 300, 40);
            _debugButton.SetTitle(" Debug information", UIControlState.Normal);
            _debugButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            _debugButton.TouchDown          += delegate
            {
                ModalDialog.Alert("Debug", DebugInfo());
            };

            _containerView.AddSubview(_debugButton);

            Section section = new Section(_containerView);

            _bindingContext.Root.Add(section);
        }
        /// <summary>
        /// Pushes the LoadingFeedsController if categories are selected.
        /// </summary>
        private void ViewButtonClicked(object sender, EventArgs e)
        {
            if (_selectedCategories.Count < 1)
            {
                ModalDialog.Alert("No categories selected", "Please select some categories first.");
                return;
            }

            _viewFeedsController = new ViewFeedsController();
            NavigationController.PushViewController(_viewFeedsController, true);
        }
示例#5
0
        private void HandleMailFinished(object sender, MFComposeResultEventArgs e)
        {
            try
            {
                if (e.Result == MFMailComposeResult.Sent)
                {
                    ModalDialog.Alert("Your email was sent", "");
                }

                e.Controller.DismissModalViewControllerAnimated(true);
            }
            catch (Exception ex)
            {
                Logger.Warn("Unhandled error when calling DismissModalViewControllerAnimated: {0}", ex);
            }
        }
示例#6
0
        public override void ViewDidLoad()
        {
            Title = "Settings";
            base.ViewDidLoad();

            // Hide the navigation bar, back button and toolbar.
            NavigationController.SetToolbarHidden(true, false);
            NavigationItem.HidesBackButton = true;

            // 'Done' button in the top right
            _doneButton          = new UIBarButtonItem();
            _doneButton.Title    = "Done";
            _doneButton.Clicked += delegate(object sender, EventArgs e)
            {
                _pickCategories = new PickCategoriesController();
                NavigationController.PushViewController(_pickCategories, false);

                UIView.BeginAnimations(null, IntPtr.Zero);
                UIView.SetAnimationDuration(0.5);
                UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromRight, NavigationController.View, true);
                UIView.CommitAnimations();
            };

            // Clear cache
            _clearButton          = new UIBarButtonItem();
            _clearButton.Title    = "Clear cache";
            _clearButton.Clicked += delegate(object sender, EventArgs e)
            {
                Settings.Current.ClearCache(true);
                ModalDialog.Alert("Cache cleared", "All cached items and images were removed");
            };

            NavigationItem.SetLeftBarButtonItem(_clearButton, false);
            NavigationItem.SetRightBarButtonItem(_doneButton, false);

#if LOGGING
            AddDebugButtons();
#endif
        }