Пример #1
0
        public ManageCategoriesListHolder(View itemView) : base(itemView)
        {
            Name = itemView.FindViewById <TextView>(Resource.Id.textName);

            var menuButton = itemView.FindViewById <ImageButton>(Resource.Id.buttonMenu);

            menuButton.Click += delegate { MenuClick?.Invoke(this, AdapterPosition); };
        }
Пример #2
0
        public MenuItem AddItem(string text, MenuClick click = null)
        {
            var new_item = new MenuItem();

            new_item.Text  = text;
            new_item.Click = click;
            Items.Add(new_item);
            return(new_item);
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="menuItem"></param>
        protected virtual void OnMenuClick(MenuItem menuItem)
        {
            var filepath = getFilepath(menuItem);

            if (string.IsNullOrEmpty(filepath))
            {
                return;
            }

            MenuClick?.Invoke(menuItem, new MenuClickEventArgs(filepath));
        }
Пример #4
0
        public AuthenticatorListHolder(View view) : base(view)
        {
            Issuer        = view.FindViewById <TextView>(Resource.Id.textIssuer);
            Username      = view.FindViewById <TextView>(Resource.Id.textUsername);
            Code          = view.FindViewById <TextView>(Resource.Id.textCode);
            ProgressBar   = view.FindViewById <ProgressBar>(Resource.Id.progressBar);
            RefreshButton = view.FindViewById <ImageButton>(Resource.Id.buttonRefresh);
            Icon          = view.FindViewById <ImageView>(Resource.Id.imageIcon);

            var menuButton = view.FindViewById <ImageButton>(Resource.Id.buttonMenu);

            view.Click          += delegate { Click?.Invoke(this, AdapterPosition); };
            menuButton.Click    += delegate { MenuClick?.Invoke(this, AdapterPosition); };
            RefreshButton.Click += delegate { RefreshClick?.Invoke(this, AdapterPosition); };
        }
Пример #5
0
 /// <summary>
 ///     引发 System.Windows.Forms.Form.MouseUp。
 /// </summary>
 /// <param name="e">包含事件数据的 System.Windows.Forms.MouseEventArgs。</param>
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     if (TitleBarMenuRect.Contains(e.Location) && TitleBarMenuState == TMouseState.Down)
     {
         TitleBarMenuState = TMouseState.Up;
         MenuClick?.Invoke(this, EventArgs.Empty);
         var contextMenuStrip = MenuLabel.ContextMenuStrip;
         if (contextMenuStrip != null)
         {
             contextMenuStrip.Closed -= ContextMenuStrip_Closed;
             contextMenuStrip.Closed += ContextMenuStrip_Closed;
             var point = PointToScreen(new Point(TitleBarMenuRect.Left + TitleBarMenuRect.Width / 2 - 3,
                                                 TitleBarMenuRect.Top + TitleBarMenuRect.Height));
             contextMenuStrip.Show(point);
         }
     }
 }
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            var layout = _viewMode switch
            {
                ViewMode.Compact => Resource.Layout.listItemAuthCompact,
                ViewMode.Tile => Resource.Layout.listItemAuthTile,
                _ => Resource.Layout.listItemAuth
            };

            var itemView = LayoutInflater.From(parent.Context).Inflate(layout, parent, false);

            var holder = new AuthenticatorListHolder(itemView);

            holder.ItemView.Click      += delegate { ItemClick.Invoke(this, holder.AdapterPosition); };
            holder.MenuButton.Click    += delegate { MenuClick.Invoke(this, holder.AdapterPosition); };
            holder.RefreshButton.Click += delegate { OnRefreshClick(holder.AdapterPosition); };

            return(holder);
        }
