コード例 #1
0
        public ViewerConfigViewModel(ViewerConfig config = null, Action <ViewerConfig> callback = null)
        {
            Config = null != config?config.Clone() : new ViewerConfig();

            Accepted = false;
            Callback = callback;
        }
コード例 #2
0
ファイル: AppViewModel.cs プロジェクト: Khaleesh/Mzinga
        public static void Init(ViewerConfig viewerConfig, DoOnUIThread doOnUIThread)
        {
            if (null != Instance)
            {
                throw new NotSupportedException();
            }

            Instance = new AppViewModel(viewerConfig, doOnUIThread);
        }
コード例 #3
0
ファイル: AppViewModel.cs プロジェクト: Khaleesh/Mzinga
        private AppViewModel(ViewerConfig viewerConfig, DoOnUIThread doOnUIThread)
        {
            if (null == viewerConfig)
            {
                throw new ArgumentNullException("viewerConfig");
            }

            if (null == doOnUIThread)
            {
                throw new ArgumentNullException("doOnUIThread");
            }

            ViewerConfig = viewerConfig;

            DoOnUIThread = doOnUIThread;

            try
            {
                // Try starting external engine
                switch (ViewerConfig.EngineType)
                {
                case EngineType.CommandLine:
                    EngineWrapper = new CLIEngineWrapper(ViewerConfig.EngineCommandLine);
                    EngineWrapper.StartEngine();
                    break;
                }
            }
            catch (Exception ex)
            {
                EngineWrapper?.StopEngine();
                EngineWrapper          = null;
                EngineExceptionOnStart = ex;
            }

            if (null == EngineWrapper)
            {
                // No engine started, use an internal one
                EngineWrapper = new InternalEngineWrapper(ProgramTitle);
                EngineWrapper.StartEngine();
            }
        }
コード例 #4
0
        public void CopyFrom(ViewerConfig config)
        {
            if (null == config)
            {
                throw new ArgumentNullException("config");
            }

            EngineCommandLine = config.EngineCommandLine;
            EngineType        = config.EngineType;

            HexOrientation = config.HexOrientation;
            NotationType   = config.NotationType;

            DisablePiecesInHandWithNoMoves = config.DisablePiecesInHandWithNoMoves;
            DisablePiecesInPlayWithNoMoves = config.DisablePiecesInPlayWithNoMoves;

            HighlightTargetMove     = config.HighlightTargetMove;
            HighlightValidMoves     = config.HighlightValidMoves;
            HighlightLastMovePlayed = config.HighlightLastMovePlayed;

            BlockInvalidMoves       = config.BlockInvalidMoves;
            RequireMoveConfirmation = config.RequireMoveConfirmation;
        }
コード例 #5
0
        public ViewerConfig Clone()
        {
            ViewerConfig clone = new ViewerConfig
            {
                EngineCommandLine = EngineCommandLine,
                EngineType        = EngineType,

                HexOrientation = HexOrientation,
                NotationType   = NotationType,

                DisablePiecesInHandWithNoMoves = DisablePiecesInHandWithNoMoves,
                DisablePiecesInPlayWithNoMoves = DisablePiecesInPlayWithNoMoves,

                HighlightTargetMove     = HighlightTargetMove,
                HighlightValidMoves     = HighlightValidMoves,
                HighlightLastMovePlayed = HighlightLastMovePlayed,

                BlockInvalidMoves       = BlockInvalidMoves,
                RequireMoveConfirmation = RequireMoveConfirmation
            };

            return(clone);
        }
コード例 #6
0
ファイル: Messages.cs プロジェクト: Khaleesh/Mzinga
 public ViewerConfigMessage(ViewerConfig config = null, Action <ViewerConfig> callback = null) : base()
 {
     ViewerConfigVM = new ViewerConfigViewModel(config, callback);
 }