Example #1
0
        private void ShowLayerList()
        {
            // Create a new Alert Controller
            UIAlertController layersActionSheet = UIAlertController.Create("Layers", "Choose layers", UIAlertControllerStyle.ActionSheet);

            // Add actions to add or remove each of the available layers
            foreach (var kvp in _operationalLayerUrls)
            {
                layersActionSheet.AddAction(UIAlertAction.Create(kvp.Key, UIAlertActionStyle.Default, (action) => AddOrRemoveLayer(kvp.Key)));
            }

            // Add a choice to cancel
            layersActionSheet.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (action) => Console.WriteLine("Canceled")));

            // Required for iPad - You must specify a source for the Action Sheet since it is displayed as a popover
            UIPopoverPresentationController presentationPopover = layersActionSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Display the list of layers to add/remove
            this.PresentViewController(layersActionSheet, true, null);
        }
        private void ShowBasemapClicked(object sender, EventArgs e)
        {
            // Create a new Alert Controller.
            UIAlertController basemapsActionSheet =
                UIAlertController.Create("Basemaps", "Choose a basemap", UIAlertControllerStyle.ActionSheet);

            // Add actions to apply each basemap type.
            basemapsActionSheet.AddAction(UIAlertAction.Create("Topographic", UIAlertActionStyle.Default,
                                                               action => _myMapView.Map.Basemap = Basemap.CreateTopographic()));
            basemapsActionSheet.AddAction(UIAlertAction.Create("Streets", UIAlertActionStyle.Default,
                                                               action => _myMapView.Map.Basemap = Basemap.CreateStreets()));
            basemapsActionSheet.AddAction(UIAlertAction.Create("Imagery", UIAlertActionStyle.Default,
                                                               action => _myMapView.Map.Basemap = Basemap.CreateImagery()));
            basemapsActionSheet.AddAction(UIAlertAction.Create("Oceans", UIAlertActionStyle.Default,
                                                               action => _myMapView.Map.Basemap = Basemap.CreateOceans()));
            basemapsActionSheet.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel,
                                                               action => Console.WriteLine("Canceled")));

            // Required for iPad - You must specify a source for the Action Sheet since it is displayed as a popover.
            UIPopoverPresentationController presentationPopover = basemapsActionSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.BarButtonItem            = (UIBarButtonItem)sender;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Down;
            }

            // Display the list of basemaps.
            PresentViewController(basemapsActionSheet, true, null);
        }
        private void ShowLayerListClicked(object sender, EventArgs e)
        {
            // Create a new Alert Controller.
            UIAlertController layersActionSheet =
                UIAlertController.Create("Layers", "Choose layers", UIAlertControllerStyle.ActionSheet);

            // Add actions to add or remove each of the available layers.
            foreach (string key in _operationalLayerUrls.Keys)
            {
                layersActionSheet.AddAction(UIAlertAction.Create(key, UIAlertActionStyle.Default,
                                                                 action => AddOrRemoveLayer(key)));
            }

            // Add a choice to cancel.
            layersActionSheet.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel,
                                                             action => Console.WriteLine("Canceled")));

            // Required for iPad - You must specify a source for the Action Sheet since it is displayed as a popover.
            UIPopoverPresentationController presentationPopover = layersActionSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.BarButtonItem            = (UIBarButtonItem)sender;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Down;
            }

            // Display the list of layers to add/remove.
            PresentViewController(layersActionSheet, true, null);
        }
        partial void TestButton2_TouchUpInside(UIButton sender)
        {
            // Create a new Alert Controller
            UIAlertController actionSheetAlert = UIAlertController.Create("Action Sheet", "Select an item from below", UIAlertControllerStyle.ActionSheet);

            // Add Actions
            actionSheetAlert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, (action) => Console.WriteLine("Item One pressed.")));

            actionSheetAlert.AddAction(UIAlertAction.Create("custom button 1", UIAlertActionStyle.Default, (action) => Console.WriteLine("Item Two pressed.")));

            actionSheetAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (action) => Console.WriteLine("Cancel button pressed.")));

            // Required for iPad - You must specify a source for the Action Sheet since it is
            // displayed as a popover
            UIPopoverPresentationController presentationPopover = actionSheetAlert.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Display the alert
            this.PresentViewController(actionSheetAlert, true, null);
        }
