Beispiel #1
0
        public async Task <IActionResult> Patch(string path, [FromBody] MoveViewModel model)
        {
            if (ModelState.IsValid == false)
            {
                return(BadRequest(ModelState));
            }

            var file = await _storage.FindFileAsync(path);

            if (file == null)
            {
                return(NotFound());
            }

            var dst = await _storage.FindFolderAsync(model.Destination);

            if (dst == null)
            {
                return(NotFound());
            }

            await _storage.MoveAsync(file, dst, model.Name);

            return(Ok());
        }
    // Use this for initialization
    void Start()
    {
        // Get the Presenter from the card host components
        this.CharacterCardSelectorPresenter = CharacterCardHost.GetComponent <CardSelectorPresenter>();
        this.WeaponCardSelectorPresenter    = WeaponCardHost.GetComponent <CardSelectorPresenter>();
        this.RoomCardSelectorPresenter      = RoomCardHost.GetComponent <CardSelectorPresenter>();

        // cache the default camera position
        this.defaultCameraPosition = Camera.main.transform.position;

        // Clear out move options on start.
        ClearAllMoveOptions();

        // TODO: Subscribe to server listener for when move options are available.

        // TODO: Test code.  Comment me out later
        var mockObject1 = new MoveViewModel(StandardEnums.MoveEnum.MoveToHallway, StandardEnums.LocationEnum.DinKitch);
        var mockObject2 = new MoveViewModel(StandardEnums.MoveEnum.MoveToRoomAndSuggest, StandardEnums.LocationEnum.Library);
        var mockObject3 = new MoveViewModel(StandardEnums.MoveEnum.StayInRoomAndSuggest, StandardEnums.LocationEnum.Lounge);
        var mockObject4 = new MoveViewModel(StandardEnums.MoveEnum.TakeSecretPassageAndSuggest, StandardEnums.LocationEnum.Hall);
        var mockObject5 = new MoveViewModel(StandardEnums.MoveEnum.MakeAnAccusation, null);
        var mockObject6 = new MoveViewModel(StandardEnums.MoveEnum.EndTurn, null);
        var mockObject7 = new MoveViewModel(StandardEnums.MoveEnum.MoveToHallway, StandardEnums.LocationEnum.LibBill);

        AddMoveOptions(new List <MoveViewModel>()
        {
            mockObject1, mockObject2, mockObject3, mockObject4, mockObject5, mockObject6, mockObject7
        });

        cachedMoveMessage = null;
    }
    /// <summary>
    /// When move button is clicked, make the move for the player.
    /// </summary>
    /// <param name="movePerformed"></param>
    private void MoveButtonClickHandler(MoveViewModel movePerformed)
    {
        // Start creating the MoveMessage object and see if suggestion/accusation info is needed
        cachedMoveMessage = new MoveMessage(movePerformed.MoveID, movePerformed.LocationID);

        switch (movePerformed.MoveID)
        {
        // If the MoveID requires a suggestion to happen, start prompting for Character Selection
        case StandardEnums.MoveEnum.MoveToRoomAndSuggest:
        case StandardEnums.MoveEnum.TakeSecretPassageAndSuggest:
        case StandardEnums.MoveEnum.StayInRoomAndSuggest:
            PromptForCharacterSelection();
            break;

        // If the MoveID is for an accusation, start prompting for a Room Selection
        case StandardEnums.MoveEnum.MakeAnAccusation:
            PromptForRoomSelection();
            break;

        // Otherwise, we have all the info we need and we can send the result to the server!
        case StandardEnums.MoveEnum.MoveToHallway:
        case StandardEnums.MoveEnum.EndTurn:
            SendMoveToServer();
            break;
        }
    }
        public ManualControlViewModel(Global global)
        {
            _global = global ?? throw new ArgumentNullException();

            AxisX = new AxisViewModel(this, global)
            {
                AxisIndex = 0
            };
            AxisY = new AxisViewModel(this, global)
            {
                AxisIndex = 1
            };
            AxisZ = new AxisViewModel(this, global)
            {
                AxisIndex = 2,
                HomeIsMax = true
            };
            AxisA = new AxisViewModel(this, global)
            {
                AxisIndex = 3
            };
            AxisB = new AxisViewModel(this, global)
            {
                AxisIndex = 4
            };
            AxisC = new AxisViewModel(this, global)
            {
                AxisIndex = 5
            };

            Move = new MoveViewModel(this, global);

            CommandHistory = new CommandHistoryViewModel(this, global);

            SD = new SDViewModel(this, global);

            DirectCommand = new DirectCommandViewModel(this, global);

            Shift = new ShiftViewModel(this, global);

            Tool = new ToolViewModel(this, global);

            Rotate = new RotateViewModel(this, global);

            Custom = new CustomViewModel(this, global);

            WorkOffset = new WorkOffsetViewModel(this, global);

            _global.Com.LocalCom.CommandQueueEmpty  += OnCommandQueueEmpty;
            _global.Com.RemoteCom.CommandQueueEmpty += OnCommandQueueEmpty;
        }
