Example #1
0
        private void DoAction(string actionStr)
        {
            switch (actionStr)
            {
            case "create":
                controller.NewMogwaiKeys();
                LogInConsole("TASK", "created new mogwaikeys.");
                break;

            case "send":
                if (controller.HasMogwayKeys)
                {
                    if (controller.SendMog())
                    {
                        LogInConsole("DONE", $"sending mogs to address {controller.CurrentMogwayKeys.Address}.");
                    }
                    else
                    {
                        LogInConsole("FAIL", $"couldn't send mogs, see log file for more information.");
                    }
                }
                break;

            case "bind":
                if (controller.HasMogwayKeys)
                {
                    if (controller.BindMogwai())
                    {
                        LogInConsole("DONE", $"binding mogwai on address {controller.CurrentMogwayKeys.Address}.");
                    }
                    else
                    {
                        LogInConsole("FAIL", $"couldn't bind mogwai, see log file for more information.");
                    }
                }
                break;

            case "show":
                break;

            case "play":
                State = SadGuiState.PLAY;
                break;

            default:
                break;
            }

            // clear all taggs after actions
            controller.ClearTag();
        }
        private void DoAction(string actionStr)
        {
            switch (actionStr)
            {
            case "create":
                _controller.NewMogwaiKeys();
                LogInConsole("TASK", "created new mogwaikeys.");
                break;

            case "send":
                if (_controller.HasMogwayKeys)
                {
                    if (_controller.SendMog(_transferFunds))
                    {
                        LogInConsole("DONE", $"sending mogs to address {_controller.CurrentMogwaiKeys.Address}.");
                    }
                    else
                    {
                        LogInConsole("FAIL", "couldn\'t send mogs, see log file for more information.");
                    }
                }
                break;

            case "bind":
                if (_controller.HasMogwayKeys)
                {
                    if (_controller.BindMogwai())
                    {
                        LogInConsole("DONE", $"binding mogwai on address {_controller.CurrentMogwaiKeys.Address}.");
                    }
                    else
                    {
                        LogInConsole("FAIL", "couldn\'t bind mogwai, see log file for more information.");
                    }
                }
                break;

            case "watch":
                if (_controller.CurrentMogwaiKeys != null)
                {
                    _controller.WatchToggle();
                }
                else
                {
                    LogInConsole("FAIL", "make sure to choosse a mogwai before trying to play.");
                }
                break;

            case "play":
                if (_controller.CurrentMogwaiKeys?.Mogwai != null && !_controller.CurrentMogwaiKeys.IsLocked)
                {
                    State = SadGuiState.Play;
                }
                else
                {
                    LogInConsole("FAIL", "make sure to choosse a mogwai before trying to play.");
                }
                break;

            case "evolve":
                if (_controller.CurrentMogwaiKeys?.Mogwai != null)
                {
                    LogInConsole("DONE", $"auto evolving mogwai {_controller.CurrentMogwaiKeys.Mogwai.Name} now.");
                    _controller.EvolveMogwai();
                }
                else
                {
                    LogInConsole("FAIL", "make sure to choosse a mogwai before trying to play.");
                }
                break;
            }

            // clear all taggs after actions
            _controller.ClearTag();
        }