Example #5
0
        void newIamgeHandler(object sender, EventArgs args)
        {
            // Create a new Alert Controller
            UIAlertController actionSheetAlert = UIAlertController.Create("New Image", "Select an image from below", UIAlertControllerStyle.ActionSheet);

            // Add Actions
            actionSheetAlert.AddAction(UIAlertAction.Create("Take Photo", UIAlertActionStyle.Default, (action) => TakePictureFunction()));

            actionSheetAlert.AddAction(UIAlertAction.Create("Choose From Library", UIAlertActionStyle.Default, (action) => ChooseFromLibraryFunction()));

            actionSheetAlert.AddAction(UIAlertAction.Create("Use Last Photo Taken", UIAlertActionStyle.Default, (action) => Console.WriteLine("Item Three pressed.")));

            actionSheetAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (action) => Console.WriteLine("Cancel button pressed.")));

            // Required for iPad - You must specify a source for the Action Sheet since it is
            // displayed as a popover
            UIPopoverPresentationController presentationPopover = actionSheetAlert.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Display the alert
            this.PresentViewController(actionSheetAlert, true, null);
        }
        private void GridTypeButton_Click(object sender, EventArgs e)
        {
            // Create the view controller that will present the list of grid types.
            UIAlertController gridTypeAlert = UIAlertController.Create("Select a grid type", "", UIAlertControllerStyle.ActionSheet);

            // Needed to prevent a crash on iPad.
            UIPopoverPresentationController presentationPopover = gridTypeAlert.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Add an option for each grid type.
            foreach (string item in new[] { "LatLong", "UTM", "MGRS", "USNG" })
            {
                // Record the selection and re-apply all settings.
                gridTypeAlert.AddAction(UIAlertAction.Create(item, UIAlertActionStyle.Default, action =>
                {
                    _selectedGridType = item;
                    ApplyCurrentSettings();
                }));
            }

            // Show the alert.
            PresentViewController(gridTypeAlert, true, null);
        }
        private void ShowSketchModeList()
        {
            // Create a new Alert Controller.
            UIAlertController sketchModeActionSheet = UIAlertController.Create("Sketch Modes", "Choose a sketch mode", UIAlertControllerStyle.ActionSheet);

            // Create a dictionary that associates SketchCreationMode names with values.
            IEnumerable <int> enumValues = Enum.GetValues(typeof(SketchCreationMode)).Cast <int>();

            _sketchModeDictionary = enumValues.ToDictionary(v => Enum.GetName(typeof(SketchCreationMode), v), v => v);

            // Add sketch modes to the action sheet.
            foreach (KeyValuePair <string, int> mode in _sketchModeDictionary)
            {
                UIAlertAction actionItem = UIAlertAction.Create(mode.Key, UIAlertActionStyle.Default, action => SketchGeometry(action.Title));
                sketchModeActionSheet.AddAction(actionItem);
            }

            // Required for iPad - You must specify a source for the Action Sheet since it is displayed as a popover.
            UIPopoverPresentationController presentationPopover = sketchModeActionSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Left;
            }

            // Display the list of sketch modes.
            PresentViewController(sketchModeActionSheet, true, null);
        }
        private void ShowSketchModeList()
        {
            // Create a new Alert Controller
            UIAlertController sketchModeActionSheet = UIAlertController.Create("Sketch Modes", "Choose a sketch mode", UIAlertControllerStyle.ActionSheet);

            // Create an action for drawing the selected sketch type
            var sketchAction = new Action <UIAlertAction>((axun) => { SketchGeometry(axun.Title); });

            // Create a dictionary of enum names and values
            var enumValues = Enum.GetValues(typeof(SketchCreationMode)).Cast <int>();

            _sketchModeDictionary = enumValues.ToDictionary(v => Enum.GetName(typeof(SketchCreationMode), v), v => v);

            // Add sketch modes to the action sheet
            foreach (var mode in _sketchModeDictionary)
            {
                UIAlertAction actionItem = UIAlertAction.Create(mode.Key, UIAlertActionStyle.Default, sketchAction);
                sketchModeActionSheet.AddAction(actionItem);
            }

            // Required for iPad - You must specify a source for the Action Sheet since it is displayed as a popover
            UIPopoverPresentationController presentationPopover = sketchModeActionSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Display the list of sketch modes
            this.PresentViewController(sketchModeActionSheet, true, null);
        }
