protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.Main);

            Button showPopupMenu = FindViewById<Button> (Resource.Id.popupButton);
            
            showPopupMenu.Click += (s, arg) => {
                
                PopupMenu menu = new PopupMenu (this, showPopupMenu);
                
                // with Android 3 need to use MenuInfater to inflate the menu
                //menu.MenuInflater.Inflate (Resource.Menu.popup_menu, menu.Menu);
                
                // with Android 4 Inflate can be called directly on the menu
                menu.Inflate (Resource.Menu.popup_menu);
                
                menu.MenuItemClick += (s1, arg1) => {
                    Console.WriteLine ("{0} selected", arg1.Item.TitleFormatted);
                };
                
                // Android 4 now has the DismissEvent
                menu.DismissEvent += (s2, arg2) => {
                    Console.WriteLine ("menu dismissed"); 
                };
                
                menu.Show ();
            };
        }
        private async void OnSublayersClicked(object sender, EventArgs e)
        {
            // Make sure that layer and it's sublayers are loaded
            // If layer is already loaded, this returns directly
            await _imageLayer.LoadAsync();

            var sublayersButton = sender as Button;

            // Create menu to change sublayer visibility
            var sublayersMenu = new PopupMenu(this, sublayersButton);
            sublayersMenu.MenuItemClick += OnSublayersMenuItemClicked;

            // Create menu options
            foreach (ArcGISSublayer sublayer in _imageLayer.Sublayers)
                sublayersMenu.Menu.Add(sublayer.Name);

            // Set values to the menu items
            for (int i = 0; i < sublayersMenu.Menu.Size(); i++)
            {
                var menuItem = sublayersMenu.Menu.GetItem(i);

                // Set menu item to contain checkbox
                menuItem.SetCheckable(true);
    
                // Set default value
                menuItem.SetChecked(_imageLayer.Sublayers[i].IsVisible);
            }

            // Show menu in the view
            sublayersMenu.Show();
        }
        private void OnBasemapsMenuItemClicked(object sender, PopupMenu.MenuItemClickEventArgs e)
        {
            // Get title from the selected item
            var selectedBasemapType = e.Item.TitleCondensedFormatted.ToString();

            // Get index that is used to get the selected url
            var selectedIndex = _basemapTypes.ToList().IndexOf(selectedBasemapType);

            switch (selectedIndex)
            {
                case 0:
   
                    // Set the basemap to Topographic
                    _myMapView.Map.Basemap = Basemap.CreateTopographic();
                    break;

                case 1:
                
                    // Set the basemap to Streets
                    _myMapView.Map.Basemap = Basemap.CreateStreets();
                    break;

                case 2:
                
                    // Set the basemap to Imagery
                    _myMapView.Map.Basemap = Basemap.CreateImagery();
                    break;

                case 3:
                
                    // Set the basemap to Oceans
                    _myMapView.Map.Basemap = Basemap.CreateOceans();
                    break;
            }
        }
        private void OnVectorLayersMenuItemClicked(object sender, PopupMenu.MenuItemClickEventArgs e)
        {
            // Get title from the selected item
            var selected = e.Item.TitleCondensedFormatted.ToString();

            // Get index that is used to get the selected url
            var selectedIndex = _vectorLayerNames.ToList().IndexOf(selected);

            switch (selectedIndex)
            {
                case 0:
                    _vectorTiledLayerUrl = _darkGrayUrl;
                    break;

                case 1:
                    _vectorTiledLayerUrl = _streetUrl;
                    break;

                case 2:
                    _vectorTiledLayerUrl = _nightUrl;
                    break;

                case 3:
                    _vectorTiledLayerUrl = _navigationUrl;
                    break;
            }

            // Create new ArcGISVectorTiled layer with the selected service Url 
            _vectorTiledLayer = new ArcGISVectorTiledLayer(new Uri(_vectorTiledLayerUrl));

            // Create a new map with a basemap that was selected. Assign this to the mapview's map 
            _myMapView.Map = new Map(new Basemap(_vectorTiledLayer));
        }
示例#5
0
文件: Prefs.cs 项目: cbudo/SpeedyChef
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Allergens);

            Button allergens_button = FindViewById<Button> (Resource.Id.allergens_button);
            allergens_button.Click += (s, arg) => {
                var intent = new Intent(this, typeof(Allergens));
                StartActivity(intent);
            };
            Button appliances_button = FindViewById<Button> (Resource.Id.oven_button);
            appliances_button.Click += (s, arg) => {
                var intent = new Intent(this, typeof(Appliances));
                StartActivity(intent);
            };
            Button expertise_button = FindViewById<Button> (Resource.Id.expertise_button);
            expertise_button.Click += (s, arg) => {
                var intent = new Intent(this, typeof(Expertise));
                StartActivity(intent);
            };

            //MENU VIEW
            Button menu_button = FindViewById<Button> (Resource.Id.menu_button);
            menu_button.Click += (s, arg) => {
                menu_button.SetBackgroundResource(Resource.Drawable.pressed_lines);
                PopupMenu menu = new PopupMenu (this, menu_button);
                menu.Inflate (Resource.Menu.Main_Menu);
                menu.MenuItemClick += this.MenuButtonClick;
                menu.DismissEvent += (s2, arg2) => {
                    menu_button.SetBackgroundResource(Resource.Drawable.menu_lines);
                    Console.WriteLine ("menu dismissed");
                };
                menu.Show ();
            };
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            //RECYCLER VIEW
            mObject = new SideBySideObject ();
            mAdapter = new SideBySideAdapter (mObject, this, false);
            SetContentView (Resource.Layout.BrowseNationalities);
            mRecyclerView = FindViewById<v7Widget.RecyclerView> (Resource.Id.recyclerView);
            mRecyclerView.SetAdapter (mAdapter);
            mLayoutManager = new v7Widget.LinearLayoutManager (this);
            mRecyclerView.SetLayoutManager (mLayoutManager);

            //MENU VIEW
            Button menu_button = FindViewById<Button> (Resource.Id.menu_button);
            menu_button.Click += (s, arg) => {
                menu_button.SetBackgroundResource(Resource.Drawable.pressed_lines);
                PopupMenu menu = new PopupMenu (this, menu_button);
                menu.Inflate (Resource.Menu.Main_Menu);
                menu.MenuItemClick += this.MenuButtonClick;
                menu.DismissEvent += (s2, arg2) => {
                    menu_button.SetBackgroundResource(Resource.Drawable.menu_lines);
                    Console.WriteLine ("menu dismissed");
                };
                menu.Show ();
            };
        }
