Example #1
0
		/// <summary>
		/// Selects the item highlighted in the results list.
		/// </summary>
		/// <param name="sender">sender object</param>
		/// <param name="e">ResultChangedEventArgs data</param>
		private void SelectResult(object sender, ResultChangedEventArgs e)
		{
			Result selectedResult = e.Result;
			if (selectedResult == null || selectedResult.FriendlyNames == null) return;

			this.ClearAllItemsSelectedCallback(this, new SackPanelEventArgs(null, null));

			if (selectedResult.SackType == SackType.Vault)
			{
				// Switch to the selected vault
				this.vaultListComboBox.SelectedItem = selectedResult.ContainerName;
				this.vaultPanel.CurrentBag = selectedResult.SackNumber;
				this.vaultPanel.SackPanel.SelectItem(selectedResult.FriendlyNames.Item.Location);
			}
			else if (selectedResult.SackType == SackType.Player || selectedResult.SackType == SackType.Equipment || selectedResult.SackType == SackType.Stash)
			{
				// Switch to the selected player
				if (this.showSecondaryVault)
				{
					this.showSecondaryVault = !this.showSecondaryVault;
					this.UpdateTopPanel();
				}

				// Update the selection list and load the character.				
				this.characterComboBox.SelectedIndex = this.characterComboBox.FindString(selectedResult.ContainerName);
				    
				// Bail if we are attempting to highlight something in the stash panel and the stash does not exist.
				if ((this.stashPanel == null || this.stashPanel.SackPanel == null) && selectedResult.SackType != SackType.Player)
					return;

				if (selectedResult.SackType == SackType.Player)
				{
					// Highlight the item if it's in the player inventory.
					if (selectedResult.SackNumber == 0)
						this.playerPanel.SackPanel.SelectItem(selectedResult.FriendlyNames.Item.Location);
					else
					{
						this.playerPanel.CurrentBag = selectedResult.SackNumber - 1;
						this.playerPanel.BagSackPanel.SelectItem(selectedResult.FriendlyNames.Item.Location);
					}
				}
				else
				{
					this.stashPanel.CurrentBag = selectedResult.SackNumber;
					this.stashPanel.SackPanel.SelectItem(selectedResult.FriendlyNames.Item.Location);
				}
			}
			else if ((selectedResult.SackType == SackType.TransferStash) || (selectedResult.SackType == SackType.RelicVaultStash))
			{
				// Switch to the Stash bag
				this.stashPanel.CurrentBag = selectedResult.SackNumber;
				this.stashPanel.SackPanel.SelectItem(selectedResult.FriendlyNames.Item.Location);
			}
		}
Example #2
0
        /// <summary>
        /// Selects the item highlighted in the results list.
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">ResultChangedEventArgs data</param>
        private void SelectResult(object sender, ResultChangedEventArgs e)
        {
            Result selectedResult = e.Result;

            if (selectedResult == null || selectedResult.FriendlyNames == null)
            {
                return;
            }

            this.ClearAllItemsSelectedCallback(this, new SackPanelEventArgs(null, null));

            if (selectedResult.SackType == SackType.Vault)
            {
                // Switch to the selected vault
                this.vaultListComboBox.SelectedItem = selectedResult.ContainerName;
                this.vaultPanel.CurrentBag          = selectedResult.SackNumber;
                this.vaultPanel.SackPanel.SelectItem(selectedResult.FriendlyNames.Item.Location);
            }
            else if (selectedResult.SackType == SackType.Player || selectedResult.SackType == SackType.Equipment)
            {
                // Switch to the selected player
                if (this.showSecondaryVault)
                {
                    this.showSecondaryVault = !this.showSecondaryVault;
                    this.UpdateTopPanel();
                }

                string myName = selectedResult.ContainerName;

                if (GamePathResolver.IsCustom)
                {
                    myName = string.Concat(myName, PlayerService.CustomDesignator);
                }

                // Update the selection list and load the character.
                this.characterComboBox.SelectedItem = myName;
                if (selectedResult.SackNumber > 0)
                {
                    this.playerPanel.CurrentBag = selectedResult.SackNumber - 1;
                }

                if (selectedResult.SackType != SackType.Equipment)
                {
                    // Highlight the item if it's in the player inventory.
                    if (selectedResult.SackNumber == 0)
                    {
                        this.playerPanel.SackPanel.SelectItem(selectedResult.FriendlyNames.Item.Location);
                    }
                    else
                    {
                        this.playerPanel.BagSackPanel.SelectItem(selectedResult.FriendlyNames.Item.Location);
                    }
                }
            }
            else if (selectedResult.SackType == SackType.Stash)
            {
                // Switch to the selected player
                if (this.showSecondaryVault)
                {
                    this.showSecondaryVault = !this.showSecondaryVault;
                    this.UpdateTopPanel();
                }

                // Assume that only IT characters can have a stash.
                string myName = string.Concat(selectedResult.ContainerName, "<Immortal Throne>");

                if (GamePathResolver.IsCustom)
                {
                    myName = string.Concat(myName, PlayerService.CustomDesignator);
                }

                // Update the selection list and load the character.
                this.characterComboBox.SelectedItem = myName;

                // Switch to the Stash bag
                this.stashPanel.CurrentBag = selectedResult.SackNumber;
                this.stashPanel.SackPanel.SelectItem(selectedResult.FriendlyNames.Item.Location);
            }
            else if ((selectedResult.SackType == SackType.TransferStash) || (selectedResult.SackType == SackType.RelicVaultStash))
            {
                // Switch to the Stash bag
                this.stashPanel.CurrentBag = selectedResult.SackNumber;
                this.stashPanel.SackPanel.SelectItem(selectedResult.FriendlyNames.Item.Location);
            }
        }