Ejemplo n.º 1
0
 private void ChangeDirectory(DirectoryInfo directory)
 {
     CurrentDirectory     = directory;
     CurrentDirectoryPath = directory.ToString();
     Infos.Clear();
     foreach (var dir in CurrentDirectory.EnumerateDirectories())
     {
         Infos.Add(dir.ToInfo());
     }
     foreach (var file in CurrentDirectory.EnumerateFiles())
     {
         Infos.Add(file.ToInfo());
     }
 }
Ejemplo n.º 2
0
        public void Update()
        {
            if (LastGet >= DateTime.Now.AddHours(1))
            {
                return;
            }

            LastGet = DateTime.Now;

            string           url  = "https://www.gaitameonline.com/rateaj/getrate";
            string           json = (new System.Net.WebClient()).DownloadString(url);
            ExchangeRateInfo eri  = JsonConvert.DeserializeObject <ExchangeRateInfo>(json);

            Infos.Clear();
            Support.Clear();

            foreach (ExchangeRateInfo.Quote ei in eri.quotes)
            {
                string Frm  = ei.currencyPairCode.Substring(0, 3);
                string Dst  = ei.currencyPairCode.Substring(3, 3);
                float  Rate = float.Parse(ei.bid);

                Infos.Add(new Info()
                {
                    From = Frm,
                    To   = Dst,
                    Rate = Rate,
                    Div  = false
                });

                Infos.Add(new Info()
                {
                    From = Dst,
                    To   = Frm,
                    Rate = Rate,
                    Div  = true
                });

                Support.Add($"{Frm}/{Dst}");
                Support.Add($"{Dst}/{Frm}");
            }
        }
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            Infos.Clear();
            var reader = new StreamReader(File.OpenRead(@"C:\Users\afa\Desktop\Book1.csv"));

            while (!reader.EndOfStream)
            {
                Info i      = new Info();
                var  line   = reader.ReadLine();
                var  values = line.Split(',');
                i.Name      = values[0];
                i.Id        = values[1];
                i.Telephone = values[2];
                i.Date      = DateTime.Now;
                Infos.Add(i);
            }

            DateTime d = new DateTime(2017, 2, 12);

            DateTest.Add(d);
        }