Пример #7
0
        public static void Initialize()
        {
            MenuMusic                = EntryPoint.Game.Content.Load <SoundEffect>("Menu\\MenuMusic");
            MenuMusicInstance        = MenuMusic.CreateInstance();
            MenuMusicInstance.Volume = 0.3f;
            MenuMusicInstance.Pitch  = -0.1f;

            MenuClick                = EntryPoint.Game.Content.Load <SoundEffect>("Menu\\MenuClick");
            MenuClickInstance        = MenuClick.CreateInstance();
            MenuClickInstance.Volume = 1;
            MenuClickInstance.Pitch  = 0.3f;

            IntroSong                = EntryPoint.Game.Content.Load <SoundEffect>("Intro\\IntroWav");
            IntroSongInstance        = IntroSong.CreateInstance();
            IntroSongInstance.Volume = 0.8f;

            BattleSong                = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\BattleSong");
            BattleSongInstance        = BattleSong.CreateInstance();
            BattleSongInstance.Volume = 0.05f;

            NarratorFightSound         = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\Fight");
            NarratorFightSoundInstance = NarratorFightSound.CreateInstance();

            ClarkPunch         = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\ClarkPunch");
            ClarkPunchInstance = ClarkPunch.CreateInstance();

            YuriPunch         = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\YuriPunch");
            YuriPunchInstance = YuriPunch.CreateInstance();

            YuriKick         = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\YuriKick");
            YuriKickInstance = YuriKick.CreateInstance();

            ClarkKick         = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\ClarkKick");
            ClarkKickInstance = ClarkKick.CreateInstance();

            BlockSound         = EntryPoint.Game.Content.Load <SoundEffect>("IngameAudio\\Block");
            BlockSoundInstance = BlockSound.CreateInstance();
        }
Пример #8
0
 public void RaiseMenuClick(string menuItemHeader, object tag)
 {
     MenuClick?.Invoke(this, menuItemHeader, tag);
 }
        static void AddChildren(Assembly assem, Platform.ShellRightClickContextMenuClass menuClass, InfoStorageAttribute storage, IntPtr menu, dynamic children, List <string> selectedFiles, bool isRoot, MenuClick onClick)
        {
            for (var i = 0; i < children.Length; ++i)
            {
                dynamic item = children[i];
                string  name = Util.IsJsonProperty(item, "name") ? (string)item.name : "New Menu Item";

                // embed image into assembly and reference that
                System.Drawing.Bitmap bmp = null;
                IntPtr subMenu            = IntPtr.Zero;

                if (Util.IsJsonProperty(item, "imageResource"))
                {
                    var    resources = assem.GetManifestResourceStream((string)item.imageResource + ".resources");
                    var    rr        = new System.Resources.ResourceReader(resources);
                    string resourceType;
                    byte[] resourceData;
                    rr.GetResourceData("image.bmp", out resourceType, out resourceData);
                    // For some reason the resource compiler adds 4 bytes to the start of our data.
                    bmp = new System.Drawing.Bitmap(new System.IO.MemoryStream(resourceData, 4, resourceData.Length - 4));
                }
                if (Util.IsJsonProperty(item, "children"))
                {
                    subMenu = menuClass.CreateSubMenu();
                    AddChildren(assem, menuClass, storage, subMenu, item.children, selectedFiles, false, onClick);
                }

                int position = i + 1;
                if (isRoot)
                {
                    position = Util.IsJsonProperty(item, "position") ? (int)item.position : position;
                }
                if (menu == IntPtr.Zero)
                {
                    // root element
                    if (subMenu == IntPtr.Zero)
                    {
                        uint id = menuClass.InsertMenuItem(name, position, (List <string> s) => { onClick(item, selectedFiles); });
                        if (bmp != null)
                        {
                            menuClass.SetMenuItemBitmap(id, bmp);
                        }
                    }
                    else
                    {
                        menuClass.InsertSubMenu(subMenu, name, position, bmp);
                    }
                }
                else
                {
                    // sub menu
                    if (subMenu == IntPtr.Zero)
                    {
                        menuClass.InsertMenuItemIntoSubMenu(menu, name, position, bmp, (List <string> s) => { onClick(item, selectedFiles); });
                    }
                    else
                    {
                        uint id = menuClass.InsertSubMenuIntoSubMenu(menu, subMenu, name, position);
                        if (bmp != null)
                        {
                            menuClass.SetMenuItemBitmap(id, bmp);
                        }
                    }
                }
            }
        }
