public AndBlock() { InitializeComponent(); BooleanExpressionFitter fitter = new BooleanExpressionFitter(); slot1 = new ConditionSlot(fitter); slot2 = new ConditionSlot(fitter); slot1.Changed += delegate(object sender, EventArgs e) { OnChanged(e); }; slot2.Changed += delegate(object sender, EventArgs e) { OnChanged(e); }; TextBlock text = new TextBlock(); text.Text = "AND"; text.FontSize = 18; text.FontWeight = FontWeights.ExtraBold; text.Padding = new Thickness(8); text.Background = Brushes.Transparent; text.Foreground = Brushes.Yellow; text.VerticalAlignment = VerticalAlignment.Center; stackPanel.Children.Add(slot1); stackPanel.Children.Add(text); stackPanel.Children.Add(slot2); }
public ConditionalFrame() { currentScriptIsBasedOn = String.Empty; address = String.Empty; InitializeComponent(); saveButton = new BigButton("Save"); //finishButton = new BigButton("Finish"); saveButton.Margin = new Thickness(0, 15, 15, 15); //finishButton.Margin = new Thickness(0,15,0,15); buttonsPanel.Children.Add(saveButton); //buttonsPanel.Children.Add(finishButton); BooleanExpressionFitter fitter = new BooleanExpressionFitter(); slot = new ConditionSlot(fitter); slot.AllowDrop = true; slot.Margin = new Thickness(10, 10, 10, 0); slot.MinWidth = 550; slot.Height = 100; dragMessageTextBlock.AllowDrop = true; dragMessageTextBlock.IsHitTestVisible = false; slot.Changed += delegate(object sender, EventArgs e) { if (slot.Contents == null) { dragMessageTextBlock.Visibility = Visibility.Visible; } else { dragMessageTextBlock.Visibility = Visibility.Hidden; } OnChanged(e); }; Grid.SetRow(slot, 2); mainGrid.Children.Add(slot); }