Beispiel #1
0
 public bool CommandDispatcher(RCommand command, string[] args)
 {
     switch (command)
     {
         case RCommand.Stop:
             return StopCommand(args);
         case RCommand.Foward:
             return FowardCommand(args);
         case RCommand.Backward:
             return BackwardCommand(args);
         case RCommand.Left:
             return LeftCommand(args);
         case RCommand.Right:
             return RightCommand(args);
         case RCommand.FowardRight:
             return FowardRightCommand(args);
         case RCommand.FowardLeft:
             return FowardLeftCommand(args);
         case RCommand.BackwardRight:
             return BackwardRightCommand(args);
         case RCommand.BackwardLeft:
             return BackwardLeftCommand(args);
         case RCommand.CameraRight:
             return CameraRightCommand(args);
         case RCommand.CameraLeft:
             return CameraLeftCommand(args);
         case RCommand.SoundMessage:
             return SoundMessageCommand(args);
         default:
             return StopCommand(args);
     }
 }
Beispiel #2
0
 /// <summary>
 ///     Предоставляет метод инициализации команд главного меню приложения
 /// </summary>
 private void MenuCommandInitialization()
 {
     //  Создание команды открытия панели настройки соединения
     OpenCommunicationPage = new RCommand(() => { });
     //  Создание команды открытия панели помощи
     OpenHelpPage = new RCommand(() => { });
     //  Создание команды открытия панели настроек приложения
     OpenApplicationSettingsPage = new RCommand(() => { });
 }
Beispiel #3
0
        /// <summary>
        ///     Конструктор класса
        /// </summary>
        public MainViewModel()
        {
            //  Указатель на экземплям главной формы приложения
            mWindow = Application.Current.MainWindow;

            //  Создание команды завершния работы приложения
            CloseApplication = new RCommand(() =>
            {
                if (mWindow != null)
                {
                    mWindow.Close();
                }
            });

            //  Создане команды изменения размера главной формы
            ResizeApplication = new RCommand(() =>
            {
                if (mWindow != null)
                {
                    if (mWindow.WindowState == WindowState.Normal)
                    {
                        mWindow.WindowState = WindowState.Maximized;
                    }
                    else
                    {
                        mWindow.WindowState = WindowState.Normal;
                    }
                }
            });

            //  Создание команды скрытия главного окна приложения
            HideApplication = new RCommand(() =>
            {
                if (mWindow != null)
                {
                    mWindow.WindowState = WindowState.Minimized;
                }
            });

            ConnectButtonCollection = new ObservableCollection <ConnectMethodDesignModel>
            {
                new ConnectMethodDesignModel()
                {
                    ButtonName    = "Lan",
                    ButtonCommand = new RCommand(() => { CurrentPage = new LanConnectPage(); })
                },
                new ConnectMethodDesignModel()
                {
                    ButtonName    = "Com",
                    ButtonCommand = new RCommand(() => { CurrentPage = new ComConnectPage(); })
                }
            };
        }
Beispiel #4
0
        public override CommandResult Invoke(Guid group, int id, object inputArg, ref object outputArg)
        {
            if (!TaskAvailable())
            {
                return(CommandResult.Disabled);
            }

            IMarkdownFlavorPublishHandler flavorHandler = GetFlavorHandler(TextView.TextBuffer);

            if (flavorHandler != null)
            {
                if (!InstallPackages.IsInstalled(flavorHandler.RequiredPackageName, 5000, RToolsSettings.Current.RBasePath))
                {
                    VsAppShell.Current.ShowErrorMessage(string.Format(CultureInfo.InvariantCulture, Resources.Error_PackageMissing, flavorHandler.RequiredPackageName));
                    return(CommandResult.Disabled);
                }

                // Save the file
                TextView.TextBuffer.Save();
                var inputFilePath = TextView.TextBuffer.GetFilePath();

                var buffer = new StringBuilder(NativeMethods.MAX_PATH);
                NativeMethods.GetShortPathName(inputFilePath, buffer, NativeMethods.MAX_PATH);

                inputFilePath   = buffer.ToString();
                _outputFilePath = Path.ChangeExtension(inputFilePath, FileExtension);

                try {
                    File.Delete(_outputFilePath);
                } catch (IOException ex) {
                    PublishLog.Current.WriteFormatAsync(MessageCategory.Error, Resources.Error_CannotDeleteFile, _outputFilePath, ex.Message);
                    return(CommandResult.Executed);
                }

                inputFilePath = inputFilePath.Replace('\\', '/');
                string outputFilePath = _outputFilePath.Replace('\\', '/');

                string arguments = flavorHandler.GetCommandLine(inputFilePath, outputFilePath, Format);

                _lastCommand = RCommand.ExecuteRExpressionAsync(arguments, PublishLog.Current, RToolsSettings.Current.RBasePath);
                _lastCommand.Task.ContinueWith((Task t) => LaunchViewer(t));
            }
            return(CommandResult.Executed);
        }
Beispiel #5
0
        public void Execute_RotatesRobotToRight(Orientation start, Orientation end)
        {
            // Arrange
            Position origin = Position.Origin;

            IRobot robot = A.Fake <IRobot>();

            robot.LastPosition = origin;
            robot.Orientation  = start;

            RCommand sut = new RCommand(robot);

            // Act
            sut.Execute();

            // Assert
            robot.Orientation.Should().Be(end);
            robot.LastPosition.Should().Be(origin);
        }
Beispiel #6
0
 public InfiniteLevel(Game game)
 {
     myGame = game;
     reset  = new RCommand(game);
 }