Example #9
0
        private void UISegmentButton_RemoveLayerFromMap()
        {
            // Create a new Alert Controller
            UIAlertController layersActionSheet = UIAlertController.Create("Remove a layer from the map", "", UIAlertControllerStyle.ActionSheet);

            // Add actions to remove a layer from the map
            foreach (string oneLayerName in _myObservableCollection_LayerNamesInTheMap)
            {
                layersActionSheet.AddAction(UIAlertAction.Create(oneLayerName, UIAlertActionStyle.Default, (action) => Action_RemoveLayerFromMap(oneLayerName)));
            }

            // Add a choice to cancel
            layersActionSheet.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (action) => Console.WriteLine("Canceled")));

            // Required for iPad - You must specify a source for the Action Sheet since it is displayed as a popover
            UIPopoverPresentationController presentationPopover = layersActionSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Display the list of layers to add/remove
            this.PresentViewController(layersActionSheet, true, null);
        }
Example #10
0
        private void ShowMapList(IEnumerable <PortalItem> webmapItems)
        {
            // Create a new Alert Controller.
            UIAlertController mapListActionSheet =
                UIAlertController.Create("Web maps", "Choose a map", UIAlertControllerStyle.ActionSheet);

            // Add actions to load the available web maps.
            foreach (PortalItem item in webmapItems)
            {
                mapListActionSheet.AddAction(UIAlertAction.Create(item.Title, UIAlertActionStyle.Default,
                                                                  async action => await DisplayMap(item.Url)));
            }

            // Add a choice to cancel.
            mapListActionSheet.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel,
                                                              action => Console.WriteLine("Canceled")));

            // Required for iPad - You must specify a source for the Action Sheet since it is displayed as a popover.
            UIPopoverPresentationController presentationPopover = mapListActionSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.BarButtonItem            = _myMapsLastClicked ? _myMapsButton : _searchButton;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Down;
            }

            // Display the list of maps.
            PresentViewController(mapListActionSheet, true, null);
        }
        public static void SetPresentationAnchor(this UIPopoverPresentationController ppc, object anchorObject)
        {
            if (ppc == null)
            {
                throw new ArgumentNullException("ppc");
            }

            if (anchorObject == null)
            {
                throw new ArgumentNullException("anchorObject");
            }

            if (!(anchorObject is NSObject) && !(anchorObject is UITargetReference))
            {
                throw new ArgumentException("Not NSObject or UITargetReference", "anchorObject");
            }

            if (anchorObject is UITargetReference)
            {
                var target = (UITargetReference)anchorObject;
                SetPresentationAnchorInternal(ppc, (NSObject)target.Target, (NSObject)target.TargetOwner);
            }
            else
            {
                SetPresentationAnchorInternal(ppc, (NSObject)anchorObject, null);
            }
        }
Example #12
0
        private void UISegmentButton_AddLayerToMap()
        {
            // Create a new Alert Controller - this will show the layer names that can be added to the map
            UIAlertController myUIAlertController = UIAlertController.Create("Add a layer to the map", "", UIAlertControllerStyle.ActionSheet);

            // Add actions to add a layer to the map
            foreach (string oneLayerName in _myObservableCollection_LayerNamesNotInTheMap)
            {
                myUIAlertController.AddAction(UIAlertAction.Create(oneLayerName, UIAlertActionStyle.Default, (action) => Action_AddLayerToMap(oneLayerName)));
            }

            // Add a choice to cancel
            myUIAlertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (action) => Console.WriteLine("Canceled")));

            // Required for iPad - You must specify a source for the Action Sheet since it is displayed as a popover
            UIPopoverPresentationController presentationPopover = myUIAlertController.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Display the list of layers to add to the map
            this.PresentViewController(myUIAlertController, true, null);
        }
