public void SpisokView(ICollectionView SpisokFiltered) { int vacCount = SpisokFiltered.Cast <object>().Count(); VacancyCount.Content = vacCount; if (vacCount != 0) { SC.Post(new SendOrPostCallback(o => { PB.Value = 0; PB.Maximum = 100; }), 2); SC.Post(new SendOrPostCallback(o => { PBtext.Text = ""; }), 2); SC.Post(new SendOrPostCallback(o => { PB.Refresh(); }), 2); MyGrid.ItemsSource = SpisokFiltered; MyGrid.RowHeight = 20; Button1.IsEnabled = true; Button4.IsEnabled = true; Button5.IsEnabled = true; Button3.IsEnabled = true; Button6.IsEnabled = false; } //MyGrid.ItemsSource = null; //MyGrid.Refresh(); //this.DataContext = Spisok; //if (MyGrid.ItemContainerGenerator.Status == GeneratorStatus.ContainersGenerated) //{ // var row = (DataGridRow)MyGrid.ItemContainerGenerator.ContainerFromIndex(1); // row.Background = Brushes.Red; // //foreach (var dataItem in DisplayDataGrid.ItemsSource) // //{ // // var gridRow = DisplayDataGrid.ItemContainerGenerator.ContainerFromItem(dataItem) as DataGridRow; // //} // //DataGridRow rowColor = (DataGridRow)dataGridViewMyGroups.ItemContainerGenerator.ContainerFromIndex(number); // //row.Background = new SolidColorBrush(System.Windows.Media.Color.FromRgb(223, 227, 238)); //} }
public void PB_Update(MyEventArgs e) { //Application.Current.Dispatcher.BeginInvoke(new Action(() => { PB.Value = e.Value; PB.Maximum = e.MaxValue; })); SC.Post(new SendOrPostCallback(o => { PB.Value = e.Value; PB.Maximum = e.MaxValue; }), e); SC.Post(new SendOrPostCallback(o => { PBtext.Text = e.Value + " (" + e.Value2 + ") / " + e.MaxValue; }), e); SC.Post(new SendOrPostCallback(o => { PB.Refresh(); }), e); //synchronizationContext.Post(new SendOrPostCallback(o => {MyGrid.ItemsSource = Spisok;}),Spisok); }
private void trackBar1_Scroll(object sender, EventArgs e) { k = trackBar1.Value / 10.0; g.Clear(Color.White); S = new Point(PB.Width / 10, 4 * PB.Height / 5); for (int i = 0; i <= gear; i++) { DrawST(g, p, i); } p.Color = Color.Red; if (gear >= 0) { g.DrawLine(p, S.X, S.Y - (int)(k * P.l2[gear] / 2), S.X - (int)(k * (P.B2[gear] + P.S2[gear] + P.B1[gear] + P.sd[gear])) * (gear + 1), S.Y - (int)(k * P.l1[0] / 2)); } PB.Refresh(); }