示例#7
0
 void OnItemLongClick(object sender, int position)
 {
     //display a popup menu when long pressing an item in the account list
     //handle the menu item (edit and delete options for accounts) click event
     try
     {
         Android.Widget.PopupMenu menu = new Android.Widget.PopupMenu(this, mRecyclerView.FindViewHolderForAdapterPosition(position).ItemView, Android.Views.GravityFlags.Right);
         menu.Inflate(Resource.Layout.popup_menu_transaction);
         menu.MenuItemClick += (s1, arg1) =>
         {
             if (arg1.Item.TitleFormatted.ToString() == "Delete")
             {
                 AlertDialog.Builder builder;
                 builder = new AlertDialog.Builder(this);
                 builder.SetTitle("Delete?");
                 builder.SetMessage("Are you sure you want to delete the transaction: " + transactions[position].Title);
                 builder.SetCancelable(false);
                 builder.SetPositiveButton("Yes", delegate { MainActivity.db.deleteTransaction(accountPK, transactions[position].PK); });
                 builder.SetNegativeButton("Cancel", delegate { builder.Dispose(); });
                 builder.Show();
             }
             Console.WriteLine(transactions[position].Title + " | " + arg1.Item.TitleFormatted + " selected");
         };
         menu.Show();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
示例#8
0
        void IOnClickListener.OnClick(View v)
        {
            Android.Widget.PopupMenu menu = new Android.Widget.PopupMenu(v.Context, v);
            menu.Menu.Add(Menu.None, 0, 0, "ISO & Control Sheet");

            menu.MenuItemClick += Menu_MenuItemClick;

            menu.Show();
        }
示例#9
0
        public void OnClick(View itemView, int position, bool isLongClick)
        {
            try
            {
                if (isLongClick)
                {
                    Toast.MakeText(currentContext, "Notes Options", ToastLength.Short).Show();

                    Android.Widget.PopupMenu menu = new Android.Widget.PopupMenu((Activity)currentContext, itemView);
                    menu.MenuInflater.Inflate(Resource.Menu.notes_Options, menu.Menu);

                    menu.MenuItemClick += (s, arg) =>
                    {
                        if (arg.Item.ItemId.Equals(Resource.Id.editFile))
                        {
                            Toast.MakeText(currentContext, "Edit " + itemView.FindViewById <TextView>(Resource.Id.textView).Text, ToastLength.Short).Show();
                            NoteController controller = new NoteController();
                            TextView       NoteTitle  = itemView.FindViewById <TextView>(Resource.Id.textView);
                            Toast.MakeText(currentContext, NoteTitle.Text.Trim(), ToastLength.Short).Show();

                            List <NoteMini> listOfNoteMini = controller.GetNotePreviews(currentUser.UserName);
                            string          title          = NoteTitle.Text;
                            string          currentNoteId  = null;
                            foreach (NoteMini eachMini in listOfNoteMini)
                            {
                                if (eachMini.Title.Equals(title))
                                {
                                    currentNoteId = eachMini.GUID;
                                    break;
                                }
                            }

                            Note           getStoredNote = controller.GetNote(currentNoteId, currentUser.UserName);
                            CommonActivity activity      = currentContext as CommonActivity;

                            activity.GoToActivity(typeof(NoteEditActivity), false, new KeyValuePair <string, string>("SelectedNote", JsonConvert.SerializeObject(getStoredNote)));

                            //FragmentTransaction transaction = ((Activity)currentContext).FragmentManager.BeginTransaction();


                            //currentDialog = new ShareFileDialog(currentContext);
                            //currentDialog.Show(transaction, "dialog fragment");
                        }
                    };

                    menu.Show();
                }
                else
                {
                    Toast.MakeText(currentContext, "Download Notes", ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Toast.MakeText(currentContext, e.ToString(), ToastLength.Short).Show();
            }
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = new ListView(this.Activity);
            favorites = (MainActivity.databaseConnection.GetAllFavoriteCategoriesAsync().
                             Result).
                                    OrderByDescending(x => x.Updated).ToList();

            view.Adapter = new ArrayAdapter<string>(this.Activity,
                                                    Android.Resource.Layout.SimpleListItem1,
                                                    favorites.Select(x => x.CategoryValue).ToList());

            view.ItemLongClick += (sender, e) =>
            {
                PopupMenu menu = new PopupMenu(this.Activity, view.GetChildAt(e.Position));
                menu.Inflate(Resource.Menu.UnfavoriteMenu);
                menu.Show();

                menu.MenuItemClick += (se, args) =>
                {
                    var result = MainActivity.databaseConnection.DeleteFavoriteCategoryAsync(favorites.ElementAt(e.Position)).Result;
                    if (MainActivity.databaseConnection.StatusCode == Models.codes.ok && result)
                    {
                        lock (favorites)
                        {
                            Activity.RunOnUiThread(() =>
                            {
                                favorites.RemoveAt(e.Position);
                                view.Adapter = new ArrayAdapter<string>(this.Activity,
                                        Android.Resource.Layout.SimpleListItem1,
                                                                        favorites.Select(x => x.CategoryValue).ToList());
                            });
                        }
                    }
                    else
                    {
                        Toast.MakeText(this.Activity, "Something went wrong. We're sorry!", ToastLength.Short).Show();
                    }
                    Console.WriteLine(MainActivity.databaseConnection.StatusMessage);
                };
            };

            view.ItemClick += (sender, e) =>
            {
                var transaction = this.Activity.SupportFragmentManager.BeginTransaction();
                SearchOptionsFragment searchFragment = new SearchOptionsFragment();
                var cat = favorites.ElementAt(e.Position);
                searchFragment.Category = new KeyValuePair<string, string>(cat.CategoryKey, cat.CategoryValue);
                searchFragment.SearchLocation = this.SelectedLocation;

                transaction.Replace(Resource.Id.frameLayout, searchFragment);
                transaction.AddToBackStack(null);
                transaction.Commit();
            };

            return view;
        }
        private void OnMapsMenuItemClicked(object sender, PopupMenu.MenuItemClickEventArgs e)
        {
            // Get title from the selected item
            var selectedMapTitle = e.Item.TitleCondensedFormatted.ToString();

            // Get index that is used to get the selected url
            var selectedIndex = titles.ToList().IndexOf(selectedMapTitle);

            // Create a new Map instance with url of the webmap that selected
            _myMapView.Map = new Map(new Uri(itemURLs[selectedIndex]));
        }
        private void ShowMenu(object sender, EventArgs e)
        {
            popupMenu = ((View)sender).CreatepopupMenu(Resource.Menu.admin_menu);
            popupMenu.MenuItemClick += PopupMenu_MenuItemClick;
            var menu       = popupMenu.Menu;
            var item       = menu.GetItem(1);
            var spanString = new SpannableString(item.TitleFormatted.ToString());

            spanString.SetSpan(new ForegroundColorSpan(ItemView.Resources.GetColor(Resource.Color.color_red, null)), 0, spanString.Length(), 0);
            item.SetTitle(spanString);
            popupMenu.Show();
        }
示例#13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.UMLScherm);

            Button showPopupMenu = FindViewById<Button> (Resource.Id.popupButton);

            showPopupMenu.Click += (s, arg) => {

                PopupMenu menu = new PopupMenu (this, showPopupMenu);

                menu.Inflate (Resource.Menu.popup_menu);
                menu.MenuItemClick += (s1, arg1) => {
                    Console.WriteLine ("{0} selected", arg1.Item.ItemId);
                    switch (arg1.Item.ItemId) {
                    case 2131099658:
                        StartActivity(typeof(MainActivity));
                        break;
                    case 2:
                        break;
                    }
                };
                menu.DismissEvent += (s2, arg2) => {
                    Console.WriteLine ("menu dismissed");
                };

                menu.Show ();
            };

            // Variabels instellen voor document
            ImageView uml_screen = FindViewById<ImageView> (Resource.Id.uml_image);
            string keuze = Intent.GetStringExtra("MenuKeuze") ?? "0";
            Console.WriteLine (keuze);

            // Inladen van juiste UML model.
            switch (keuze) {

            case "1":
                uml_screen.SetImageResource (Resource.Drawable.umleen);
                break;
            case "3":
                uml_screen.SetImageResource (Resource.Drawable.umldrie);
                break;
            case "4":
                uml_screen.SetImageResource (Resource.Drawable.umlvier);
                break;
            case "5":
                uml_screen.SetImageResource (Resource.Drawable.umlvijf);
                break;
            };
        }
示例#14
0
        public void LogOutClick(object sender, EventArgs args)
        {
            Android.Widget.PopupMenu menu = new Android.Widget.PopupMenu(this, usernameBtn);
            menu.MenuInflater.Inflate(Resource.Menu.logout_menu, menu.Menu);

            menu.MenuItemClick += (s, arg) =>
            {
                Toast.MakeText(this, "Logging Out:", ToastLength.Short).Show();
                StartActivity(typeof(LoginActivity));
                Finish();
            };

            menu.Show();
        }
        public void CreateLanguagePopUp()
        {
            popupHelp = new PopupMenu(this, btnLanguage);

            popupHelp.Menu.Add(500, 500, 500, "Python");
            popupHelp.Menu.Add(501, 501, 501, "Pascal");

            popupHelp.MenuItemClick += (sender, e) =>
            {
                ShowPopUpMessage(e.Item.ItemId);
            };

            popupHelp.Show();
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button popMenu = FindViewById<Button>(Resource.Id.popupMenuBtn);
            Button popWindow = FindViewById<Button>(Resource.Id.popupWindowBtn);

           
			
            popMenu.Click += delegate
            {
                    PopupMenu menu = new PopupMenu (this, popMenu);

                    // with Android 3 need to use MenuInfater to inflate the menu
                    //menu.MenuInflater.Inflate (Resource.Menu.popup_menu, menu.Menu);

                    // with Android 4 Inflate can be called directly on the menu
                    menu.Inflate (Resource.Menu.popup_menu);

                    menu.MenuItemClick += (s1, arg1) => {
                            Console.WriteLine ("{0} selected", arg1.Item.TitleFormatted);
                        };

                    // Android 4 now has the DismissEvent
                    menu.DismissEvent += (s2, arg2) => {
                            Console.WriteLine ("menu dismissed"); 
                        };

                    menu.Show ();
            };

            popWindow.Click += delegate
                {
                    LayoutInflater inflater = (LayoutInflater) this.GetSystemService(Context.LayoutInflaterService); 

                    PopupWindow pw = new PopupWindow(inflater.Inflate(Resource.Layout.popup_example, null, false),200,250, true);

                    pw.ShowAtLocation(this.FindViewById(Resource.Id.main), GravityFlags.Center, 0, 0);
                    Button closePopup = (Button)pw.ContentView.FindViewById(Resource.Id.closePopup);
                    closePopup.Click += delegate {
                            pw.Dismiss();
                    };
                };
        }
        private void showPopupMenuButton_Click(object sender, EventArgs e)
        {
            var popupMenu = new Android.Widget.PopupMenu(this, _showPopupMenuButton);
            popupMenu.Inflate(Resource.Menu.popup_menu);
            popupMenu.MenuItemClick += (s1, arg1) =>
            {
                Toast.MakeText(this, arg1.Item.TitleFormatted + " ������", ToastLength.Short).Show();
            };

            popupMenu.DismissEvent += (s2, arg2) => {
                Toast.MakeText(this, "���� �������", ToastLength.Short).Show();
            };

            popupMenu.Show();
        }
        private void OnStartButtonClicked(object sender, EventArgs e)
        {
            var startButton = sender as Button;

            // Create menu to show navigation options
            var navigationMenu = new PopupMenu(this, startButton);
            navigationMenu.MenuItemClick += OnNavigationMenuItemClicked;

            // Create menu options
            foreach (var navigationType in _navigationTypes)
                navigationMenu.Menu.Add(navigationType);

            // Show menu in the view
            navigationMenu.Show();
        }
        private void OnVectorLayersClicked(object sender, EventArgs e)
        {
            var button = sender as Button;

            // Create menu to show options
            var menu = new PopupMenu(this, button);
            menu.MenuItemClick += OnVectorLayersMenuItemClicked;

            // Create menu options
            foreach (var vectorLayerName in _vectorLayerNames)
                menu.Menu.Add(vectorLayerName);

            // Show menu in the view
            menu.Show();
        }
        private void OnMapsClicked(object sender, EventArgs e)
        {
            var mapsButton = sender as Button;

            // Create menu to show map options
            var mapsMenu = new PopupMenu(this, mapsButton);
            mapsMenu.MenuItemClick += OnMapsMenuItemClicked;

            // Create menu options
            foreach (var title in titles)
                mapsMenu.Menu.Add(title);

            // Show menu in the view
            mapsMenu.Show();
        }
        public void CreateTilesPopUp()
        {
            popupHelp = new PopupMenu(this, btnTiles);

            popupHelp.Menu.Add(800, 800, 800, "Map");
            popupHelp.Menu.Add(801, 801, 801, "Road");
            popupHelp.Menu.Add(802, 802, 802, "Shop");

            popupHelp.MenuItemClick += (sender, e) =>
            {
                ShowPopUpMessage(e.Item.ItemId);
            };

            popupHelp.Show();
        }
        private void showPopupMenuButton_Click(object sender, EventArgs e)
        {
            var popupMenu = new Android.Widget.PopupMenu(this, _showPopupMenuButton);

            popupMenu.Inflate(Resource.Menu.popup_menu);
            popupMenu.MenuItemClick += (s1, arg1) =>
            {
                Toast.MakeText(this, arg1.Item.TitleFormatted + " выбран", ToastLength.Short).Show();
            };

            popupMenu.DismissEvent += (s2, arg2) => {
                Toast.MakeText(this, "ћеню свЄрнуто", ToastLength.Short).Show();
            };

            popupMenu.Show();
        }
示例#23
0
        // 카드뷰 레이아웃(message_view) 내 객체들 참조.
        public ReceivedMessageHolder(View iItemView, System.Action <int> iListener) : base(iItemView)
        {
            // Locate and cache view references:
            mProfileImage = iItemView.FindViewById <ImageButton>(Resource.Id.mfr_profileIB);
            mMsg          = iItemView.FindViewById <TextView>(Resource.Id.mfr_msgTV);
            mTime         = iItemView.FindViewById <TextView>(Resource.Id.mfr_timeTV);
            mMmsTag       = iItemView.FindViewById <TextView>(Resource.Id.mfr_mmsTagTV);
            mMmsImage     = iItemView.FindViewById <ImageView>(Resource.Id.mfr_mmsImageIV);

            iItemView.LongClick += (sendet, e) =>
            {
                Android.Widget.PopupMenu menu = new Android.Widget.PopupMenu(Application.Context, iItemView);
                menu.MenuInflater.Inflate(Resource.Menu.toolbar_dialogue, menu.Menu);
                menu.Show();
            };
        }
        private void OnNavigationMenuItemClicked(object sender, PopupMenu.MenuItemClickEventArgs e)
        {
            // Get title from the selected item
            var selectedNavigationType = e.Item.TitleCondensedFormatted.ToString();

            // Get index that is used to get the selected url
            var selectedIndex = _navigationTypes.ToList().IndexOf(selectedNavigationType);

            switch (selectedIndex)
            {
                case 0:
                    // Starts location display with auto pan mode set to Off
                    _myMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Off;

                    //TODO Remove this IsStarted check https://github.com/Esri/arcgis-runtime-samples-xamarin/issues/182
                    if (!_myMapView.LocationDisplay.IsEnabled)
                        _myMapView.LocationDisplay.IsEnabled = true;
                    break;

                case 1:
                    // Starts location display with auto pan mode set to Re-center
                    _myMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Recenter;

                    //TODO Remove this IsStarted check https://github.com/Esri/arcgis-runtime-samples-xamarin/issues/182
                    if (!_myMapView.LocationDisplay.IsEnabled)
                        _myMapView.LocationDisplay.IsEnabled = true;
                    break;

                case 2:
                    // Starts location display with auto pan mode set to Navigation
                    _myMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Navigation;

                    //TODO Remove this IsStarted check https://github.com/Esri/arcgis-runtime-samples-xamarin/issues/182
                    if (!_myMapView.LocationDisplay.IsEnabled)
                        _myMapView.LocationDisplay.IsEnabled = true;
                    break;

                case 3:
                    // Starts location display with auto pan mode set to Compass Navigation
                    _myMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.CompassNavigation;

                    //TODO Remove this IsStarted check https://github.com/Esri/arcgis-runtime-samples-xamarin/issues/182
                    if (!_myMapView.LocationDisplay.IsEnabled)
                        _myMapView.LocationDisplay.IsEnabled = true;
                    break;
            }
        }
示例#25
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            MyView myHolder = holder as MyView;

            myHolder.produto.Text     = this.produtos[position].produto;
            myHolder.valor.Text       = "R$ " + this.produtos[position].valor;
            myHolder.localCompra.Text = this.produtos[position].local;
            myHolder.Data.Text        = this.produtos[position].data;

            /*
             * assim que atribuimos o evento de click em algum botão do recyclerview lembrando que esse updateitem é um metodo
             * holder.moreButton.setOnClickListener(view -> updateItem(position));
             */
            // Para o evento de click do botão na recyclerView
            myHolder.menu.Click += (sender, e) =>
            {
                // A linha abaixo infla o layout para que o menu seja exibido

                Android.Widget.PopupMenu popup = new Android.Widget.PopupMenu(context, myHolder.menu);

                popup.Inflate(Resource.Menu.menu_popup);

                //popup.MenuInflater.Inflate( Resource.Menu.menu_popup, popup.Menu );

                popup.MenuItemClick += (s1, arg1) =>
                {
                    switch (arg1.Item.ItemId)
                    {
                    case Resource.Id.informacao:
                        Toast.MakeText(context, "ola informação", ToastLength.Long).Show();
                        break;

                    case Resource.Id.teste:
                        Toast.MakeText(context, "ola teste", ToastLength.Long).Show();
                        break;

                    default:

                        break;
                    }
                };

                popup.Show();
            };
        }
示例#26
0
        // 카드뷰 레이아웃(message_view) 내 객체들 참조.
        public SentMessageHolder(View iItemView, System.Action <int> iListener) : base(iItemView)
        {
            // Locate and cache view references:
            mMsg      = iItemView.FindViewById <TextView>(Resource.Id.mfs_msgTV);
            mTime     = iItemView.FindViewById <TextView>(Resource.Id.mfs_timeTV);
            mMmsTag   = iItemView.FindViewById <TextView>(Resource.Id.mfs_mmsTagTV);
            mMmsImage = iItemView.FindViewById <ImageView>(Resource.Id.mfs_mmsImageIV);

            // Detect user clicks on the item view and report which item
            // was clicked (by layout position) to the listener:
            iItemView.LongClick += (sender, e) =>
            {
                //iListener(base.LayoutPosition);
                Android.Widget.PopupMenu menu = new Android.Widget.PopupMenu(Application.Context, iItemView);
                menu.MenuInflater.Inflate(Resource.Menu.toolbar_dialogue, menu.Menu);
                menu.Show();
            };
        }
示例#27
0
        // TODO

        /*public async void InitAdapter()
         * {
         *  OfferAdapter = new MyOfferAdapter();//(Application.Context, (IMvxAndroidBindingContext)BindingContext);
         *  OfferAdapter.ItemsSource = new List<int>();
         *  RecyclerView.Adapter = OfferAdapter;
         * }
         *
         * public class MyOfferAdapter : MvxRecyclerAdapter
         * {
         *  public class OfferViewHolder: RecyclerView.ViewHolder
         *  {
         *      public ImageView OverflowView;
         *
         *      public OfferViewHolder(View itemView)
         *          : base(itemView)
         *      {
         *          OverflowView = itemView.FindViewById<ImageView>(Resource.Id.options);
         *      }
         *  }
         *
         *  public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
         *  {
         *      OfferViewHolder vh = holder as OfferViewHolder;
         *
         *      vh.OverflowView.Click += (sender, args) => Toast.MakeText(Application.Context,
         *          $"{position} item is selected", ToastLength.Short).Show();
         *  }
         *
         *  public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
         *  {
         *      var itemView = LayoutInflater.From(parent.Context).
         *                  Inflate(Resource.Layout.listitem_offer_my, parent, false);
         *      return new OfferViewHolder(itemView);
         *  }
         * }*/

        private void ShowPopupMenu(View v)
        {
            PopupMenu popupMenu = new PopupMenu(Context, v);

            popupMenu.Inflate(Resource.Xml.popupmenu_offer);

            popupMenu.MenuItemClick += (sender, args) =>
            {
                switch (args.Item.ItemId)
                {
                case Resource.Id.action_edit:
                    return;

                case Resource.Id.action_remove:
                    return;
                }
            };
        }
示例#28
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.PopupLayout);
            Button button = FindViewById<Button>(Resource.Id.button);

            button.Click += (s, e) => {           
                PopupMenu menu = new PopupMenu (this, button);
                menu.Inflate (Resource.Menu.popupmenu);
                menu.MenuItemClick += (s1, e2) => {
                    Console.WriteLine ("{0} Selected", e2.Item.TitleFormatted);
                };
                menu.DismissEvent += (s2, e2) => {
                    Console.WriteLine ("Menu Dismissed"); 
                };
                menu.Show ();
            };
        }