Example #13
0
        void CategoryDetail_Delete_Clicked(object sender, EventArgs e)
        {
            UIAlertController actionSheetAlert =
                UIAlertController.Create("Delete Category", "Please select an action", UIAlertControllerStyle.ActionSheet);

            actionSheetAlert
            .AddAction(UIAlertAction
                       .Create("Delete the category with all its expenses", UIAlertActionStyle.Default, (action) =>
            {
                _category.Delete();
                NavigationController.PopViewController(true);
            }));
            actionSheetAlert
            .AddAction(UIAlertAction
                       .Create("Delete just the expenses in this category", UIAlertActionStyle.Default, (action) =>
            {
                _category.DeleteAllExpenses();
                NavigationController.PopViewController(true);
            }));
            actionSheetAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (action) => Console.WriteLine("Cancel button pressed.")));

            // Required for iPad - You must specify a source for the Action Sheet since it is
            // displayed as a popover
            UIPopoverPresentationController presentationPopover = actionSheetAlert.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            PresentViewController(actionSheetAlert, true, null);
        }
Example #14
0
        private void PresentCollectionSortOptions(object sender, EventArgs e)
        {
            UIAlertController alertController = UIAlertController.Create("Collection Sort", null, UIAlertControllerStyle.ActionSheet);

            alertController.AddAction(UIAlertAction.Create("Default", UIAlertActionStyle.Default, delegate {
                GetCollection(CollectionSort.Default);
            }));
            alertController.AddAction(UIAlertAction.Create("Best Selling", UIAlertActionStyle.Default, delegate {
                GetCollection(CollectionSort.BestSelling);
            }));
            alertController.AddAction(UIAlertAction.Create("Title - Ascending", UIAlertActionStyle.Default, delegate {
                GetCollection(CollectionSort.TitleAscending);
            }));
            alertController.AddAction(UIAlertAction.Create("Title - Descending", UIAlertActionStyle.Default, delegate {
                GetCollection(CollectionSort.TitleDescending);
            }));
            alertController.AddAction(UIAlertAction.Create("Price - Ascending", UIAlertActionStyle.Default, delegate {
                GetCollection(CollectionSort.PriceAscending);
            }));
            alertController.AddAction(UIAlertAction.Create("Price - Descending", UIAlertActionStyle.Default, delegate {
                GetCollection(CollectionSort.PriceDescending);
            }));

            // Note: The BUYCollectionSort.CreatedAscending and BUYCollectionSort.CreatedDescending are currently not supported

            if (TraitCollection.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                UIPopoverPresentationController popPresenter = alertController.PopoverPresentationController;
                popPresenter.BarButtonItem = (UIBarButtonItem)sender;
            }

            alertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

            PresentViewController(alertController, true, null);
        }
Example #15
0
        partial void BtnChangePhoto_TouchUpInside(UIButton sender)
        {
            UIAlertController actionSheetAlert = UIAlertController.Create("Change Profile Photo", "", UIAlertControllerStyle.ActionSheet);

            // Add Actions
            actionSheetAlert.AddAction(UIAlertAction.Create("Remove Current Photo", UIAlertActionStyle.Destructive, (action) => Console.WriteLine("Item One pressed.")));

            actionSheetAlert.AddAction(UIAlertAction.Create("Take Photo", UIAlertActionStyle.Default, (action) => Console.WriteLine("Item Two pressed.")));

            actionSheetAlert.AddAction(UIAlertAction.Create("Choose From Library", UIAlertActionStyle.Default, (action) => Console.WriteLine("Item Three pressed.")));

            actionSheetAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (action) => Console.WriteLine("Cancel button pressed.")));

            // Required for iPad - You must specify a source for the Action Sheet since it is
            // displayed as a popover
            UIPopoverPresentationController presentationPopover = actionSheetAlert.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Display the alert
            this.PresentViewController(actionSheetAlert, true, null);
        }
