Пример #1
0
        public async Task LoadGameAsync(string path)
        {
            if (!GameActive)
            {
                await persistence.LoadAsync(path);

                Size         = persistence.Size;
                CurrentPiece = persistence.CurrentPiece;
                Table        = persistence.Table;
                ContinueGame();
                UpdateTable?.Invoke(this, null);
            }
        }
Пример #2
0
 private void item_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "IsChecked")
     {
         LoopParamInfo paramInfo = sender as LoopParamInfo;
         if (paramInfo.IsChecked == true)
         {
             _Table.Columns.Add(paramInfo.DisplayName, paramInfo.PropertyType);
             paramInfo.Params.Clear();
         }
         else
         {
             _Table.Columns.Remove(paramInfo.DisplayName);
         }
         if (UpdateTable != null)
         {
             UpdateTable.Invoke(this);
         }
         List <LoopParamInfo> paramInfos = new List <LoopParamInfo>();
         foreach (var param in ParamInfolist)
         {
             if (param.IsChecked == true)
             {
                 paramInfos.Add(param);
             }
         }
         foreach (var param in ParamInfolist)
         {
             param.Params.Clear();
             if (param.IsChecked == false)
             {
                 foreach (var item in paramInfos)
                 {
                     if (!item.Equals(param) && item.PropertyType.GetType() == param.PropertyType.GetType())
                     {
                         param.Params.Add(item);
                     }
                 }
             }
             param.Params.Insert(0, new LoopParamInfo());
         }
     }
 }
Пример #3
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            int Rows, Cols, ASpeed;

            if (!String.IsNullOrEmpty(txtName.Text))
            {
                if (int.TryParse(txtRows.Text, out Rows))
                {
                    if (int.TryParse(txtCols.Text, out Cols))
                    {
                        if (int.TryParse(txtAnimationSpeed.Text, out ASpeed))
                        {
                            StartPoint.IsChecked = true;
                            UpdateTable?.Invoke(null, new UpdateTableEventArgs()
                            {
                                RowCount = Rows, ColCount = Cols, AnimationSpeed = ASpeed, UncertaintyLevel = slider.Value, BackPathType = (Shortest.IsChecked == true) ? BackPathType.Shortest : BackPathType.Reversed, Title = txtName.Text
                            });
                        }
                    }
                }
            }
        }
Пример #4
0
 private void UpdateButton_Click(object sender, EventArgs e)
 {
     UpdateTable?.Invoke(sender, EventArgs.Empty);
 }