private void Button_Click_DeleteAll(object sender, RoutedEventArgs e) { master.Children.Clear(); start = new StartBlock(); (start as UserControl).Margin = new Thickness(0, 0, 0, 0); master.Children.Add(start as UserControl); }
public MainWindow() { InitializeComponent(); SetFocus = ssFoc; start = new StartBlock(); RemChi = RemoChil; (start as UserControl).Margin = new Thickness(0, 0, 0, 0); master.Children.Add(start as UserControl); ssFoc(); Commands.Start(); }
private void RemoChil(UserControl a) { master.Children.Remove(a); Iblock ai = (a as Iblock).GetChild(); while (ai != null) { Thickness t = ai.GetMargin(); ai.SetMargin(new Thickness(t.Left, t.Top - 60, 0, 0)); ai = ai.GetChild(); } }
private void Button_Click_Compile(object sender, RoutedEventArgs e) { values = new List <int> (); commands = new List <Wololo> (); Iblock b = start; int aa = 0; while (!(b == null)) { values.Add(b.GetBlockData()); aa = b.GetBlockId(); switch (aa) { case 0: commands.Add(Commands.Init); break; case 1: commands.Add(Commands.Turn); break; case 2: commands.Add(Commands.Stop); break; case 3: commands.Add(Commands.Speed); break; case 4: commands.Add(Commands.Pause); break; case 5: commands.Add(Commands.Base); break; } b = b.GetChild(); } if (task != null) { task.Abort(); } task = new Thread(Execute); task.Start(); }
private void AddBlock(Iblock u) { // if (u.GetType () == typeof (TurnBlock)) { // FocusManager.SetFocusedElement (master, ( u as TurnBlock ).valBox); // ( u as TurnBlock ).valBox.Focus (); // Keyboard.Focus (( u as TurnBlock ).valBox); // ( u as TurnBlock ).valBox.SelectAll (); // } Iblock w = start.GetLowestChild(); w.AddBlock(u); u.SetParent(w); Thickness t = w.GetMargin(); u.SetMargin(new Thickness(t.Left, t.Top + 60, 0, 0)); master.Children.Add(u as UserControl); }
public void AddBlock(Iblock u) => control = u as UserControl;
public void SetParent(Iblock p) => parent = p as UserControl;