Example #16
0
        void ActionButton_TouchUpInside()
        {
            var alert  = UIAlertController.Create(null, null, UIAlertControllerStyle.ActionSheet);
            var image  = UIImage.FromBundle("camera.png");
            var camera = UIAlertAction.Create("Camera ", UIAlertActionStyle.Default, (s) => { CameraBtna_TouchUpInside(); });

            camera.SetValueForKey(image, new NSString("image"));


            alert.AddAction(camera);

            var gallery     = UIAlertAction.Create("Gallery", UIAlertActionStyle.Default, (k) => { GalleryButtona_TouchUpInside(); });
            var galleryicon = UIImage.FromBundle("gallery.png");

            gallery.SetValueForKey(galleryicon, new NSString("image"));
            alert.AddAction(gallery);

            var cancelaction = UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null);

            alert.AddAction(cancelaction);
            UIPopoverPresentationController presentationPopover = alert.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Right;
            }
            this.PresentViewController(alert, true, null);
        }
        private void ShowBasemapList()
        {
            // Create a new Alert Controller
            UIAlertController basemapsActionSheet = UIAlertController.Create("Basemaps", "Choose a basemap", UIAlertControllerStyle.ActionSheet);

            // Create an action that will apply a selected basemap
            var changeBasemapAction = new Action <UIAlertAction>((axun) => { _mapViewModel.ChangeBasemap(axun.Title); });

            // Add items to the action sheet to apply each basemap type
            foreach (var bm in _mapViewModel.BasemapChoices)
            {
                UIAlertAction actionItem = UIAlertAction.Create(bm, UIAlertActionStyle.Default, changeBasemapAction);
                basemapsActionSheet.AddAction(actionItem);
            }

            // Required for iPad - You must specify a source for the Action Sheet since it is displayed as a popover
            UIPopoverPresentationController presentationPopover = basemapsActionSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Display the list of basemaps
            this.PresentViewController(basemapsActionSheet, true, null);
        }
