Пример #1
0
        public void SetInventoryRequirement(InventoryRequirementViewModel inventoryRequirement)
        {
            if (inventoryRequirement != null && ChannelSession.Settings.Inventory.ContainsKey(inventoryRequirement.InventoryID))
            {
                this.EnableDisableToggleSwitch.IsChecked = true;

                this.InventoryTypeComboBox.ItemsSource  = ChannelSession.Settings.Inventory.Values;
                this.InventoryTypeComboBox.SelectedItem = ChannelSession.Settings.Inventory[inventoryRequirement.InventoryID];

                this.InventoryItemComboBox.IsEnabled   = true;
                this.InventoryItemComboBox.ItemsSource = ChannelSession.Settings.Inventory[inventoryRequirement.InventoryID].Items.Values;

#pragma warning disable CS0612 // Type or member is obsolete
                if (!string.IsNullOrEmpty(inventoryRequirement.ItemName))
                {
                    InventoryItemModel item = ChannelSession.Settings.Inventory[inventoryRequirement.InventoryID].GetItem(inventoryRequirement.ItemName);
                    if (item != null)
                    {
                        inventoryRequirement.ItemID = item.ID;
                    }
                    inventoryRequirement.ItemName = null;
                }
#pragma warning restore CS0612 // Type or member is obsolete

                if (ChannelSession.Settings.Inventory[inventoryRequirement.InventoryID].ItemExists(inventoryRequirement.ItemID))
                {
                    this.InventoryItemComboBox.SelectedItem = ChannelSession.Settings.Inventory[inventoryRequirement.InventoryID].GetItem(inventoryRequirement.ItemID);
                }

                this.InventoryItemAmountTextBox.IsEnabled = true;
                this.InventoryItemAmountTextBox.Text      = inventoryRequirement.Amount.ToString();
            }
        }
Пример #2
0
        protected override Task OnLoaded()
        {
            InventoryRequirementViewModel requirement = this.GetInventoryRequirement();

            if (ChannelSession.Settings.Inventories.Count > 0)
            {
                this.EnableDisableToggleSwitch.IsEnabled = true;
                this.InventoryTypeComboBox.ItemsSource   = ChannelSession.Settings.Inventories.Values;
            }

            this.SetInventoryRequirement(requirement);

            return(Task.FromResult(0));
        }
Пример #3
0
        public void SetInventoryRequirement(InventoryRequirementViewModel inventoryRequirement)
        {
            if (inventoryRequirement != null && ChannelSession.Settings.Inventories.ContainsKey(inventoryRequirement.InventoryID))
            {
                this.EnableDisableToggleSwitch.IsChecked = true;

                this.InventoryTypeComboBox.ItemsSource  = ChannelSession.Settings.Inventories.Values;
                this.InventoryTypeComboBox.SelectedItem = ChannelSession.Settings.Inventories[inventoryRequirement.InventoryID];

                this.InventoryItemComboBox.IsEnabled   = true;
                this.InventoryItemComboBox.ItemsSource = ChannelSession.Settings.Inventories[inventoryRequirement.InventoryID].Items.Values;
                if (ChannelSession.Settings.Inventories[inventoryRequirement.InventoryID].Items.ContainsKey(inventoryRequirement.ItemName))
                {
                    this.InventoryItemComboBox.SelectedItem = ChannelSession.Settings.Inventories[inventoryRequirement.InventoryID].Items[inventoryRequirement.ItemName];
                }

                this.InventoryItemAmountTextBox.IsEnabled = true;
                this.InventoryItemAmountTextBox.Text      = inventoryRequirement.Amount.ToString();
            }
        }