Esempio n. 1
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            ProgressManager pm = new ProgressManager();

            pm.BeginWaiting();
            pm.SetProgressMaxValue(10);

            for (int i = 0; i < 10; i++)
            {
                pm.ChangeStatus("Loading " + i.ToString() + " from 10");
                pm.ChangeProgress(i);
                Thread.Sleep(1000);
            }

            pm.EndWaiting();
        }
Esempio n. 2
0
        /// <summary>
        /// Генерирует большое количество данных.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GenerateDataButton_OnClick(object sender, RoutedEventArgs e)
        {
            Random random = new Random();
            ObservableCollection <Client> newClients = new ObservableCollection <Client>();
            int             n = 10000;
            ProgressManager progressManager = new ProgressManager();

            progressManager.BeginWaiting();
            progressManager.ChangeStatus("В отдельном потоке выполняем генерацию записей...");
            progressManager.SetProgressMaxValue(n);

            for (int i = 0; i < n; i++)
            {
                ClientBase client = Convert.ToBoolean(random.Next(1, 10) % 2 == 0) ?
                                    (ClientBase) new Client(Guid.NewGuid().ToString()) :
                                    new VipClient(Guid.NewGuid().ToString());


                newClients.Add(new Client(Guid.NewGuid().ToString()));
                BankProv.BankObj.AddNewClient(client, random.Next(1, 10) % 2 != 0);
                progressManager.ChangeProgress(i);
            }
            progressManager.EndWaiting();
        }