Пример #10
0
        public static void BuildMenu(Assembly assem, Platform.ShellRightClickContextMenuClass menuClass, InfoStorageAttribute storage, List <string> list, MenuClick onClick)
        {
            try
            {
                // filter file extensions if required
                var filter    = new List <string>(storage.FileExtensionFilter);
                var filesList = storage.ExpandFileNames ? BuildFileList(filter, list) : list;

                if (filesList.Count > 0)
                {
                    string menuFormatJson = storage.MenuFormat;

                    var     jsonReader               = new JsonFx.Json.JsonReader();
                    dynamic menuFormatObject         = jsonReader.Read <dynamic>(menuFormatJson);
                    dynamic menuFormatObjectChildren = menuFormatObject.children;

                    AddChildren(assem, menuClass, storage, IntPtr.Zero, menuFormatObjectChildren, filesList, true, onClick);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + "\r\n\r\n" + e.StackTrace, "Error whilst creating menu");
            }
        }
 void IMenuHandler.Handle(MenuClick click)
 {
     MessageBox.Show("Menu button was clicked");
 }
 /// <summary>
 /// Обработчик события Нажатия кнопки Меню.
 /// </summary>
 protected virtual void BtnMenu_OnClick()
 {
     MenuClick?.Invoke();
 }
Пример #13
0
		static void AddChildren( Assembly assem, Platform.ShellRightClickContextMenuClass menuClass, InfoStorageAttribute storage, IntPtr menu, dynamic children, List<string> selectedFiles, bool isRoot, MenuClick onClick )
		{
			for ( var i=0; i<children.Length; ++i )
			{
				dynamic item = children[ i ];
				string name = Util.IsJsonProperty( item, "name" ) ? (string)item.name : "New Menu Item";
				
				// embed image into assembly and reference that
				System.Drawing.Bitmap bmp = null;
				IntPtr subMenu = IntPtr.Zero;

				if ( Util.IsJsonProperty( item, "imageResource" ) )
				{
					var resources = assem.GetManifestResourceStream( (string)item.imageResource + ".resources" );
					var rr = new System.Resources.ResourceReader( resources );
					string resourceType;
					byte[] resourceData;
					rr.GetResourceData( "image.bmp", out resourceType, out resourceData );
					// For some reason the resource compiler adds 4 bytes to the start of our data.
					bmp = new System.Drawing.Bitmap( new System.IO.MemoryStream( resourceData, 4, resourceData.Length-4 ) );
				}
				if ( Util.IsJsonProperty( item, "children" ) )
				{
					subMenu = menuClass.CreateSubMenu();
					AddChildren( assem, menuClass, storage, subMenu, item.children, selectedFiles, false, onClick );
				}

				int position = i+1;
				if ( isRoot )
				{
					position = Util.IsJsonProperty( item, "position" ) ? (int)item.position : position;
				}
				if ( menu == IntPtr.Zero )
				{
					// root element
					if ( subMenu == IntPtr.Zero )
					{
						uint id = menuClass.InsertMenuItem( name, position, ( List<string> s ) => { onClick( item, selectedFiles ); } );
						if ( bmp != null )
						{
							menuClass.SetMenuItemBitmap( id, bmp );
						}
					}
					else
					{
						menuClass.InsertSubMenu( subMenu, name, position, bmp );
					}
				}
				else
				{
					// sub menu
					if ( subMenu == IntPtr.Zero )
					{
						menuClass.InsertMenuItemIntoSubMenu( menu, name, position, bmp, ( List<string> s ) => { onClick( item, selectedFiles ); } );
					}
					else
					{
						uint id = menuClass.InsertSubMenuIntoSubMenu( menu, subMenu, name, position );
						if ( bmp != null )
						{
							menuClass.SetMenuItemBitmap( id, bmp );
						}
					}
				}
			}
		}
Пример #14
0
		public static void BuildMenu( Assembly assem, Platform.ShellRightClickContextMenuClass menuClass, InfoStorageAttribute storage, List<string> list, MenuClick onClick )
		{
			try
			{
				// filter file extensions if required
				var filter = new List<string>( storage.FileExtensionFilter );
				var filesList = storage.ExpandFileNames ? BuildFileList( filter, list ) : list;

				if ( filesList.Count > 0 )
				{
					string menuFormatJson = storage.MenuFormat;

					var jsonReader = new JsonFx.Json.JsonReader();
					dynamic menuFormatObject = jsonReader.Read<dynamic>( menuFormatJson );
					dynamic menuFormatObjectChildren = menuFormatObject.children;

					AddChildren( assem, menuClass, storage, IntPtr.Zero, menuFormatObjectChildren, filesList, true, onClick );
				}
			}
			catch ( Exception e )
			{
				MessageBox.Show( e.Message + "\r\n\r\n" + e.StackTrace, "Error whilst creating menu" );
			}
		}