private void Attachment_Clicked(object sender, AdapterView.ItemClickEventArgs e)
        {
            // Get the selected attachment.
            Attachment selectedAttachment = _featureAttachments[e.Position];

            // Create menu to show options.
            PopupMenu menu = new PopupMenu(this, (ListView)sender);

            // Handle the click, calling the right method depending on the command.
            menu.MenuItemClick += async(o, menuArgs) =>
            {
                menu.Dismiss();
                switch (menuArgs.Item.ToString())
                {
                case "View":
                    await PreviewAttachment(selectedAttachment);

                    break;

                case "Delete":
                    await DeleteAttachment(selectedAttachment);

                    break;
                }
                UpdateUIForFeature();
            };

            // Add the menu commands.
            menu.Menu.Add("View");
            menu.Menu.Add("Delete");

            // Show menu in the view.
            menu.Show();
        }
예제 #2
0
 internal protected override void Close()
 {
     _menu?.Dismiss();
     if (_menu != null)
     {
         _menu.MenuItemClick -= OnMenuItemClick;
         _menu.DismissEvent  -= OnDismiss;
     }
 }
예제 #3
0
 void niTrayIcon_MouseUp(Object sender, System.Windows.Forms.MouseEventArgs e)
 {
     pmnuTrayMenu.DestroyHandle();
     pmnuTrayMenu.Dismiss();
     if (e.Button == MouseButtons.Right)
     {
         MenuCommand mcSelected = pmnuTrayMenu.TrackPopup(Cursor.Position);
     }
 }
        // Methods
        public void ClosePopupMenu()
        {
            if (menu == null)
            {
                return;
            }

            menu.Dismiss();
            menu = null;
        }
        public void Save()
        {
            var       toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            PopupMenu menu    = new PopupMenu(this, toolbar);

            menu.MenuItemClick += (s1, arg1) => {
                string type        = arg1.Item.TitleFormatted.ToString();
                string PathAndName = Path.Combine(Environment.ExternalStorageDirectory.ToString(), FILENAME) + "." + type;
                switch (type)
                {
                case "CSV":
                    grid.Save(PathAndName, GridFileFormat.Csv, System.Text.Encoding.UTF8, GridSaveOptions.SaveColumnHeaders);
                    menu.Dismiss();
                    break;

                case "Txt":
                    grid.Save(PathAndName, GridFileFormat.Text, System.Text.Encoding.UTF8, GridSaveOptions.SaveColumnHeaders);
                    menu.Dismiss();
                    break;

                case "HTML":
                    grid.Save(PathAndName, GridFileFormat.Html, System.Text.Encoding.UTF8, GridSaveOptions.SaveColumnHeaders);
                    menu.Dismiss();
                    break;
                }
                if (type != "Cancel")
                {
                    Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this);
                    alert.SetTitle("Saved");
                    alert.SetMessage("File has been saved to: " + PathAndName);
                    alert.SetPositiveButton("OK", (senderAlert, args) => {});
                    Dialog dialog = alert.Create();
                    dialog.Show();
                }
                if (type == "HTML")
                {
                    //Device.OpenUri(new Uri(PathAndName));
                }
            };
            menu.Inflate(Resource.Layout.PopUp);
            menu.Show();
        }
        public void Save()
        {
            var       toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            PopupMenu menu    = new PopupMenu(this, toolbar);

            menu.MenuItemClick += (s1, arg1) =>
            {
                string type        = arg1.Item.TitleFormatted.ToString();
                string PathAndName = string.Empty;
                switch (type)
                {
                case "pdf":
                    PathAndName = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.ToString(), FILENAME) + "." + type;
                    flexViewer.Save(PathAndName);
                    menu.Dismiss();
                    break;

                case "png":
                    PathAndName = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.ToString(), FILENAME + "{0}") + "." + type;
                    flexViewer.SaveAsPng(PathAndName, GrapeCity.Documents.Common.OutputRange.All);
                    menu.Dismiss();
                    break;
                }
                if (type != "Cancel")
                {
                    Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this);
                    alert.SetTitle(GetString(Resource.String.Saved));
                    alert.SetMessage(GetString(Resource.String.FileSavedTo) + PathAndName);
                    alert.SetPositiveButton("OK", (senderAlert, args) => { });
                    Dialog dialog = alert.Create();
                    dialog.Show();
                }
            };
            menu.Inflate(Resource.Layout.PopUp);
            menu.Show();
        }