Example #18
0
        private void UnitChangeButton_TouchUpInside(object sender, EventArgs e)
        {
            // Create the view controller that will present the list of unit systems.
            UIAlertController unitSystemSelectionAlert =
                UIAlertController.Create("Change unit system", "", UIAlertControllerStyle.ActionSheet);

            // Needed to prevent a crash on iPad.
            UIPopoverPresentationController
                presentationPopover = unitSystemSelectionAlert.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Show an option for each unit system.
            foreach (UnitSystem system in Enum.GetValues(typeof(UnitSystem)))
            {
                // Upon selecting a unit system, update the distance measure.
                unitSystemSelectionAlert.AddAction(UIAlertAction.Create(system.ToString(), UIAlertActionStyle.Default,
                                                                        action => _distanceMeasurement.UnitSystem = system));
            }

            // Show the alert.
            PresentViewController(unitSystemSelectionAlert, true, null);
        }
        public void ShowAlert(string title, string message)
        {
            BeginInvokeOnMainThread(() =>
            {
                UIAlertController alertController = new UIAlertController
                {
                    Title   = title,
                    Message = message
                };

                UIAlertAction alertAction = UIAlertAction.Create("OK", UIAlertActionStyle.Default, null);
                alertController.AddAction(alertAction);

                UIPopoverPresentationController popoverPresenter = alertController.PopoverPresentationController;
                if (null != popoverPresenter)
                {
                    CGRect frame  = UIScreen.MainScreen.Bounds;
                    frame.Height /= 2;
                    popoverPresenter.SourceView = this.View;
                    popoverPresenter.SourceRect = frame;
                }

                this.PresentViewController(alertController, false, null);
            });
        }
        private void ShowFilterOptions()
        {
            if (!ViewModel.Categories.Any())
            {
                return;
            }

            var actionSheetAlert = UIAlertController.Create(
                "Filtrar",
                "Selecione a categoria para filtar os produtos",
                UIAlertControllerStyle.ActionSheet);

            actionSheetAlert.AddAction(UIAlertAction.Create("Todas", UIAlertActionStyle.Default, async(action) => await LoadItemsAsync(null)));

            foreach (var category in ViewModel.Categories)
            {
                actionSheetAlert.AddAction(UIAlertAction.Create(category.Name, UIAlertActionStyle.Default, async(action) => await LoadItemsAsync(category)));
            }

            actionSheetAlert.AddAction(UIAlertAction.Create("Cancelar", UIAlertActionStyle.Cancel, (action) => { }));

            UIPopoverPresentationController presentationPopover = actionSheetAlert.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            PresentViewController(actionSheetAlert, true, null);
        }
        /// <summary>
        /// EVENT FUNCTION FOR ACTION POPUP FOR SINGLE SENSOR
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        void handleActionPopup(object sender, EventArgs e)
        {
            UIAlertController addDeviceSheet;

            addDeviceSheet = UIAlertController.Create(Util.Strings.Analyzer.DEVICEACTIONS, "", UIAlertControllerStyle.Alert);

            UIPopoverPresentationController presentationPopover = addDeviceSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Right;
            }
            if (sensorActions.pressedSensor.isManual.Equals(false))
            {
                addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.Alarms.SELF, UIAlertActionStyle.Default, (action) => {
                    alarmRequestViewer(sensorActions);
                }));
            }
            addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.RENAME, UIAlertActionStyle.Default, (action) => {
                renamePopup();
            }));
            addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.Analyzer.REMOVESENSOR, UIAlertActionStyle.Default, (action) => {
                AnalyserUtilities.RemoveDevice(sensorActions, lowHighSensors, analyzerSensors, ion.currentAnalyzer.sensorList);
                blockerView.Hidden       = true;
                sactionView.aView.Hidden = true;
            }));

            addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.CANCEL, UIAlertActionStyle.Cancel, (action) => { Console.WriteLine("Cancel Action"); blockerView.Hidden = true; }));
            this.View.Window.RootViewController.PresentViewController(addDeviceSheet, true, null);
        }
        private void ShowMapList(IEnumerable <PortalItem> webmapItems)
        {
            // Create a new Alert Controller
            UIAlertController mapListActionSheet = UIAlertController.Create("Web maps", "Choose a map", UIAlertControllerStyle.ActionSheet);

            // Add actions to load the available web maps
            foreach (var item in webmapItems)
            {
                mapListActionSheet.AddAction(UIAlertAction.Create(item.Title, UIAlertActionStyle.Default, (action) => DisplayMap(item.Url)));
            }

            // Add a choice to cancel
            mapListActionSheet.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (action) => Console.WriteLine("Canceled")));

            // Required for iPad - You must specify a source for the Action Sheet since it is displayed as a popover
            UIPopoverPresentationController presentationPopover = mapListActionSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Display the list of maps
            this.PresentViewController(mapListActionSheet, true, null);
        }