Beispiel #5
0
        public ManualControlViewModel()
        {
            AxisX = new AxisViewModel(this)
            {
                AxisIndex = 0
            };
            AxisY = new AxisViewModel(this)
            {
                AxisIndex = 1
            };
            AxisZ = new AxisViewModel(this)
            {
                AxisIndex = 2,
                HomeIsMax = true
            };
            AxisA = new AxisViewModel(this)
            {
                AxisIndex = 3
            };
            AxisB = new AxisViewModel(this)
            {
                AxisIndex = 4
            };
            AxisC = new AxisViewModel(this)
            {
                AxisIndex = 5
            };

            Move = new MoveViewModel(this);

            CommandHistory = new CommandHistoryViewModel(this);

            SD = new SDViewModel(this);

            DirectCommand = new DirectCommandViewModel(this);

            Shift = new ShiftViewModel(this);

            Tool = new ToolViewModel(this);

            Rotate = new RotateViewModel(this);

            Custom = new CustomViewModel(this);

            WorkOffset = new WorkOffsetViewModel(this);

            Global.Instance.Com.LocalCom.CommandQueueEmpty  += OnCommandQueueEmpty;
            Global.Instance.Com.RemoteCom.CommandQueueEmpty += OnCommandQueueEmpty;
        }
Beispiel #6
0
        public async Task MoveAsync()
        {
            var categoryPaths = this.dataSet.ExtendedProperties[CremaSchema.TypeDirectory] as string[];
            var dialog        = new MoveViewModel(this.categoryPath, categoryPaths);

            if (await dialog.ShowDialogAsync() != true)
            {
                return;
            }

            //await this.UnlockAsync(comment);

            //if (this.selector != null)
            //    this.ExpandAncestors();
        }
        public async Task MoveAsync()
        {
            var categoryPaths = GetAllCategoryPaths(this);
            var dialog        = new MoveViewModel(this.categoryPath, categoryPaths);

            if (await dialog.ShowDialogAsync() != true)
            {
                return;
            }

            //await this.UnlockAsync(comment);

            //if (this.selector != null)
            //    this.ExpandAncestors();
        }
Beispiel #8
0
 private void MoveFile_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (MoveModel.MoveClickCounter == 0)
     {
         MoveFile.Content           = "Paste";
         MoveModel.MoveClickCounter = 1;
     }
     else if (MoveModel.MoveClickCounter == 1)
     {
         MoveFile.Content           = "Move";
         MoveFile.IsEnabled         = false;
         CopyFile.IsEnabled         = false;
         MoveModel.MoveClickCounter = 0;
         MoveViewModel.MoveFile(MoveModel.SourceFileName, MoveModel.DestinantionDirectory, Zip);
     }
 }
