Esempio n. 1
0
 internal bool AddItem(TradeAsset asset)
 {
     if (!Assets.Contains(asset))
     {
         Assets.Add(asset);
         return(true);
     }
     return(false);
 }
        public void AddAsset(Object Obj)
        {
            if (Assets.Contains(Obj))
            {
                return;
            }

            Assets.Add(Obj);
            UpdateAssetDictionary();
        }
        protected override void OnCellValueChanged(DataGridViewCellEventArgs e)
        {
            bool IsLastRow = e.RowIndex == Rows.Count - 1;

            if (ElementShowed != null)
            {
                switch (e.ColumnIndex)
                {
                case DataGridViewAccountingStatics.Column_Amount:
                    if (!IsLastRow && ElementShowed.GetNodeType() == NodeType.Institution)
                    {
                        var valueAmount = Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                        try
                        {
                            ElementShowed.ModifyAmount(FXMarketUsed,
                                                       AssetMarketUsed,
                                                       Rows[e.RowIndex].Cells[0].Value.ToString(),
                                                       ValueFromStringToDouble(valueAmount));
                        }
                        catch { }
                    }
                    break;

                case DataGridViewAccountingStatics.Column_Currency:
                    var       valueCcy = Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                    ICcyAsset ccyAsset = new Currency(valueCcy);
                    if (Assets.Contains(valueCcy))
                    {
                        ccyAsset = new Asset(valueCcy);
                    }
                    ElementShowed.ModifyCcy(FXMarketUsed,
                                            AssetMarketUsed,
                                            Rows[e.RowIndex].Cells[0].Value.ToString(),
                                            ccyAsset,
                                            IsLastRow);
                    break;
                }
                ShowElement(ElementShowed);
            }
            else if (TotalShowed != null)
            {
                switch (e.ColumnIndex)
                {
                case DataGridViewAccountingStatics.Column_Currency:
                    var valueCcy = Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                    TotalShowed.ModifyCcy(valueCcy);
                    break;
                }
                ShowTotalEventHandler?.Invoke(this, e);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Adds the specified asset.
        /// </summary>
        /// <param name="asset">The asset.</param>
        public void Add(Asset asset)
        {
            if (Assets.Contains(asset))
            {
                Debug.LogWarning(string.Format("Asset {0} was already added as an asset, can't add twice.", asset.Name));
            }

            Assets.Add(asset);

            asset.GameObject.SetActive(true);

            GameObjectHashMap.Instance.Set(asset.Guid, asset.GameObject);

            LayOutAssets();
        }
Esempio n. 5
0
 public bool ContainsItem(TradeAsset asset)
 {
     return(Assets.Contains(asset));
 }
Esempio n. 6
0
 internal bool RemoveItem(TradeAsset asset)
 {
     return(Assets.Contains(asset) && Assets.Remove(asset));
 }
 public bool HasAsset(Object Obj)
 {
     return(Assets.Contains(Obj));
 }