Exemple #1
0
        public Cell(ICell cell, Grid parent, Point p)
        {
            _cell = cell;
            var values = new List<int>();

            if (IsDefined)
            {
                var value = (int) (cell.Value);
                Result = value.ToString(CultureInfo.InvariantCulture);
                ResultColor = _cellColors[value - 1];
            }
            else
            {
                foreach (var value in _allNumericValues)
                {
                    if (cell.MayHaveValue(value))
                    {
                        values.Add((int) value);
                    }
                }

                Values =
                    Enumerable.Range(1, Width)
                              .ToList()
                              .Select(
                                  value =>
                                  Tuple.Create(value, new RelayCommand(() => parent.ValueChoosen(value, p)),
                                               values.Contains(value), _cellColors[value - 1]));
                Result = "?";
            }
        }
Exemple #2
0
 private void ResetInner()
 {
     _gridManager = Factory.Instance.CreateNewGridManager();
     CurrentGrid = new Grid(_gridManager.CurrentGrid, this);
 }
Exemple #3
0
 private void LoadInner()
 {
     var dlg = new OpenFileDialog { DefaultExt = "sudoku", Filter = "Sodoku | *.sudoku", CheckFileExists = true };
     if (dlg.ShowDialog() == DialogResult.OK)
     {
         using (var file = new FileStream(dlg.FileName, FileMode.Open))
         {
             _gridManager = Factory.Instance.LoadGridManager(file);
             CurrentGrid = new Grid(_gridManager.CurrentGrid, this);
         }
     }
 }