Beispiel #9
0
        public async Task <IActionResult> Move([FromRoute] string path, [FromForm] MoveViewModel model)
        {
            path = (path ?? string.Empty).TrimEnd('/');

            if (!ModelState.IsValid)
            {
                TempData[ERROR_MESSAGES] = "InvalidRequest";
                return(RedirectToIndexWithQueryString());
            }

            var dst = await _storage.FindFolderAsync(model.Destination);

            if (dst == null)
            {
                TempData[ERROR_MESSAGES] = $"NotFound:{model.Destination}";
                return(RedirectToIndexWithQueryString());
            }

            if (model.Folders != null && model.Folders.Count() == 1)
            {
                var srcPath = $"{path}/{model.Folders.First()}";
                var src     = await _storage.FindFolderAsync(srcPath);

                await _storage.MoveAsync(src, dst, model.Name);
            }

            else if (model.Files != null && model.Files.Count() == 1)
            {
                var srcPath = $"{path}/{model.Files.First()}";
                var src     = await _storage.FindFileAsync(srcPath);

                await _storage.MoveAsync(src, dst, model.Name);
            }

            else
            {
                TempData[ERROR_MESSAGES] = $"NotFound:{path}";
            }

            return(RedirectToIndexWithQueryString());
        }
        public async Task MoveAsync()
        {
            var dataSet       = this.dataTable.DataSet;
            var categoryPaths = CategoryTreeViewItemViewModel.GetAllCategoryPaths(this);
            var dialog        = new MoveViewModel(this.dataTable.CategoryPath + this.dataTable.Name, categoryPaths);

            if (await dialog.ShowDialogAsync() != true)
            {
                return;
            }

            var targetViewModel = FindCategory(dialog.TargetPath);

            this.Parent = null;
            this.Parent = targetViewModel;

            if (this.selector != null)
            {
                this.ExpandAncestors();
            }
        }
        public async Task MoveAsync()
        {
            var dataSet       = this.dataType.DataSet;
            var categoryPaths = dataSet.ExtendedProperties[CremaSchema.TypeDirectory] as string[];
            var dialog        = new MoveViewModel(this.dataType.CategoryPath + this.dataType.Name, categoryPaths);

            if (await dialog.ShowDialogAsync() != true)
            {
                return;
            }

            var targetViewModel = FindCategory(dialog.TargetPath);

            this.Parent = null;
            this.Parent = targetViewModel;

            if (this.selector != null)
            {
                this.ExpandAncestors();
            }
        }
 public MovePage()
 {
     InitializeComponent();
     viewModel      = new MoveViewModel();
     BindingContext = viewModel;
 }
Beispiel #13
0
        public async Task <IActionResult> GetMove(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var move = await _context.Movement.FindAsync(id);

            if (move == null)
            {
                return(NotFound());
            }

            MoveViewModel data = new MoveViewModel();

            data.ID       = move.ID;
            data.MoveDate = move.MovementDate.ToShortDateString();
            data.Status   = move.Status;
            var location = await _context.Location.FindAsync(move.LocationID);

            if (location == null)
            {
                return(NotFound());
            }
            data.LocationName  = location.Name;
            data.Description   = move.Description;
            data.ApprovedBy    = move.ApprovedBy;
            data.MoveAssetList = new List <MoveItemViewModel>();
            var moveAssetList = await _context.MovementItem.Where(a => a.MovementID == move.ID && a.DeletedDate == null).ToListAsync();

            if (moveAssetList.Any())
            {
                var locationList = await _context.Location.ToListAsync();

                foreach (var item in moveAssetList)
                {
                    var asset = await _context.Asset.FindAsync(item.AssetID);

                    var category = await _context.Category.FindAsync(asset.CategoryID);

                    var latestLog = await _context.MovementLog.Where(a => a.AssetID == item.AssetID).OrderBy(a => a.CreatedDate).LastOrDefaultAsync();

                    string lastLocation = "-";
                    if (latestLog != null)
                    {
                        lastLocation = locationList.Where(a => a.ID == latestLog.LocationID).FirstOrDefault().Name;
                    }

                    data.MoveAssetList.Add(new MoveItemViewModel
                    {
                        ID              = item.ID,
                        Name            = asset.Name,
                        CategoryName    = category.Name,
                        CurrentLocation = lastLocation,
                        IsMoved         = item.IsMoved
                    });
                }
            }

            return(Ok(data));
        }