Example #23
0
        private void ShowMissionOptions(object sender, EventArgs eventArgs)
        {
            // Create the view controller that will present the list of missions.
            UIAlertController missionSelectionAlert =
                UIAlertController.Create(null, "Select a mission", UIAlertControllerStyle.ActionSheet);

            // Needed to prevent a crash on iPad.
            UIPopoverPresentationController presentationPopover = missionSelectionAlert.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.BarButtonItem            = (UIBarButtonItem)sender;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Add an option for each mission.
            foreach (string item in _missionToItemId.Keys)
            {
                // Selecting the mission will call the ChangeMission method.
                missionSelectionAlert.AddAction(UIAlertAction.Create(item, UIAlertActionStyle.Default, action => ChangeMission(item)));
            }

            // Show the alert.
            PresentViewController(missionSelectionAlert, true, null);
        }
        private void ShowConfigurationWindow(GenerateOfflineMapParameterOverrides overrides)
        {
            if (_overridesVC == null)
            {
                _overridesVC = new ConfigureOverridesViewController(overrides, _myMapView.Map);
            }
            // Show the layer list popover. Note: most behavior is managed by the table view & its source. See MapViewModel.
            var controller = new UINavigationController(_overridesVC);

            controller.Title = "Override parameters";
            // Show a close button in the top right.
            var closeButton = new UIBarButtonItem("Close", UIBarButtonItemStyle.Plain, (o, ea) => controller.DismissViewController(true, null));

            controller.NavigationBar.Items[0].SetRightBarButtonItem(closeButton, false);
            // Show the table view in a popover.
            controller.ModalPresentationStyle = UIModalPresentationStyle.Popover;
            controller.PreferredContentSize   = new CGSize(300, 250);
            UIPopoverPresentationController pc = controller.PopoverPresentationController;

            if (pc != null)
            {
                pc.BarButtonItem            = (UIBarButtonItem)_takeMapOfflineButton;
                pc.PermittedArrowDirections = UIPopoverArrowDirection.Down;
                pc.Delegate = new ppDelegate();
            }

            PresentViewController(controller, true, null);
        }
Example #25
0
        public override void LoadView()
        {
            base.LoadView();
            loadDestination();

            desButton.TouchUpInside += ((sender, e) =>
            {
                UIAlertController destinationSheetAlert = UIAlertController.Create("Where do you want to go?", null, UIAlertControllerStyle.ActionSheet);
                destinationSheetAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (action) => Console.WriteLine("Cancel button pressed.")));
                foreach (var des in choiceOfDes)
                {
                    destinationSheetAlert.AddAction(UIAlertAction.Create(des, UIAlertActionStyle.Default, (action) => selectedDes = des));
                }

                UIPopoverPresentationController presentationPopover5 = destinationSheetAlert.PopoverPresentationController;
                if (presentationPopover5 != null)
                {
                    presentationPopover5.SourceView = this.View;
                    presentationPopover5.PermittedArrowDirections = UIPopoverArrowDirection.Up;
                }

                // Display the alert
                this.PresentViewController(destinationSheetAlert, true, null);
            });

            View.AddSubview(desButton);
        }
        private void LabelPositionButton_Click(object sender, EventArgs e)
        {
            // Create the view controller that will present the list of label positions.
            UIAlertController labelPositionAlert = UIAlertController.Create("Select a label position", "", UIAlertControllerStyle.ActionSheet);

            // Needed to prevent a crash on iPad.
            UIPopoverPresentationController presentationPopover = labelPositionAlert.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            // Add an option for each label position option.
            foreach (string item in Enum.GetNames(typeof(GridLabelPosition)))
            {
                // Record the selection and re-apply all settings.
                labelPositionAlert.AddAction(UIAlertAction.Create(item, UIAlertActionStyle.Default, action =>
                {
                    _selectedLabelPosition = (GridLabelPosition)Enum.Parse(typeof(GridLabelPosition), item);
                    ApplyCurrentSettings();
                }));
            }

            // Show the alert.
            PresentViewController(labelPositionAlert, true, null);
        }
        private void ChooseImageButton_TouchUpInside(object sender, EventArgs e)
        {
            UIAlertController imageSourceAlert = UIAlertController.Create("Choose Image Source", null, UIAlertControllerStyle.ActionSheet);

            imageSourceAlert.AddAction(UIAlertAction.Create("Camera", UIAlertActionStyle.Default, (a) => { OpenCamera(); }));
            imageSourceAlert.AddAction(UIAlertAction.Create("Gallery", UIAlertActionStyle.Default, (a) => { OpenImagePicker(); }));
            imageSourceAlert.AddAction(UIAlertAction.Create("Other Sources", UIAlertActionStyle.Default, (a) => { var suppress = OpenDocumentPicker(); }));

            if (allowParentAsSource)
            {
                imageSourceAlert.AddAction(UIAlertAction.Create(string.Format("Use the Result of Parent '{0}' Task", parentTask.TaskType.DisplayName), UIAlertActionStyle.Default, (a) => { UseParent(); }));
            }

            imageSourceAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

            UIPopoverPresentationController popCont = imageSourceAlert.PopoverPresentationController;

            if (popCont != null)
            {
                popCont.SourceView = ChooseImageButton;
                popCont.SourceRect = ChooseImageButton.Bounds;
                popCont.PermittedArrowDirections = UIPopoverArrowDirection.Down;
            }

            PresentViewController(imageSourceAlert, true, () => { Console.WriteLine("alert presented"); });
        }