示例#29
0
        public void OnClick(View itemView, int position, bool isLongClick)
        {
            try
            {
                if (isLongClick)
                {
                    Toast.MakeText(context, "Share Options", ToastLength.Short).Show();

                    Android.Widget.PopupMenu menu = new Android.Widget.PopupMenu((Activity)context, itemView);
                    menu.MenuInflater.Inflate(Resource.Menu.longPress_FileMenu, menu.Menu);

                    menu.MenuItemClick += (s, arg) =>
                    {
                        if (arg.Item.ItemId.Equals(Resource.Id.ShareFileItem))
                        {
                            FragmentTransaction transaction = ((Activity)context).FragmentManager.BeginTransaction();


                            currentDialog = new ShareFileDialog(context);
                            currentDialog.Show(transaction, "dialog fragment");
                        }
                        else if (arg.Item.ItemId.Equals(Resource.Id.DeleteFileItem))
                        {
                            Toast.MakeText(context, "Delete File", ToastLength.Short).Show();
                            FileController fileController = new FileController();
                            // fileController.DeleteFile();
                            itemView.FindViewById(Resource.Id.textView);
                        }
                    };

                    menu.Show();
                }
                else
                {
                    Toast.MakeText(context, "Downloaded File ", ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Toast.MakeText(context, e.ToString(), ToastLength.Short).Show();
            }
        }
示例#30
0
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.fragment_popup_menu, container, false);
            var btn = view.FindViewById<Button>(Resource.Id.fragment_popup_menu_button);
            btn.Click += delegate {
                var menu = new PopupMenu(this.Activity, btn);
                menu.Inflate(Resource.Menu.fragment_popup_menu_popup);

                menu.MenuItemClick += (sender, e) => {
                    Toast.MakeText(this.Activity, string.Format("{0} selected", e.Item.TitleFormatted), ToastLength.Short).Show();
                };

                menu.DismissEvent += (sender, e) => {
                    Toast.MakeText(this.Activity, "menu dismissed", ToastLength.Short).Show();
                };

                menu.Show();
            };
            return view;
        }
