public MainWindow() { InitializeComponent(); Ascensore = new Ascensore(1); muovi = new Thread(new ThreadStart(MuoviAscensore)); mossa = 10; sleep = 100; x = new object(); o0 = new Omino(p_0.Margin, 50); o1 = new Omino(p_1.Margin, 50); o2 = new Omino(p_2.Margin, 50); o3 = new Omino(p_3.Margin, 50); o4 = new Omino(p_4.Margin, 50); c0 = new OminoContrario(s0.Margin, 50); c1 = new OminoContrario(s1.Margin, 50); c2 = new OminoContrario(s2.Margin, 50); c3 = new OminoContrario(s3.Margin, 50); c4 = new OminoContrario(s4.Margin, 50); }
private void Scendi3() { if (c3.MarginLeft <= 0) { this.Dispatcher.BeginInvoke(new Action(() => { s3.Visibility = Visibility.Visible; s3.Visibility = Visibility.Hidden; s3.Margin = new Thickness(400, c3.MarginTop, 0, 0); c3 = new OminoContrario(s3.Margin, 50); })); } else { this.Dispatcher.BeginInvoke(new Action(() => { s3.Margin = c3.Mossa(); })); Thread.Sleep(50); Scendi3(); } }