public async Task<List<RealTimeStockItem>> GetMultipleRealTimeStockAsync(List<StockInfoItem> stockList)
        {
            // hard code to display taiwan tse stock
            stockList.Insert(0, new StockInfoItem { Id = "t00", MarketType = "上市" });


            SessionData session = await GetSession();
            List<StockInfoModel> queryStockList = stockList.Convert();
            
            List<RealTimeStockModel> results = new List<RealTimeStockModel>();
            try
            {
                TwseStockClient client = new TwseStockClient();
                results = await client.QueryStockAsync(queryStockList, session);
            }
            catch (Exception e)
            {
                Debug.WriteLine(DateTime.Now + " : " + "Cookie time out");
                ReleaseSession();
            }

            return results.Convert();
        }
 IExpressionNode[] CreateNodes(List<INode> nodes)
 {
     return nodes.Convert(n => CreateNode(n));
 }
Example #3
0
    /// <summary>
    /// Checks the second transition in a 2-transition jump and sees if we can
    /// perform the collapse (there's no overlap, etc.)
    /// </summary>
    /// <param name="beginning">The first expanded node (beginning, middle, 
    /// end)</param>
    /// <param name="jump1">The first edge (beginning-middle)</param>
    /// <param name="jump1Events">The events in the first edge</param>
    /// <param name="involvedInFirst">The objects involved in jump1</param>
    /// <param name="edgesToAdd">(out) A list in which we write the edges to
    /// add to the graph</param>
    private static void AnalyzeEndpoints(
        ExplorationNode beginning,
        ExplorationEdge jump1,
        IEnumerable<TransitionEvent> jump1Events,
        HashSet<uint> involvedInFirst,
        IList<ExplorationEdge> edgesToAdd)
    {
        // Get all of the final endpoint jumps (middle-end)
        foreach (ExplorationEdge jump2 in jump1.Target.Outgoing)
        {
            ExplorationNode end = jump2.Target;
            List<TransitionEvent> jump2Events =
                new List<TransitionEvent>(jump2.Events);

            // All the objects in jump2 
            HashSet<uint> involvedSecond = new HashSet<uint>();
            GetInvolved(jump2Events).ForEach(
                (uint id) =>
                {
                    DebugUtil.Assert(involvedSecond.Contains(id) == false);
                    involvedSecond.Add(id);
                });

            // There's no overlap
            if (involvedInFirst.Overlaps(involvedSecond) == false)
            {
                List<TransitionEvent> combined = new List<TransitionEvent>();
                combined.AddRange(
                    jump1Events.Convert(s => new TransitionEvent(s)));
                combined.AddRange(
                    jump2Events.Convert(s => new TransitionEvent(s)));
                edgesToAdd.Add(
                    new ExplorationEdge(beginning, end, combined.ToArray()));
            }
        }
    }
Example #4
0
    /// <summary>
    /// Collects all of the requirements for each parameter index
    /// </summary>
    private StateName[][] CollectStateRequirements()
    {
        List<List<StateName>> requirements =
            new List<List<StateName>>(this.ParameterCount);

        for (int i = 0; i < this.ParameterCount; i++)
            requirements.Add(new List<StateName>());

        foreach (StateCondition req in this.StateReqs)
        {
            // Make sure the index is valid
            DebugUtil.Assert(req.Index >= 0);
            DebugUtil.Assert(req.Index < this.ParameterCount);
            requirements[req.Index].AddRange(req.Tags);
        }

        return requirements.Convert(l => l.ToArray()).ToArray();
    }
		public static void SetBundleData(this OrderItem orderItem, List<ProductBundleItemOrderData> bundleData)
		{
			string rawData = null;

			if (bundleData != null && bundleData.Count > 0)
				rawData = bundleData.Convert<string>();

			orderItem.BundleData = rawData;
		}