示例#31
0
 //EVENT - triggered when an account is long clicked
 void OnItemLongClick(object sender, int position)
 {
     //display a popup menu
     try{
         Android.Widget.PopupMenu menu = new Android.Widget.PopupMenu(this, mRecyclerView.FindViewHolderForAdapterPosition(position).ItemView, Android.Views.GravityFlags.Right);
         menu.Inflate(Resource.Layout.popup_menu_account);
         menu.MenuItemClick += (s1, arg1) =>
         {
             //edit is selected from the popup menu
             if (arg1.Item.TitleFormatted.ToString() == "Edit")
             {
                 //Toast.MakeText(this, accounts[position].Name + " | " + arg1.Item.TitleFormatted + " selected", ToastLength.Short).Show();
                 var intent = new Intent(this, typeof(Add_Edit_Account));
                 intent.PutExtra("Type", "Edit");     //inform this is account edit
                 intent.PutExtra("AccountPK", accounts[position].PK);
                 StartActivity(intent);
             }
             //delete is selected from the popup menu
             else if (arg1.Item.TitleFormatted.ToString() == "Delete")
             {
                 //display a confirmation popup box with yes or cancel options
                 AlertDialog.Builder builder;
                 builder = new AlertDialog.Builder(this);
                 builder.SetTitle("Delete?");
                 builder.SetMessage("Are you sure you want to delete the account: " + accounts[position].Name);
                 builder.SetCancelable(false);
                 //when yes is selected - delete account
                 builder.SetPositiveButton("Yes", delegate { db.deleteAccount(accounts[position].PK); });
                 //when cancel is selected - close confirmation box with no action
                 builder.SetNegativeButton("Cancel", delegate { builder.Dispose(); });
                 builder.Show();
             }
             Console.WriteLine(accounts[position].Name + " | " + arg1.Item.TitleFormatted + " selected");
         };
         menu.Show();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
        private void OnPopupMenuClick(object sender, EventArgs e, int pos)
        {
            var menu = new Android.Widget.PopupMenu(_context, (View)sender);

            menu.MenuItemClick += (s, args) =>
            {
                switch (args.Item.ItemId)
                {
                case Resource.Id.popup_song_play:
                {
                    MusicPlayer.PlayAll(_context, GetSongIds(), pos, -1, MusicUtils.SourceTypeId.NA, false);
                    break;
                }

                case Resource.Id.popup_song_goto_album:
                {
                    NavigationUtils.GoToAlbum(_context, _songs[pos].AlbumId);
                    break;
                }

                case Resource.Id.popup_song_goto_artist:
                {
                    NavigationUtils.GoToArtist(_context, _songs[pos].ArtistId);
                    break;
                }

                case Resource.Id.popup_song_addto_playlist:
                {
                    // TODO: Create add to dialog
                    AddPlaylistDialog.GetInstance(_songs[pos]).Show(((AppCompatActivity)_context).SupportFragmentManager, "Add to playlist");     // not finish
                    break;
                }

                case Resource.Id.popup_song_delete:
                {
                    MusicUtils.ShowDeleteSongDialog(_context, new long[] { _songs[pos].Id });
                    break;
                }
                }
            };
        }
        public MoneyViewHolder(View itemView) : base(itemView)
        {
            Cheeseknife.Inject(this, itemView);
            itemView.SetOnClickListener(this);

            ItemView.Context.DoWithAdmin(() =>
            {
                btnAdmin.Visibility = ViewStates.Visible;
                btnAdmin.Click     += (s, e) =>
                {
                    popupMenu = ((View)s).CreatepopupMenu(Resource.Menu.admin_menu);
                    popupMenu.MenuItemClick += PopupMenu_MenuItemClick;
                    var menu       = popupMenu.Menu;
                    var item       = menu.GetItem(1);
                    var spanString = new SpannableString(item.TitleFormatted.ToString());
                    spanString.SetSpan(new ForegroundColorSpan(ItemView.Resources.GetColor(Resource.Color.color_red, null)), 0, spanString.Length(), 0); //fix the color to white
                    item.SetTitle(spanString);
                    popupMenu.Show();
                };
            });
        }
        void Initialize()
        {
            Adapter = adapter = new FeedResultsAdapter(_context,
                                                new ObservableCollection<Posting>(MainActivity.databaseConnection.GetAllPostingsAsync().Result));

            ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                var transaction = ((MainActivity)_context).SupportFragmentManager.BeginTransaction();
                PostingDetailsFragment postingDetailsFragment = new PostingDetailsFragment();
                postingDetailsFragment.Posting = adapter.Postings[e.Position];
                transaction.Replace(Resource.Id.frameLayout, postingDetailsFragment);
                transaction.AddToBackStack(null);
                transaction.Commit();
            };

            if (_deleteable)
            {
                ItemLongClick += (sender, e) =>
                {
                    PopupMenu menu = new PopupMenu(_context, GetChildAt(e.Position));
                    menu.Inflate(Resource.Menu.DeleteMenu);
                    menu.Show();

                    menu.MenuItemClick += (se, args) =>
                    {
                        Console.WriteLine("Deleting posting index: " + e.Position);
                        lock (adapter.Postings)
                        {
                            var del = MainActivity.databaseConnection.DeletePostingAsync(adapter.Postings[e.Position]).Result;

                            ((Activity)_context).RunOnUiThread(() => adapter.Postings.RemoveAt(e.Position));

                            adapter.NotifyDataSetChanged();
                        }
                        Console.WriteLine(MainActivity.databaseConnection.StatusMessage);
                    };
                };
            };
        }
示例#35
0
        public void OnClick(View itemView, int position, bool isLongClick)
        {
            try
            {
                if (isLongClick)
                {
                    Toast.MakeText(_context, "Goal Options", ToastLength.Short).Show();

                    Android.Widget.PopupMenu menu = new Android.Widget.PopupMenu((Activity)_context, itemView);
                    menu.MenuInflater.Inflate(Resource.Menu.longPress_GoalMenu, menu.Menu);

                    menu.MenuItemClick += (s, arg) =>
                    {
                        if (_context is CommonActivity activity)
                        {
                            if (arg.Item.ItemId.Equals(Resource.Id.CompleteGoal))
                            {
                                activity.goalController.CompleteGoal(mGoalAlbum[position].GUID, _currentAccount.UserName);
                                new ServerIOController().AddPoints(_currentAccount.UserName, mGoalAlbum[position].Points);
                            }
                            else if (arg.Item.ItemId.Equals(Resource.Id.DeleteGoal))
                            {
                                activity.goalController.CompleteGoal(mGoalAlbum[position].GUID, _currentAccount.UserName);
                            }
                        }
                    };

                    menu.Show();
                }
                //else
                //{
                //    Toast.MakeText(_context, "Downloaded File ", ToastLength.Short).Show();
                //}
            }
            catch (Exception e)
            {
                Toast.MakeText(_context, e.ToString(), ToastLength.Short).Show();
            }
        }
        protected override void OnAttached()
        {
            Effect = (CustomControl.PopupMenuControl.PopupMenu.InternalPopupEffect)Element.Effects.FirstOrDefault(e => e is CustomControl.PopupMenuControl.PopupMenu.InternalPopupEffect);

            if (Effect != null)
            {
                Effect.Parent.OnPopupRequest += OnPopupRequest;
            }

            MessagingCenter.Unsubscribe <string, string>("CustomControl", "ClosePopup");

            if (Control != null || Container != null)
            {
                ToggleMenu = new Android.Widget.PopupMenu(Forms.Context, Control == null ? Container : Control);
                ToggleMenu.MenuItemClick += MenuItemClick;
                MessagingCenter.Subscribe <string, string>("CustomControl", "ClosePopup", (sender, args) =>
                {
                    Xamarin.Forms.Application.Current.Dispatcher.BeginInvokeOnMainThread(() =>
                    {
                        ToggleMenu.Dismiss();
                    });
                });
            }
        }
示例#37
0
        void OnListItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            CNNote item = listData.ElementAt (e.Position);
            PopupMenu menu = new PopupMenu (e.Parent.Context, e.View);
            menu.Inflate (Resource.Menu.popupHis);
            menu.MenuItemClick += (s1, arg1) => {

                if (arg1.Item.TitleFormatted.ToString ().ToLower () == "print") {
                    PrintInv (item,1);
                }else if (arg1.Item.TitleFormatted.ToString ().ToLower () == "print 2 copy") {
                    PrintInv (item,2);
                }  else if (arg1.Item.TitleFormatted.ToString ().ToLower () == "filter") {
                    ShowDateRangeLookUp();
                }
            };
            menu.Show ();
        }
