コード例 #1
0
ファイル: Mask.cs プロジェクト: MetaColon/MinesweeperKi
 private static bool Fits(
     MaskValue maskValue,
     KnownProperty fieldValue,
     int remainingCount)
 => maskValue == MaskValue.Unknown && fieldValue == KnownProperty.Unknown ||
 maskValue == MaskValue.Anything ||
 maskValue == MaskValue.NotUnknown && fieldValue != KnownProperty.Unknown ||
 (int)maskValue == remainingCount;
コード例 #2
0
        public PropertyViewModel <T> GetKnownPropertyViewModel <T> (KnownProperty <T> property)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }
            if (this.knownEditors == null)
            {
                throw new InvalidOperationException("Querying for known properties before they've been setup");
            }
            if (!this.knownEditors.TryGetValue(property, out EditorViewModel model))
            {
                throw new KeyNotFoundException();
            }

            var vm = model as PropertyViewModel <T>;

            if (vm == null)
            {
                throw new InvalidOperationException("KnownProperty doesn't return expected property view model type");
            }

            return(vm);
        }
コード例 #3
0
ファイル: KnownField.cs プロジェクト: MetaColon/MinesweeperKi
 public void Set(int i, KnownProperty property) => Field [i] = property;
コード例 #4
0
ファイル: KnownField.cs プロジェクト: MetaColon/MinesweeperKi
 public void Set(int x, int y, KnownProperty property) => Set(x + y * SizeX, property);
コード例 #5
0
 public virtual string GetKnownPropName(KnownProperty kp)
 {
     return(string.Empty);
 }
コード例 #6
0
 public override string GetKnownPropName(KnownProperty kp)
 {
     return(knownMap.ContainsKey(kp) ? knownMap [kp] : base.GetKnownPropName(kp));
 }