コード例 #1
0
 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;
 }
コード例 #2
0
ファイル: PathFindView.cs プロジェクト: lanicon/PathFinding
        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;
        }
コード例 #3
0
        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);
        }