Exemple #1
0
        private void ShowPopup()
        {
            HidePopup();
            popup = new PopupWindow(this)
            {
                Position = AbsolutePosition
            };
            popup.TopEdge   += Height;
            popup.FixedWidth = Width;
            List <ItemGadget> list = new List <ItemGadget>();
            int index = 0;

            foreach (var item in items)
            {
                list.Add(new ItemGadget(popup, item.ToString())
                {
                    Id            = index,
                    Selected      = index == selectedIndex,
                    Items         = list,
                    GadgetUpEvent = Item_GadgetUp
                });

                index++;
            }
            Screen.ShowWindow(popup);
        }
Exemple #2
0
        public static FileGadget ShowSelectFile(IFileResolver fileResolver, Screen screen, string initialDir, EventHandler <EventArgs> handler)
        {
            Window dialog = new Window(screen, "Open File")
            {
                CloseGadget = true,
                SizeGadget  = true,
                DepthGadget = true
            };
            FileGadget fg = new FileGadget(dialog, fileResolver)
            {
                OkSelectedEvent = handler
            };

            fg.GoToDir(initialDir);
            dialog.WindowCloseEvent = (o, i) => { fg.Cancel(); };
            screen.ShowWindow(dialog);
            screen.WindowToFront(dialog);
            screen.ActivateWindow(dialog);
            return(fg);
        }