public void CreatePathUsingBFS(MazeButton mazeButton) { var queue = new Queue <MazeButton>(); mazeButton.IsVisited = true; queue.Enqueue(mazeButton); while (queue.Count != 0) { var e = queue.Dequeue(); int buttonIndex = ButtonsList.IndexOf(e); foreach (var btn in GetAdjacent(buttonIndex)) { if (btn == MazeEndPoint) { MazeEndPoint.Previous = e; return; } if (!btn.IsVisited && !btn.IsBlock) { btn.Previous = e; btn.IsVisited = true; queue.Enqueue(btn); } } } }
private void Thumb_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { areaText.Visibility = Visibility.Visible; MazeStartPoint = null; MazeEndPoint = null; ButtonsList.Clear(); mainArea.Children.Clear(); mainArea.Background = Brushes.LightBlue; rect.Stroke = Brushes.Blue; rect.StrokeDashArray = new DoubleCollection(new double[] { 4, 4 }); }
public void CreatePathUsingDFS(MazeButton mazeButton) { mazeButton.IsVisited = true; int buttonIndex = ButtonsList.IndexOf(mazeButton); foreach (var btn in GetAdjacent(buttonIndex)) { if (!btn.IsVisited && !btn.IsBlock) { btn.Previous = mazeButton; CreatePathUsingDFS(btn); } } }
internal static void LoadButtonsList() { ButtonsList.Clear(); ButtonsList.Add(null); StaticButtonsList.Clear(); StaticButtonsList.Add(null); for (int i = 1; i <= 9; i++) { Button b = (Button)MainForm.Controls["button" + i]; ButtonsList.Add(b); StaticButtonsList.Add(b); } }
internal static void RestartGame() { LoadButtonsList(); foreach (Button b in ButtonsList.Skip(1)) { b.Text = ""; b.Enabled = true; } PlayCount = 0; IsFirstTurn = true; IsSecondTurn = true; WasPlayerFirstTurn = true; }
public static void CreateButtonNoClickEvent(string text = "") { var button = new DataButton() { Name = $"{BaseName}{Index}", Text = text, Width = Width, Location = new Point(Left, Top), Parent = ParentControl, Visible = true }; button.Click += EventHandler; ButtonsList.Add(button); ParentControl.Controls.Add(button); Top += HeightPadding; Index += 1; }
public MainWindowVM() { MessengerInstance.Register <FlowDocumentInitMessage>(this, msg => { _viewGuid = msg.Id; _view = ( MainWindow )msg.View; _content = msg.Output; Initialize(); }); MessengerInstance.Register <DecisionMessage>(this, msg => { ButtonsList.Clear(); for (var i = 0; i < msg.DecisionCount; i++) { var dbvm = new DecisionButtonVM(msg.Decisions[i]); dbvm.DidSelectButton += Dbvm_DidSelectButton; ButtonsList.Add(dbvm); } RaisePropertyChanged(() => ButtonsList); }); }
public void RecreateButtons(int buttons) { mainArea.Background = Brushes.White; for (int i = 0; i < buttons; i++) { var createdButton = new MazeButton() { Width = 20, Height = 20, IsBlock = false, IsEndPoint = false, IsStartPoint = false, IsVisited = false, Father = this, //Content = i }; ButtonsList.Add(createdButton); mainArea.Children.Add(createdButton); } }
private void CreateButtons() { //input number int i = Inputs.Count + 1; foreach (string name in Buttons) { //button Button button = new Button(); button.TabIndex = 5; button.Text = name; button.Name = name; button.Location = new Point(InputPositionX - 1, ElementPositionY(i) - 1); button.Size = new Size(ButtonWidth + 2, ButtonDoubleHeight + 2); ButtonsList.Add(name, button); Form.Controls.Add(button); //increase input number i += 2; } }
public static void CreateCategoryButton(string text, int categoryIdentifier) { var button = new DataButton() { Name = $"{BaseName}{Index}", Text = text, Width = Width, Location = new Point(Left, Top), Parent = ParentControl, Identifier = categoryIdentifier, Visible = true, ImageAlign = ContentAlignment.MiddleLeft, TextAlign = ContentAlignment.MiddleRight }; button.Click += EventHandler; ButtonsList.Add(button); ParentControl.Controls.Add(button); Top += HeightPadding; Index += 1; }
// Use this for initialization void Start() { //Set Position to 0 transform.position = Vector3.zero; //Create button actions. AccessPoint.SetAction("Open"); ResetButton.SetAction("ResetAction"); OptionsButton.SetAction("OptionsAction"); QuitButton.SetAction("QuitAction"); //Populate the button list. //ButtonsList.Add(AccessPoint); ButtonsList.Add(OptionsButton); ButtonsList.Add(ResetButton); ButtonsList.Add(QuitButton); //Close the menu and dont show the animation when started CurrentState = MenuState.Closed; timer.Fill(); menuactive = false; }
internal static void RemoveButton(Button button) { ButtonsList.Remove(button); button.Enabled = false; }