コード例 #1
0
        public MainWindowViewModel(VideoPlayer videoPlayerIn)
        {
            this.exportQueueViewModel = new ExportQueueViewModel();

            OpenFileCommand               = new OpenFileCommand(this, videoPlayerIn);
            OpenExportQueueCommand        = new OpenExportQueueCommand(this, this.exportQueueViewModel);
            OpenSettingsCommand           = new OpenSettingsCommand(this);
            OpenAboutCommand              = new OpenAboutCommand(this);
            PlayOrPauseCommand            = new PlayOrPauseCommand(this, videoPlayerIn);
            SetSectionStartCommand        = new SetSectionStartCommand(this, videoPlayerIn);
            SetSectionEndCommand          = new SetSectionEndCommand(this, videoPlayerIn);
            BackwardCommand               = new BackwardCommand(this, videoPlayerIn);
            ForwardCommand                = new ForwardCommand(this, videoPlayerIn);
            StepBackwardCommand           = new SeekCommand(this, videoPlayerIn, () => - videoPlayerIn.FrameTime);
            StepForwardCommand            = new SeekCommand(this, videoPlayerIn, () => videoPlayerIn.FrameTime);
            Step1sBackwardCommand         = new SeekCommand(this, videoPlayerIn, () => - TimeSpan.FromSeconds(1));
            Step1sForwardCommand          = new SeekCommand(this, videoPlayerIn, () => TimeSpan.FromSeconds(1));
            PlayFromSelectionStartCommand = new PlayFromSelectionStartCommand(this, videoPlayerIn);
            PlaySelectionCommand          = new PlaySelectionCommand(this, videoPlayerIn);
            PlayUntilSelectionEndCommand  = new PlayUntilSelectionEndCommand(this, videoPlayerIn);
            ExportSelectionCommand        = new ExportSelectionCommand(this);
            NextVideoCommand              = new NextVideoCommand(this, videoPlayerIn);
            AddToQueueCommand             = new AddToQueueCommand(this, this.exportQueueViewModel);

            AudioVolume = ApplicationSettings.AudioVolume;
        }
コード例 #2
0
        private ICommand Backward(XTablePortable table, ICommand command)
        {
            BackwardCommand cmd = (BackwardCommand)command;

            List <KeyValuePair <IData, IData> > list = table.Backward(cmd.FromKey, cmd.FromKey != null, cmd.ToKey, cmd.ToKey != null).Take(cmd.PageCount).ToList();

            return(new BackwardCommand(cmd.PageCount, cmd.FromKey, cmd.ToKey, list));
        }
コード例 #3
0
        public IEnumerable <KeyValuePair <IData, IData> > Backward(IData to, bool hasTo, IData from, bool hasFrom)
        {
            if (hasFrom && hasTo && IndexDescriptor.KeyComparer.Compare(from, to) > 0)
            {
                throw new ArgumentException("from > to");
            }

            from = hasFrom ? from : default(IData);
            to   = hasTo ? to : default(IData);

            List <KeyValuePair <IData, IData> > records = null;
            IData nextKey = null;

            var command = new BackwardCommand(PageCapacity, to, from, null);

            Execute(command);

            records = command.List;
            nextKey = records != null && records.Count == PageCapacity ? records[records.Count - 1].Key : null;

            while (records != null)
            {
                Task task = null;
                List <KeyValuePair <IData, IData> > _records = null;

                int returnCount = nextKey != null ? records.Count - 1 : records.Count;

                if (nextKey != null)
                {
                    task = Task.Factory.StartNew(() =>
                    {
                        var _command = new BackwardCommand(PageCapacity, nextKey, from, null);
                        Execute(_command);

                        _records = _command.List;
                        nextKey  = _records != null && _records.Count == PageCapacity ? _records[_records.Count - 1].Key : null;
                    });
                }

                for (int i = 0; i < returnCount; i++)
                {
                    yield return(records[i]);
                }

                records = null;

                if (task != null)
                {
                    task.Wait();
                }

                if (_records != null)
                {
                    records = _records;
                }
            }
        }
コード例 #4
0
        private ICommand Backward(XTable table, ICommand command)
        {
            BackwardCommand cmd = (BackwardCommand)command;

            List <KeyValuePair <IData, IData> > list = new List <KeyValuePair <IData, IData> >();

            foreach (var item in table.Backward(cmd.FromKey, cmd.FromKey != null, cmd.ToKey, cmd.ToKey != null).Take(cmd.PageCount))
            {
                list.Add(item);
            }

            return(new BackwardCommand(cmd.PageCount, cmd.FromKey, cmd.ToKey, list));
        }
コード例 #5
0
        /// <summary>
        /// Makes from a string and value a command
        /// </summary>
        /// <param name="command"></param>
        /// <param name="value"></param>
        /// <returns>Command</returns>
        public IDroneCommand makeCommand(string command, double value = 0)
        {
            IDroneCommand droneCommand = null;

            if (command.Equals("Start"))
            {
                droneCommand = new StartCommand(_droneController);
            }
            else if (command.Equals("Land"))
            {
                droneCommand = new LandCommand(_droneController);
            }
            else if (command.Equals("Rise"))
            {
                droneCommand = new RiseCommand(_droneController, value);
            }
            else if (command.Equals("Fall"))
            {
                droneCommand = new FallCommand(_droneController, value);
            }
            else if (command.Equals("Right"))
            {
                droneCommand = new RightCommand(_droneController, value);
            }
            else if (command.Equals("Left"))
            {
                droneCommand = new LeftCommand(_droneController, value);
            }
            else if (command.Equals("Forward"))
            {
                droneCommand = new ForwardCommand(_droneController, value);
            }
            else if (command.Equals("Backward"))
            {
                droneCommand = new BackwardCommand(_droneController, value);
            }
            else if (command.Equals("Turn"))
            {
                droneCommand = new TurnCommand(_droneController, (int)value);
            }
            else if (command.Equals("TakePicture"))
            {
                droneCommand = new TakePictureCommand(_droneController, (int)value);
            }
            else if (command.Equals("FollowLine"))
            {
                droneCommand = new FollowLineCommand(_droneController);
            }

            return(droneCommand);
        }
コード例 #6
0
 private void OnBackButtonClicked(object sender, EventArgs e)
 {
     if (CurrentStepNumber > 0)
     {
         CurrentStepNumber--;
         if (BackwardCommand != null)
         {
             if (BackwardCommand.CanExecute(CurrentStepNumber))
             {
                 BackwardCommand.Execute(CurrentStepNumber);
             }
         }
     }
     else
     {
         // user is backing out of the wizard
         if ((WizardCancelledCommand != null) && (WizardCancelledCommand.CanExecute(null)))
         {
             WizardCancelledCommand.Execute(null);
         }
     }
 }