示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog wSchemaDialog = new OpenFileDialog();
            wSchemaDialog.DefaultExt = "dll";
            wSchemaDialog.CheckFileExists = true;

            wSchemaDialog.Filter = "DLL Files (*.dll;*.exe)|*.dll;*.exe|All Files (*.*)|*.*";
            wSchemaDialog.ShowReadOnly = true;

            MenuItemList wMenuItemList = new MenuItemList();
            
     
            if (wSchemaDialog.ShowDialog() == DialogResult.OK)
            {
                MenuItem wMenuItem = new MenuItem();
                Assembly ass = new Assembly(wSchemaDialog.FileName);
                lblFileName.Text = wSchemaDialog.FileName;
                foreach (AssemblyClass wAssemblyClass in ass.ClassCollections)
                {
                    if (wAssemblyClass.BaseType != null)
                    {
                        if (wAssemblyClass.BaseType.Name.Contains("Form"))
                        {
                            wMenuItem = new MenuItem();
                            wMenuItem.AssemblyInfo = wAssemblyClass.FullyQualifiedName;
                            wMenuItem.FormName = wAssemblyClass.Name;
                            wMenuItemList.Add(wMenuItem);
                        }
                    }
                }

                listBox1.DataSource = wMenuItemList;
            }
        }
示例#2
0
        private bool NewMenuItem(string itemID)
        {//need to fix this...
            MenuItem newItem = new MenuItem();

            //all new records will be give a negative int autoid...
            //when they are updated then sql will generate one for them overiding this set value...
            //it will allow us to give uniqueness to the tempory new records...
            //Before they are updated to the entity and given an autoid...
            //we use a negative number and keep subtracting by 1 for each new item added...
            //This will allow it to alwasy be unique and never interfere with SQL's positive autoid...
            _newMenuItemAutoId = _newMenuItemAutoId - 1;
            newItem.AutoID     = _newMenuItemAutoId;
            newItem.MenuItemID = itemID;
            newItem.CompanyID  = ClientSessionSingleton.Instance.CompanyID;
            //new items will be added to selected item
            newItem.ParentMenuID = SelectedMenuItem.MenuItemID;
            //add it to the repository list
            MenuItemList.Add(newItem);
            _serviceAgent.AddToMenuItemRepository(newItem);

            //add it to the treeviewList
            NestedMenuItem newNestedItem = new NestedMenuItem(newItem);

            newNestedItem.IsValid         = 1;
            newNestedItem.NotValidMessage = "New Record Key Field/s Are Required.";
            SelectedMenuItem.Children.Add(newNestedItem);

            AllowEdit = true;
            Dirty     = false;
            return(true);
        }
示例#3
0
        public void AddMenuItem <TDataContext, TUserControl>(string header) where TUserControl : UserControl
        {
            var obj = new MenuItemObject()
            {
                DataContextObject = typeof(TDataContext),
                UserControl       = typeof(TUserControl)
            };

            MenuItemObjectList.Add(obj);

            var item = new MenuItem()
            {
                Header      = header,
                IsCheckable = true,
                IsEnabled   = true
            };

            item.Click += new RoutedEventHandler(ClickEvent);

            Binding menuCheckBinding = new Binding("IsChecked")
            {
                Source = this,
                Mode   = BindingMode.TwoWay,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            };

            BindingOperations.SetBinding(item, MenuItem.IsCheckableProperty, menuCheckBinding);
            MenuItemList.Add(item);
        }
示例#4
0
 CartDaoCollection()
 {
     if (usercart == null)
     {
         long Dictionary = new long();
         MenuItemList.Add();
     }
 }
示例#5
0
        public async Task <int> ChooseItem()
        {
            await TextArea.PrintLine("-choose above", XleColor.Cyan);

            MenuItemList theList = new MenuItemList();
            int          value   = 0;

            theList.Add("Nothing");

            foreach (int i in from kvp in Data.ItemList
                     where Player.Items[kvp.Key] > 0 &&
                     Data.MagicSpells.Values.All(
                         x => x.ItemID != kvp.Key)
                     select kvp.Key)
            {
                string itemName = Data.ItemList[i].Name;

                if (itemName.Contains("coin"))
                {
                    continue;
                }

                /*
                 * if (i == 9)			// mail
                 * {
                 *  itemName = XleCore.GetMapName(state.Player.mailTown) + " " + itemName;
                 * }*/

                if (i <= Player.Hold)
                {
                    value++;
                }

                theList.Add(itemName);
            }

            var index = await SubMenu.SubMenu("Hold Item", value, theList);

            var selectedName = theList[index];

            return(Data.ItemList.Where(x => x.Value.Name == selectedName)
                   .Select(x => x.Key).First());
        }