示例#38
0
        void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            CNNoteDtls item = listData.ElementAt (e.Position);
            if (item.icode.IndexOf ("TOTAL") > -1)
                return;

            PopupMenu menu = new PopupMenu (e.Parent.Context, e.View);
            menu.Inflate (Resource.Menu.popupItem);
            if (!comp.AllowEdit) {
                menu.Menu.RemoveItem (Resource.Id.popedit);
            }
            if (!comp.AllowDelete) {
                menu.Menu.RemoveItem (Resource.Id.popdelete);
            }

            //if allow edit and Invoice printed, remove edit
            //printed invoice not allow to edit
            if (DataHelper.GetCNNotePrintStatus (pathToDatabase, invno)) {
                menu.Menu.RemoveItem (Resource.Id.popedit);
                menu.Menu.RemoveItem (Resource.Id.popdelete);
                menu.Menu.RemoveItem (Resource.Id.popadd);
            }

            menu.MenuItemClick += (s1, arg1) => {
                if (arg1.Item.TitleFormatted.ToString().ToLower()=="add")
                {
                    NewItem(item.cnno);
                }else if (arg1.Item.TitleFormatted.ToString().ToLower()=="edit")
                {
                    Edit(item);
                } else if (arg1.Item.TitleFormatted.ToString().ToLower()=="delete")
                {
                    Delete(item);
                }

            };
            menu.Show ();
        }
