Ejemplo n.º 1
0
 public void SetUp()
 {
     _subject = new ExpandCommand();
     _options = new Options {
         FilePath = @"Files\map.tmx"
     };
 }
        private void UpdateState()
        {
            if (Status == ExpandStatus.Collapsed || Status == ExpandStatus.Expanding)
            {
                ExpandCommand?.Execute(this);
            }
            else
            {
                CollapseCommand?.Execute(this);
            }

            ForceUpdateSize();
        }
Ejemplo n.º 3
0
        protected virtual void setupCommands()
        {
            ContextMenuCommand = new SimpleCommand()
            {
                CanExecuteDelegate = (x) =>
                {
                    ViewerBaseVM vm = (x as ViewerBaseVM);
                    return(vm.IsContextMenuEnabled);
                },
                ExecuteDelegate = (x) =>
                {
                    ViewerBaseVM vm = (x as ViewerBaseVM);
                    if (vm.IsContextMenuEnabled)
                    {
                        Point pt = UITools.GetScreenMousePosition();
                        switch (vm.ContextMenu(pt))
                        {
                        case "open": if (ExpandCommand != null)
                            {
                                ExpandCommand.Execute(vm);
                            }
                            break;

                        case "rename": if (RenameCommand != null)
                            {
                                RenameCommand.Execute(vm);
                            }
                            break;

                        case "refresh": if (RefreshCommand != null)
                            {
                                RefreshCommand.Execute(vm);
                            }
                            break;
                        }
                    }
                }
            };

            RefreshCommand = new SimpleCommand()
            {
                ExecuteDelegate = (x) =>
                {
                    Refresh();
                }
            };

            //ExpandCommand = new SimpleCommand()
            //{
            //    CanExecuteDelegate =
            //        (x) =>
            //        {
            //            ViewerBaseViewModel<FI, DI, FSI> vm = (x as ViewerBaseViewModel<FI, DI, FSI>);
            //            return vm == null ? false : vm.CanExpand;
            //        },
            //    ExecuteDelegate =
            //       (x) =>
            //       {
            //           ViewerBaseViewModel<FI, DI, FSI> vm = (x as ViewerBaseViewModel<FI, DI, FSI>);
            //           vm.Expand();
            //       }
            //};
        }