예제 #7
0
 internal protected override void Close()
 {
     if (UseNativePopup)
     {
         _menu?.Dismiss();
         if (_menu != null)
         {
             _menu.MenuItemClick -= OnMenuItemClick;
             _menu.DismissEvent  -= OnDismiss;
         }
     }
     else
     {
         base.Close();
     }
 }
        private void ListItem_Click(object sender, AdapterView.ItemClickEventArgs e)
        {
            // Find the list the item belongs to.
            LayerCollection sendingList = sender == _includedListView ? _viewModel.IncludedLayers : _viewModel.ExcludedLayers;

            // Constants for command names.
            const string moveUpCommand        = "Move up";
            const string moveDownCommand      = "Move down";
            const string addToMapCommand      = "Add to map";
            const string removeFromMapCommand = "Remove from map";

            // Create menu to show options.
            _menu = new PopupMenu(this, (ListView)sender);

            // Handle the click, calling the right method depending on the command.
            _menu.MenuItemClick += (o, menuArgs) =>
            {
                _menu.Dismiss();
                switch (menuArgs.Item.ToString())
                {
                case moveUpCommand:
                    _viewModel.PromoteLayer(sendingList, e.Position);
                    break;

                case moveDownCommand:
                    _viewModel.DemoteLayer(sendingList, e.Position);
                    break;

                case addToMapCommand:
                case removeFromMapCommand:
                    _viewModel.MoveLayer(sendingList, e.Position);
                    break;
                }

                // Update the lists in the view.
                UpdateLayerListViews();
            };

            // Add the menu commands.
            _menu.Menu.Add(moveUpCommand);
            _menu.Menu.Add(moveDownCommand);
            _menu.Menu.Add(sender == _includedListView ? removeFromMapCommand : addToMapCommand);

            // Show menu in the view.
            _menu.Show();
        }
예제 #9
0
        void DialogFoto(View view)
        {
            var menu = new PopupMenu(this, view);
            var tags = controller.GetTagsFoto();

            foreach (var item in tags)
            {
                menu.Menu.Add(item);
            }
            menu.MenuItemClick += (object sender, PopupMenu.MenuItemClickEventArgs e) =>
            {
                lastTagFotoSelected = e.Item.ToString();
                menu.Dismiss();
                StartActivityForResult(camera.PerfomCamera(), (int)Camera.CameraCode.OnActivityResultCode);
                OverridePendingTransition(Resource.Animation.abc_slide_in_top,
                                          Resource.Animation.abc_slide_out_top);
            };
            menu.Inflate(Resource.Menu.menu_popup);
            RunOnUiThread(() => menu.Show());
        }
        private void SetupRecyclerView()
        {
            var recyclerView = FindViewById <MvxAdvancedRecyclerView>(Resource.Id.recyclerView);

            var mvxExpandableItemAdapter = recyclerView.AdvancedRecyclerViewAdapter as MvxExpandableItemAdapter;

            mvxExpandableItemAdapter.ChildItemBound += (args) =>
            {
                var playPauseView = args.ViewHolder.ItemView.FindViewById <PlayPauseView>(Resource.Id.play_pause_view);
                playPauseView.SetOnClickListener(new ActionClickListenerWrapper(x =>
                {
                    ViewModel.ItemTapped.Execute(args.DataContext);
                }));

                var overflowMenuView = args.ViewHolder.ItemView.FindViewById(Resource.Id.overflow_item);
                overflowMenuView.SetOnClickListener(new ActionClickListenerWrapper(x =>
                {
                    var overflowMenu = new PopupMenu(this, overflowMenuView);
                    overflowMenu.MenuInflater.Inflate(Resource.Menu.audio_item_menu, overflowMenu.Menu);

                    MenuPopupHelper helper = new MenuPopupHelper(this, (MenuBuilder)overflowMenu.Menu);
                    helper.SetAnchorView(overflowMenuView);
                    helper.SetForceShowIcon(true);
                    helper.Show();

                    overflowMenu.MenuItemClick += (sender, menuArgs) =>
                    {
                        overflowMenu.Dismiss();
                    };
                }));
            };

            mvxExpandableItemAdapter.ChildSwipeItemPinnedStateController.ForLeftSwipe().Pinned += (item) =>
            {
                ViewModel.PinToDelete.Execute(item);
            };
        }