示例#39
0
        //----------------------------------------------------------------------------------------------- PopUp button and help button
        // PopUp button and help button appear in all layouts
        public void SetPopUpAndHelp()
        {
            // Build and shows a PopupMenu, used for the selection of layouts
            ImageButton showPopupMenu = FindViewById<ImageButton> (Resource.Id.PopUp);
            showPopupMenu.Click += (s, arg) => {
                PopupMenu menu = new PopupMenu (this, showPopupMenu); // Here the button is made into a popupMenu
                menu.Inflate (Resource.Menu.popup_menu); // Loads our popup_menu.xml

                menu.MenuItemClick += (s1, arg1) => {
                    // This switch case checks which item (layout) has been clicked
                    // and sets the layout accordingly
                    switch (arg1.Item.ItemId)
                    {
                        case Resource.Id.item1:
                            SetLayout1();
                            break;
                        case Resource.Id.item2:
                            SetLayout2();
                            break;
                        case Resource.Id.item3:
                            SetLayout3();
                            break;
                    }
                };

                menu.DismissEvent += (s2, arg2) => {
                    Console.WriteLine ("menu dismissed");
                };

                // This line draws the menu
                menu.Show ();
            };

            // Opens a dialog (popup screen) when clicking the help button
            ImageButton helpButton = FindViewById<ImageButton> (Resource.Id.HelpButton);
            helpButton.Click += OpenHelpDialog;
        }
        private void ProfilePopup()
        {
            var menu = new PopupMenu (this, action);
                menu.Inflate (Resource.Menu.Popup);
                int count = 0;
                foreach(Profiel p in _appController.DistinctProfielen) {
                    menu.Menu.Add(0,count,count,p.name);
                    count++;
                }

                menu.Menu.Add(0,count,count, "Nieuw profiel");

                menu.MenuItemClick += (s1, arg1) => {
                    if(arg1.Item.ItemId == count) {
                        var alert = new AlertDialog.Builder (this);
                        alert.SetTitle ("Nieuw profiel");
                        var input = new EditText (this);
                        input.InputType = InputTypes.TextFlagCapWords;
                        input.Hint = "Naam";
                        KeyboardHelper.ShowKeyboard(this, input);
                        alert.SetView (input);
                        alert.SetPositiveButton ("Ok", (s, args) => {
                            string value = input.Text;
                            if(value.Replace("'", "").Replace(" ", "").Equals("")) {
                                mToast.SetText("Ongeldige naam");
                                mToast.Show();
                            } else if(_appController.GetProfielNamen().Contains(value)) {
                                input.Text = "";
                                mToast.SetText("Profiel " + value + " bestaat al");
                                mToast.Show();
                            } else {
                                _appController.AddProfile(value);
                                _appController.AddTotemToProfiel(_appController.CurrentTotem.nid, value);
                                mToast.SetText((hidden ? "Totem" : _appController.GetTotemOnID(_appController.CurrentTotem.nid).title) + " toegevoegd aan profiel " + value.Replace("'", ""));
                                mToast.Show();
                            }
                        });

                        AlertDialog d1 = alert.Create();

                        //add profile when enter is clicked
                        input.EditorAction += (s2, e) => {
                            if (e.ActionId == ImeAction.Done)
                                d1.GetButton(-1).PerformClick();
                            else
                                e.Handled = false;
                        };

                    RunOnUiThread (d1.Show);

                    } else {
                        _appController.AddTotemToProfiel(_appController.CurrentTotem.nid, arg1.Item.TitleFormatted.ToString());
                        mToast.SetText((hidden ? "Totem" : _appController.GetTotemOnID(_appController.CurrentTotem.nid).title) + " toegevoegd aan profiel " + arg1.Item.TitleFormatted);
                        mToast.Show();
                    }
                };

                menu.Show ();
        }
 public void MenuButtonSetupSuperClass(Button m_button)
 {
     m_button.Click += (s, arg) => {
         m_button.SetBackgroundResource(Resource.Drawable.pressed_lines);
         PopupMenu menu = new PopupMenu (this, m_button);
         menu.Inflate (Resource.Menu.Main_Menu);
         menu.MenuItemClick += this.MenuButtonClick;
         menu.DismissEvent += (s2, arg2) => {
             m_button.SetBackgroundResource(Resource.Drawable.menu_lines);
             Console.WriteLine ("menu dismissed");
         };
         menu.Show ();
     };
 }