Example #28
0
        private void ChangeTraceType(object sender, EventArgs e)
        {
            // Prevent user from tapping map while selecting a trace type.
            _myMapView.GeoViewTapped -= OnGeoViewTapped;

            // Start the UI for the user choosing the trace type.
            UIAlertController prompt = UIAlertController.Create(null, "Choose trace type", UIAlertControllerStyle.ActionSheet);

            // Add a selection action for every valid trace type.
            foreach (string name in new string[] { "Connected", "Subnetwork", "Upstream", "Downstream" })
            {
                prompt.AddAction(UIAlertAction.Create(name, UIAlertActionStyle.Default, TraceTypeClick));
            }

            // Needed to prevent crash on iPad.
            UIPopoverPresentationController ppc = prompt.PopoverPresentationController;

            if (ppc != null)
            {
                ppc.SourceView = _tracePickerButton;
                ppc.PermittedArrowDirections = UIPopoverArrowDirection.Down;
            }

            PresentViewController(prompt, true, null);

            // Enable the main UI again.
            _myMapView.GeoViewTapped += OnGeoViewTapped;
        }
Example #29
0
        public void Selector(List <SelectorItem> items, Action <SelectorItem> selector, SelectorItem cancel, string title = null, string cancelButton = "Cancel")
        {
            UIAlertController alertController = UIAlertController.Create(title, null, UIAlertControllerStyle.ActionSheet);

            foreach (var item in items)
            {
                alertController.AddAction(UIAlertAction.Create(item.Text, UIAlertActionStyle.Default, (obj) => selector(items.ElementAt(item.Id))));
            }
            alertController.AddAction(UIAlertAction.Create(cancelButton, UIAlertActionStyle.Cancel, (obj) => selector(cancel)));

            var window     = UIApplication.SharedApplication.KeyWindow;
            var controller = window.RootViewController;

            while (controller.PresentedViewController != null)
            {
                controller = controller.PresentedViewController;
            }

            UIPopoverPresentationController presentationPopover = alertController.PopoverPresentationController;

            controller = controller.PresentedViewController ?? controller;
            if (presentationPopover != null)
            {
                presentationPopover.SourceView = controller.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
            }

            controller.PresentViewController(alertController, true, null);
        }
Example #30
0
        private void RemoveLayerFromMap_Clicked(object sender, EventArgs e)
        {
            // Create a new Alert Controller.
            UIAlertController layersActionSheet = UIAlertController.Create(null, "Remove a layer from the map", UIAlertControllerStyle.ActionSheet);

            // Add actions to remove a layer from the map.
            foreach (string oneLayerName in _layersInMap)
            {
                layersActionSheet.AddAction(UIAlertAction.Create(oneLayerName, UIAlertActionStyle.Default, action => RemoveLayerFromMap(oneLayerName)));
            }

            // Add a choice to cancel.
            layersActionSheet.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, action => Console.WriteLine("Canceled")));

            // Required for iPad - You must specify a source for the Action Sheet since it is displayed as a popover.
            UIPopoverPresentationController presentationPopover = layersActionSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.BarButtonItem            = (UIBarButtonItem)sender;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Down;
            }

            // Display the list of layers to add/remove.
            PresentViewController(layersActionSheet, true, null);
        }
		void DidDismissPopover (UIPopoverPresentationController popoverPresentationController)
		{
			UIViewController testVC = popoverPresentationController.PresentedViewController;
			if (testVC == currentFilterViewController)
				currentFilterViewController = null;
		}