Beispiel #14
0
        private IDisposable BindToMove(MoveViewModel z)
        {
            CompositeDisposable moveDisposable = new CompositeDisposable();

            z.JerkPowerUp
            .BindTo(
                textBoxJerkPowerUp,
                w => w.Text,
                BindingMode.TwoWay,
                null,
                null,
                Observable.FromEvent <EventHandler, EventArgs>(
                    h => (s, e) => h(e),
                    h => textBoxJerkPowerUp.TextChanged += h,
                    h => textBoxJerkPowerUp.TextChanged -= h
                    )
                .ToUnit()
                )
            .AddTo(moveDisposable);

            z.JerkPowerUp
            .BindToErrorProvider(errorProvider, textBoxJerkPowerUp)
            .AddTo(moveDisposable);

            z.JerkPowerDown
            .BindTo(
                textBoxJerkPowerDown,
                w => w.Text,
                BindingMode.TwoWay,
                null,
                null,
                Observable.FromEvent <EventHandler, EventArgs>(
                    h => (s, e) => h(e),
                    h => textBoxJerkPowerDown.TextChanged += h,
                    h => textBoxJerkPowerDown.TextChanged -= h
                    )
                .ToUnit()
                )
            .AddTo(moveDisposable);

            z.JerkPowerDown
            .BindToErrorProvider(errorProvider, textBoxJerkPowerDown)
            .AddTo(moveDisposable);

            z.JerkBrakeUp
            .BindTo(
                textBoxJerkBrakeUp,
                w => w.Text,
                BindingMode.TwoWay,
                null,
                null,
                Observable.FromEvent <EventHandler, EventArgs>(
                    h => (s, e) => h(e),
                    h => textBoxJerkBrakeUp.TextChanged += h,
                    h => textBoxJerkBrakeUp.TextChanged -= h
                    )
                .ToUnit()
                )
            .AddTo(moveDisposable);

            z.JerkBrakeUp
            .BindToErrorProvider(errorProvider, textBoxJerkBrakeUp)
            .AddTo(moveDisposable);

            z.JerkBrakeDown
            .BindTo(
                textBoxJerkBrakeDown,
                w => w.Text,
                BindingMode.TwoWay,
                null,
                null,
                Observable.FromEvent <EventHandler, EventArgs>(
                    h => (s, e) => h(e),
                    h => textBoxJerkBrakeDown.TextChanged += h,
                    h => textBoxJerkBrakeDown.TextChanged -= h
                    )
                .ToUnit()
                )
            .AddTo(moveDisposable);

            z.JerkBrakeDown
            .BindToErrorProvider(errorProvider, textBoxJerkBrakeDown)
            .AddTo(moveDisposable);

            z.BrakeCylinderUp
            .BindTo(
                textBoxBrakeCylinderUp,
                w => w.Text,
                BindingMode.TwoWay,
                null,
                null,
                Observable.FromEvent <EventHandler, EventArgs>(
                    h => (s, e) => h(e),
                    h => textBoxBrakeCylinderUp.TextChanged += h,
                    h => textBoxBrakeCylinderUp.TextChanged -= h
                    )
                .ToUnit()
                )
            .AddTo(moveDisposable);

            z.BrakeCylinderUp
            .BindToErrorProvider(errorProvider, textBoxBrakeCylinderUp)
            .AddTo(moveDisposable);

            z.BrakeCylinderDown
            .BindTo(
                textBoxBrakeCylinderDown,
                w => w.Text,
                BindingMode.TwoWay,
                null,
                null,
                Observable.FromEvent <EventHandler, EventArgs>(
                    h => (s, e) => h(e),
                    h => textBoxBrakeCylinderDown.TextChanged += h,
                    h => textBoxBrakeCylinderDown.TextChanged -= h
                    )
                .ToUnit()
                )
            .AddTo(moveDisposable);

            z.BrakeCylinderDown
            .BindToErrorProvider(errorProvider, textBoxBrakeCylinderDown)
            .AddTo(moveDisposable);

            return(moveDisposable);
        }
Beispiel #15
0
 public MovePage(IConnectionService connectionService)
 {
     InitializeComponent();
     BindingContext = new MoveViewModel(connectionService);
 }