示例#42
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            if (convertView != null && convertView is View)
            {
                return(convertView);
            }

            var set = _sets[position];

            var row = (convertView ?? LayoutInflater.FromContext(_context).Inflate(Resource.Layout.row_add_log, parent, false));

            var lblSetNbr  = row.FindViewById <TextView>(Resource.Id.lblSetNbr);
            var txtStatOne = row.FindViewById <EditText>(Resource.Id.txtStatOne);
            var lblStatOne = row.FindViewById <TextView>(Resource.Id.lblStatOne);
            var txtStatTwo = row.FindViewById <EditText>(Resource.Id.txtStatTwo);
            var lblStatTwo = row.FindViewById <TextView>(Resource.Id.lblStatTwo);
            var btnMenu    = row.FindViewById <ImageButton>(Resource.Id.btnMenu);


            /* add delet button on sub menu */
            btnMenu.Click += (s, e) =>
            {
                var menu = new Android.Widget.PopupMenu(this._context, btnMenu);
                menu.Inflate(Resource.Menu.menu_add_set);
                menu.MenuItemClick += (s1, arg1) => {
                    if (RemoveSetClick != null)
                    {
                        RemoveSetClick(this, position);
                    }
                };

                menu.Show();
            };

            /* set number */
            lblSetNbr.Text = (position + 1).ToString();


            //set metric labels
            var statCount = 0;

            foreach (var input in set.Inputs)
            {
                if (statCount == 0)
                {
                    lblStatOne.Text = input.Label;
                    txtStatOne.Text = input.ValueAsString;
                    // txtStatOne.InputType = Android.Text.InputTypes.DatetimeVariationTime;
                }
                else
                {
                    lblStatTwo.Text = input.Label;
                    txtStatTwo.Text = input.ValueAsString;
                }
                statCount++;
            }


            if (position == _sets.Count - 1)
            {
                txtStatOne.RequestFocus();
            }


            //set event handlers
            txtStatOne.TextChanged += (s, e) =>
            {
                if (!String.IsNullOrWhiteSpace(txtStatOne.Text))
                {
                    set.StatOne = Convert.ToDouble(txtStatOne.Text);
                    set.Save();
                }
            };

            if (statCount > 1)
            {
                txtStatTwo.TextChanged += (s, e) =>
                {
                    if (!String.IsNullOrWhiteSpace(txtStatTwo.Text))
                    {
                        set.StatTwo = Convert.ToDouble(txtStatTwo.Text);
                        set.Save();
                    }
                };
            }
            else
            {
                txtStatTwo.Visibility = ViewStates.Gone;
                lblStatTwo.Visibility = ViewStates.Gone;
            }


            //Finally return the view
            return(row);
        }
示例#43
0
 public void OnDismiss(PopupMenu menu)
 {
     Dismiss.Invoke(menu, EventArgs.Empty);
 }
示例#44
0
        //        void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e) {
        //            Invoice item = listData.ElementAt (e.Position);
        //            //var intent = new Intent(this, typeof(InvItemActivity));
        //            var intent =ActivityManager.GetActivity<InvItemActivity>(this.ApplicationContext);
        //            intent.PutExtra ("invoiceno",item.invno );
        //            intent.PutExtra ("custcode",item.custcode );
        //            StartActivity(intent);
        //        }
        void OnListItemLongClick(object sender, AdapterView.ItemClickEventArgs  e)
        {
            Invoice item = listData.ElementAt (e.Position);
            PopupMenu menu = new PopupMenu (e.Parent.Context, e.View);
            menu.Inflate (Resource.Menu.popupInv);
            var mitem =menu.Menu.FindItem(Resource.Id.poppay);
            mitem.SetVisible (true);
            menu.Menu.RemoveItem (Resource.Id.popInvdelete);
            menu.Menu.RemoveItem (Resource.Id.popInvadd);
            menu.Menu.RemoveItem (Resource.Id.poppay);
            bool  isNotAllowEditAfterPrinted  = DataHelper.GetCashBillPrintStatus (pathToDatabase,item.invno,rights);

            if (isNotAllowEditAfterPrinted) {
                menu.Menu.RemoveItem (Resource.Id.popInvedit);
            }

            if (!rights.CSAllowPrint) {
                menu.Menu.RemoveItem (Resource.Id.popInvprint);
                menu.Menu.RemoveItem (Resource.Id.popInvprint2);
            }

            if (DataHelper.GetCashBillPrintStatus(pathToDatabase, item.invno,rights)) {
                menu.Menu.RemoveItem (Resource.Id.popInvdelete);
                menu.Menu.RemoveItem (Resource.Id.popInvedit);
            }
            menu.MenuItemClick += (s1, arg1) => {
                if (arg1.Item.ItemId==Resource.Id.popInvadd)
                {
                    CreateNewInvoice();
                }else if (arg1.Item.ItemId==Resource.Id.popInvprint)
                {
                    PrintInv(item,1);
                }else if (arg1.Item.ItemId==Resource.Id.popInvprint2)
                {
                    PrintInv(item,2);

                } else if (arg1.Item.ItemId==Resource.Id.popInvdelete)
                {
                    Delete(item);
                }else if (arg1.Item.ItemId==Resource.Id.popInvedit)
                {
                    Edit(item);
                }
                else if (arg1.Item.ItemId==Resource.Id.poppay)
                {
                    payment(item);
                }

            };
            menu.Show ();
        }
