private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (!e.Cancelled) { if (!string.IsNullOrWhiteSpace(TicketStore)) { SendRezult = true; this.Close(); } else if (e.Result is OutputParams) { var param = (OutputParams)e.Result; labelNameTicket.Content = "Білет № " + param.id_Ticket; int color = 0; foreach (var item in param.Ticket_) { var panel = new UserControlQuestion(item.Key, item.Value, IsShow); panel.Margin = new Thickness(10); panel.Background = color % 2 == 0 ? Brushes.AliceBlue : Brushes.White; color += 1; StackPanelQuestion.Children.Add(panel); } if (!IsShow) { timer = new Timer(1000); timer.Elapsed += Timer_Elapsed; timer.AutoReset = true; timer.Enabled = true; start = DateTime.Now; } } } progressbar.Visibility = Visibility.Hidden; }
private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (!e.Cancelled) if (!string.IsNullOrWhiteSpace(TicketStore)) { SendRezult = true; this.Close(); } else if (e.Result is OutputParams) { var param = (OutputParams)e.Result; labelNameTicket.Content = "Білет № " + param.id_Ticket; int color = 0; foreach (var item in param.Ticket_) { var panel = new UserControlQuestion(item.Key, item.Value, IsShow); panel.Margin = new Thickness(10); panel.Background = color % 2 == 0 ? Brushes.AliceBlue : Brushes.White; color += 1; StackPanelQuestion.Children.Add(panel); } if (!IsShow) { timer = new Timer(1000); timer.Elapsed += Timer_Elapsed; timer.AutoReset = true; timer.Enabled = true; start = DateTime.Now; } } progressbar.Visibility = Visibility.Hidden; }