示例#6
0
        public async Task <WeaponItem> PickWeapon(GameState state, WeaponItem defaultItem, Color?backColor = null)
        {
            MenuItemList theList = new MenuItemList();

            theList.Add("Nothing");
            theList.AddRange(state.Player.Weapons.Select(x => x.NameWithQuality(Data)));

            int sel = await subMenu.SubMenu("Pick Weapon", state.Player.Weapons.IndexOf(defaultItem) + 1,
                                            theList, backColor ?? XleColor.Black);

            if (sel == 0)
            {
                return(null);
            }
            else
            {
                return(state.Player.Weapons[sel - 1]);
            }
        }
示例#7
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog wSchemaDialog = new OpenFileDialog();

            wSchemaDialog.DefaultExt      = "dll";
            wSchemaDialog.CheckFileExists = true;

            wSchemaDialog.Filter       = FileFunctions.OpenFilterEnums.OpenAssembliesFilter;
            wSchemaDialog.ShowReadOnly = true;

            MenuItemList wMenuItemList = new MenuItemList();

            if (wSchemaDialog.ShowDialog() == DialogResult.OK)
            {
                Fwk.UI.Controls.Menu.Tree.MenuItem wMenuItem = new Fwk.UI.Controls.Menu.Tree.MenuItem();
                Assembly wAssembly = new Assembly(wSchemaDialog.FileName);
                lblFileName.Text = wSchemaDialog.FileName;

                foreach (AssemblyClass wAssemblyClass in wAssembly.ClassCollections)
                {
                    if (wAssemblyClass.BaseType != null)
                    {
                        foreach (string filter in _BaseClassNameFilter)
                        {
                            if (wAssemblyClass.BaseType.Name.Contains(filter))
                            {
                                wMenuItem = new Fwk.UI.Controls.Menu.Tree.MenuItem();
                                wMenuItem.AssemblyInfo = wAssemblyClass.FullyQualifiedName;

                                wMenuItemList.Add(wMenuItem);
                            }
                        }
                    }
                }

                listBox1.DataSource = wMenuItemList;
            }
        }
示例#8
0
        private async Task BuyItem()
        {
            itemsPrompt.Text = "Items               Prices";

            int[] itemList  = new int[16];
            int[] qualList  = new int[16];
            int[] priceList = new int[16];

            FillItems(Player.TimeQuality, itemList, qualList, priceList);

            await StoreSound(LotaSound.Sale);

            int count = 0;

            for (int i = 1; i < 16 && itemList[i] > 0; i++)
            {
                count = i + 1;
                var name  = ItemName(itemList[i], qualList[i]);
                var price = priceList[i];

                AddItemToDisplay(i, name, price);
                await Wait(1);
            }

            MenuItemList theList2 = new MenuItemList();

            for (int k = 0; k < count; k++)
            {
                theList2.Add(k.ToString());
            }

            await TextArea.PrintLine();

            await TextArea.PrintLine("Make choice (hit 0 to cancel)");

            await TextArea.PrintLine();

            int choice = await QuickMenu(theList2, 2, 0);

            if (choice == 0)
            {
                await TextArea.PrintLine();

                await TextArea.PrintLine("Nothing purchased");

                await TextArea.PrintLine();

                await StoreSound(LotaSound.Medium);
            }
            else if (Player.Spend(priceList[choice]))
            {
                // spend the cash, if they have it
                if (AddItem(Player, itemList[choice], qualList[choice]))
                {
                    await TextArea.PrintLine(ItemName(itemList[choice], qualList[choice]) + " purchased.");

                    await TextArea.PrintLine();

                    await StoreSound(LotaSound.Sale);
                }
                else
                {
                    Player.Gold += priceList[choice];
                    await TextArea.PrintLine();

                    await TextArea.PrintLine();

                    await TextArea.PrintLine();

                    await TextArea.PrintLine("No purchase.  You're");

                    await TextArea.PrintLine("carrying too much.");
                }
            }
            else
            {
                await TextArea.PrintLine("You're short on gold.");
                await StoreSound(LotaSound.Medium);
            }
        }