Ejemplo n.º 1
0
        public void Test()
        {
            Thread t = new Thread(() =>
            {
                List <int> nums   = new List <int>();
                Random random     = new Random();
                int num           = -1;
                string[] colorStr = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
                for (int i = 0; i < DownloadViewModel.GetInstance().PointCount; i++)
                {
                    while (num == -1 || nums.Contains(num))
                    {
                        num = random.Next(0, DownloadViewModel.GetInstance().PointCount);
                    }
                    string color = "#";
                    for (int n = 0; n < 6; n++)
                    {
                        color += colorStr[random.Next(0, colorStr.Count())];
                    }
                    DownloadViewModel.GetInstance().UpdatePointByIndex(num, color);
                    Thread.Sleep(50);
                    nums.Add(num);
                }
            });

            t.IsBackground = true;
            t.Start();
        }
Ejemplo n.º 2
0
 public Download()
 {
     try
     {
         mLog.Info("Start load dowmload page.");
         InitializeComponent();
         this.DataContext = DownloadViewModel.GetInstance();
         Test();
     }
     catch (Exception e)
     {
         mLog.Error("An error has occurred in the init download xaml,error:{0}", e.ToString());
         MMS.UI.Default.MessageBox.Error(String.Format("初始化下载页面出现异常.错误:{0}", e.Message));
     }
 }