Exemplo n.º 1
0
        /// <summary>
        /// Updates the privatedata.
        /// </summary>
        /// <returns>The privatedata.</returns>
        private async Task UpdatePrivatedata()
        {
            int    index           = 0;
            double TotalAssetprice = 0.0;

            // UTF8のファイルの読み込み Edit.
            //string response = await saveLoadCS.DataLoadAsync();//登録データ読み込み
            List <Price> prices = await Finance.Parse( );             //登録データセット

            foreach (Price price in prices)
            {
                TotalAssetprice = TotalAssetprice + Convert.ToDouble(price.Stocks * price.Itemprice);                //保有数*購入価格
            }
            TotalAsset.Text = Convert.ToString(TotalAssetprice);

            index = index + 1;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Privatedata this instance.
        /// </summary>
        private async Task Privatedata()
        {
            int    index = 0;
            int    count = 0;
            int    i     = 0;
            string namecode;

            // UTF8のファイルの読み込み Edit.
            //string response = await saveLoadCS.DataLoadAsync();//登録データ読み込み
            // string[] rows = response.Replace("\n,", "\n").Split('\n'); //\n split


            List <Price> prices = await Finance.Parse();

            stack = new StackLayout[prices.Count + 1];//1=最下行追加分

            AddCity       = new Label[prices.Count + 1];
            AddGoingprice = new Label[prices.Count + 1];
            UptoButtons   = new Button[prices.Count + 1];

            //Price price = new Price();



            foreach (Price price in prices)
            {
                namecode = price.Name;                //rows[index].Substring(0, 4);

                //Nowprice = dataDisp.Getprice1(namecode);//コードを指定して現在値を得る(浮動小数点)
                //try
                //{
                //dataDispの代替
                //var str = await Download(namecode);//コードを指定して現在値を得る(浮動小数点)
                bool str = await Getserchi(namecode);

                AddCity[i] = new Label
                {
                    Text                    = price.Name + price.Ask,//"Add"+ "1234",
                    WidthRequest            = 250,
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalTextAlignment   = TextAlignment.Center,
                    FontSize                = 15
                };
                //ラベルタッチでイベントを発生させる
                var tgr = new TapGestureRecognizer();
                tgr.Tapped += (sender, e) => OnLabelClicked(sender, e, i);
                AddCity[i].GestureRecognizers.Add(tgr);

                AddGoingprice[i] = new Label
                {
                    Text                    = g.current_value,//"AddGoingprice",
                    WidthRequest            = 250,
                    HorizontalTextAlignment = TextAlignment.End,
                    VerticalTextAlignment   = TextAlignment.Center,
                    FontSize                = 15
                };

                UptoButtons[i] = new Button
                {
                    Text         = g.previous_value,//"UptoAcet" + prices.Count,
                    WidthRequest = 80,
                    TextColor    = Color.FromHex("FFFFFF"),
                    //BackgroundColor = Color.Red
                };
                // UptoButtons[i].Clicked += await uptoButtons_Clicked(null,null,price.Name);

                stack[i]             = new StackLayout();
                stack[i].Orientation = StackOrientation.Horizontal;
                stack[i].Children.Add(AddCity[i]);    //Label
                stack[i].Children.Add(AddGoingprice[i]);
                stack[i].Children.Add(UptoButtons[i]);

                Allstack.Children.Add(stack[i]);
                i     = i + 1;
                count = count + 1;
                index = index + 1;


                //}//catch to end
            }//for to end

            //最下行に新規登録行追加
            AddCity[i] = new Label
            {
                Text                    = "Add",
                WidthRequest            = 250,
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment   = TextAlignment.Center,
                FontSize                = 15
            };
            //ラベルタッチでイベントを発生させる
            var tgrr = new TapGestureRecognizer();

            tgrr.Tapped += (sender, e) => OnLabelClicked(sender, e, i);
            AddCity[i].GestureRecognizers.Add(tgrr);

            AddGoingprice[i] = new Label
            {
                Text                    = "Non",
                WidthRequest            = 250,
                HorizontalTextAlignment = TextAlignment.End,
                VerticalTextAlignment   = TextAlignment.Center,
                FontSize                = 15
            };

            UptoButtons[i] = new Button
            {
                Text         = "NonUptoAcet",
                WidthRequest = 80,
                TextColor    = Color.FromHex("FFFFFF"),
                //BackgroundColor = Color.Red
            };
            //UptoButtons[i].Clicked += uptoButtons_Clicked;

            stack[i]             = new StackLayout();
            stack[i].Orientation = StackOrientation.Horizontal;
            stack[i].Children.Add(AddCity[i]);//Label
            stack[i].Children.Add(AddGoingprice[i]);
            stack[i].Children.Add(UptoButtons[i]);

            Allstack.Children.Add(stack[i]);
            i     = i + 1;
            count = count + 1;
            index = index + 1;
        }//Mesoth to end