public PathFindView(PathFindingViewModel model) { Model = model; string algorithmMenu = new MenuList(model.AlgorithmKeys.ToArray()).ToString(); Model.AlgorithmKeyInputMessage = algorithmMenu + Resources.ChooseAlrorithm; Model.SourceVertexInputMessage = "\n" + Resources.StartVertexPointInputMsg; Model.TargetVertexInputMessage = Resources.EndVertexCoordinateInputMsg; }
public PathFindView(PathFindingViewModel model) { Model = model; var algorithmMenu = Menu.CreateMenu(model.AlgorithmKeys.ToArray()); Model.AlgorithmKeyInputMessage = algorithmMenu + Resources.ChooseAlrorithm; Model.StartVertexInputMessage = "\n" + Resources.StartVertexPointInputMsg; Model.EndVertexInputMessage = Resources.EndVertexCoordinateInputMsg; }
public PathFindingWindow(PathFindingViewModel model) { InitializeComponent(); okButton.Click += model.StartPathfinding; cancelButton.Click += model.CancelPathFinding; var dataSource = model.AlgorithmKeys .Select(key => new { Name = key }).ToArray(); algorithmListBox.DataSource = dataSource; var algoKey = dataSource.First(); algorithmListBox.ValueMember = nameof(algoKey.Name); var algorithmBinding = new Binding( nameof(algorithmListBox.SelectedValue), model, nameof(model.AlgorithmKey)); algorithmListBox.DataBindings.Add(algorithmBinding); var bindingDelaySliderToDelayTextBox = new Binding( nameof(delaySlider.Value), delayTextBox, nameof(delayTextBox.Text), true, DataSourceUpdateMode.OnPropertyChanged); delaySlider.DataBindings.Add(bindingDelaySliderToDelayTextBox); delaySlider.Minimum = Constants.AlgorithmDelayTimeValueRange.LowerValueOfRange; delaySlider.Maximum = Constants.AlgorithmDelayTimeValueRange.UpperValueOfRange; var bindingDelatTextBoxToModel = new Binding( nameof(delayTextBox.Text), model, nameof(model.DelayTime), true, DataSourceUpdateMode.OnPropertyChanged); delayTextBox.DataBindings.Add(bindingDelatTextBoxToModel); }