示例#45
0
 public void OnOverflowClick(object sender, EventArgs args)
 {
     PopupMenu popupMenu = new PopupMenu (this, this.overflowButton);
     popupMenu.MenuInflater.Inflate (Resource.Menu.mainmenu, popupMenu.Menu);
     popupMenu.Show ();
 }
		//SuppressLint("NewApi")
		public bool OnCreateActionMode (ActionMode mode, Android.Views.IMenu menu)
		{
			mode.MenuInflater.Inflate (Resource.Menu.inbox_actions_menu, menu);

			// Add a pop up menu to the action bar to select/deselect all
			// Pop up menu requires api >= 11
			if ((int)Build.VERSION.SdkInt >= (int)BuildVersionCodes.Honeycomb) {
				View customView = LayoutInflater.From (this).Inflate (Resource.Layout.cab_selection_dropdown, null);
				actionSelectionButton = (Button)customView.FindViewById (Resource.Id.selection_button);

				PopupMenu popupMenu = new PopupMenu (this, customView);
				popupMenu.MenuInflater.Inflate (Resource.Menu.selection, popupMenu.Menu);
				popupMenu.MenuItemClick += (sender, e) => {
					var item = e.Item;
					if (item.ItemId == Resource.Id.menu_deselect_all) {
						inbox.ClearSelection ();
					} else {
						inbox.SelectAll ();
					}
					e.Handled = true;
				};

				actionSelectionButton.Click += (sender, e) => {
					var _menu = popupMenu.Menu;
					_menu.FindItem (Resource.Id.menu_deselect_all).SetVisible (true);
					_menu.FindItem (Resource.Id.menu_select_all).SetVisible (inbox.SelectedMessages.Count != messages.Count);
					popupMenu.Show ();
				};

				mode.CustomView = customView;
			}

			return true;
		}
示例#47
0
 public void OnDismiss(PopupMenu menu)
 {
     Dismiss.Invoke(menu, EventArgs.Empty);
 }
示例#48
0
        void OnListItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            SaleOrder item = listData.ElementAt (e.Position);
            PopupMenu menu = new PopupMenu (e.Parent.Context, e.View);
            menu.Inflate (Resource.Menu.popupInv);
            menu.Menu.RemoveItem (Resource.Id.poppay);
            menu.Menu.RemoveItem (Resource.Id.popInvdelete);
            if (!rights.SOAllowAdd) {
                menu.Menu.RemoveItem (Resource.Id.popInvadd);
            }

            if (!rights.SOAllowEdit) {
                menu.Menu.RemoveItem (Resource.Id.popInvedit);
            }

            if (!rights.SOAllowPrint) {
                menu.Menu.RemoveItem (Resource.Id.popInvprint);
                menu.Menu.RemoveItem (Resource.Id.popInvprint2);
            }

            if (DataHelper.GetSaleOrderPrintStatus(pathToDatabase, item.sono,rights)) {
                menu.Menu.RemoveItem (Resource.Id.popInvdelete);
                menu.Menu.RemoveItem (Resource.Id.popInvedit);
            }

            menu.MenuItemClick += (s1, arg1) => {
                if (arg1.Item.ItemId==Resource.Id.popInvadd)
                {
                    CreateNewSaleOrder();
                }else if (arg1.Item.ItemId==Resource.Id.popInvprint)
                {
                    PrintInv(item,1);
                }else if (arg1.Item.ItemId==Resource.Id.popInvprint2)
                {
                    PrintInv(item,2);

                } else if (arg1.Item.ItemId==Resource.Id.popInvdelete)
                {
                    Delete(item);
                }else if (arg1.Item.ItemId==Resource.Id.popInvedit)
                {
                    Edit(item);
                }

            };
            menu.Show ();
        }
        // Onclick Pop Up menu
        public void OnClick(View v, int pos)
        {
            var menu = new PopupMenu(_context, v);

            menu.MenuItemClick += (s, arg) =>
            {
                switch (arg.Item.ItemId)
                {
                case Resource.Id.popup_song_remove_playlist:
                {
                    MusicUtils.RemoveFromPlaylist(_context, _songs[pos].Id, _playlistId);
                    _songs.RemoveAt(pos);
                    NotifyItemRemoved(pos);
                    break;
                }

                case Resource.Id.popup_song_play:
                {
                    MusicPlayer.PlayAll(_context, _songIds, pos, -1, MusicUtils.SourceTypeId.NA, false);
                    break;
                }

                case Resource.Id.popup_song_play_next:
                {
                    MusicPlayer.PlayNext(_context, new long[] { _songs[pos].Id }, -1, MusicUtils.SourceTypeId.NA);
                    break;
                }

                case Resource.Id.popup_song_goto_album:
                {
                    NavigationUtils.GoToAlbum(_context, _songs[pos].AlbumId);
                    break;
                }

                case Resource.Id.popup_song_goto_artist:
                {
                    NavigationUtils.GoToArtist(_context, _songs[pos].ArtistId);
                    break;
                }

                case Resource.Id.popup_song_addto_queue:
                {
                    MusicPlayer.AddToQueue(_context, new long[] { _songs[pos].Id }, -1, MusicUtils.SourceTypeId.NA);
                    break;
                }

                case Resource.Id.popup_song_addto_playlist:
                {
                    // TODO: Create add to dialog
                    AddPlaylistDialog.GetInstance(_songs[pos]).Show(_context.SupportFragmentManager, "Add to playlist");     // not finish
                    break;
                }

                case Resource.Id.popup_song_share:
                {
                    MusicUtils.ShareSong(_context, _songs[pos].Id);
                    break;
                }

                case Resource.Id.popup_song_delete:
                {
                    MusicUtils.ShowDeleteSongDialog(_context, new long[] { _songs[pos].Id });
                    break;
                }

                default:
                    break;
                }
            };
            menu.Inflate(Resource.Menu.popup_song);
            menu.Show();
            if (_isPlaylist)
            {
                menu.Menu.FindItem(Resource.Id.popup_song_remove_playlist).SetVisible(true);
            }
        }