コード例 #1
0
        public async Task <IActionResult> Post([FromBody] ActionsViewModel actions)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Actions _actions = Mapper.Map <Actions>(actions);
                    //_actions.Name = _actions.Name.ToUpper();

                    _actions.ProcessId = actions.ProcessId;
                    _actions.Process   = _unitOfWork.Process.GetSingleOrDefault(e => e.Id == actions.ProcessId);

                    _unitOfWork.Actions.Add(_actions);
                    await _unitOfWork.SaveChangesAsync();

                    return(Ok("OK"));
                }
                catch (Exception ex)
                {
                    return(BadRequest(ex.Data));
                }
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }
コード例 #2
0
        public PartialViewResult GetActionsView(long uri, bool vertical)
        {
            var hvm = new ActionsViewModel();

            if (AppUserState == null || AppUserState.Connected == false)
            {
                return(null);
            }
            var conn = new InforConnection(tu: _tu, tup: _tup);
            var rec  = (InforRecord)conn.GetRecordWeb(uri, AppUserState.UserName, AppUserState.Wgs, AppUserState.Ds);

            hvm.Actions      = ActionService.GetActions(AppUserState.Wgs, AppUserState.Ds, AppUserState.UserName, uri);
            hvm.RecordNumber = rec.RecordNumber;
            var firstOrDefault = hvm.Actions.FirstOrDefault(ac => ac.Status == InforActionStatus.Current);

            if (firstOrDefault != null)
            {
                hvm.CurrentActionUri = firstOrDefault.Uri;
            }
            hvm.RecordUri     = rec.Uri;
            hvm.Title         = rec.Title;
            hvm.VerticalView  = vertical;
            hvm.CanAddActions = rec.CanAddActions;
            return(PartialView("_Actions", hvm));
        }
コード例 #3
0
 private void InitializeViews()
 {
     BasesViewModel = new BasesViewModel(db);
     BasesView      = new BasesView {
         DataContext = BasesViewModel
     };
     PlatformViewModel = new PlatformViewModel(db);
     PlatformView      = new PlatformView {
         DataContext = PlatformViewModel
     };
     ActionsViewModel = new ActionsViewModel(db);
     ActionsView      = new ActionsView {
         DataContext = ActionsViewModel
     };
     DistributionViewModel = new DistributionViewModel(db);
     DistributionView      = new DistributionView {
         DataContext = DistributionViewModel
     };
     HomeViewModel = new HomeViewModel(db);
     HomeView      = new HomeView {
         DataContext = HomeViewModel
     };
     TelegramViewModel = new TelegramViewModel(db);
     TelegramView      = new TelegramView {
         DataContext = TelegramViewModel
     };
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SendToWindowActionViewModel"/> class.
 /// </summary>
 /// <param name="action">The action.</param>
 /// <param name="actionDescriptor">The action descriptor.</param>
 /// <param name="allActionDescriptions">All action descriptions.</param>
 public SendToWindowActionViewModel([NotNull] SendToWindowAction action, [NotNull] ActionDescription actionDescriptor, [NotNull] IEnumerable <ActionDescription> allActionDescriptions)
     : base(action, actionDescriptor, allActionDescriptions)
 {
     _action           = action;
     _allDescriptors   = allActionDescriptions;
     _actionsToExecute = new ActionsViewModel(action.ActionsToExecute, allActionDescriptions);
     _actionsToExecute.PropertyChanged += HandleActionDescriptionChange;
 }
コード例 #5
0
ファイル: RoomViewModel.cs プロジェクト: syrompetka/mudclient
        public RoomViewModel Clone()
        {
            var additionalRoomParameters = AdditionalRoomParameters.Clone();

            return(new RoomViewModel(Room, additionalRoomParameters, Exits, Zone, _allActionDescriptions)
            {
                _actionsViewModel = ActionsViewModel.Clone(additionalRoomParameters.ActionsToExecuteOnRoomEntry)
            });
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hotkey"></param>
        /// <param name="actionDescriptions"></param>
        public GlobalHotkeyViewModel([NotNull] Hotkey hotkey, [NotNull] IEnumerable <ActionDescription> actionDescriptions)
        {
            Assert.ArgumentNotNull(hotkey, "hotkey");
            Assert.ArgumentNotNull(actionDescriptions, "actionDescriptions");

            _actionDescriptions = actionDescriptions;
            Hotkey           = hotkey;
            ActionsViewModel = new ActionsViewModel(hotkey.Actions, _actionDescriptions);
        }
コード例 #7
0
        public WindowOverTrayHelper(Window window, ActionsViewModel vm)
        {
            this.window    = window;
            this.viewModel = vm;

            // Общие события
            this.window.Closing          += window_Closing;
            this.window.IsVisibleChanged += window_IsVisibleChanged;
        }
コード例 #8
0
        public AliasViewModel Clone()
        {
            var clonedAlias = new CommandAlias();

            return(new AliasViewModel(AllGroups, AliasGroup, clonedAlias, _actionDescriptions)
            {
                ActionsViewModel = ActionsViewModel.Clone(clonedAlias.Actions),
                Command = Command
            });
        }
コード例 #9
0
 protected virtual void InitViewModels()
 {
     ActionsViewModel          = new ActionsViewModel(BaseLayer, ActionErrorCatcher);
     ActionViewModel           = new ActionViewModel(CreateActionTemplate(), ActionsViewModel, ActionErrorCatcher);
     EventsViewModel           = new EventsViewModel(BaseLayer, EventErrorCatcher);
     EventViewModel            = new EventViewModel(CreateEventTemplate(), EventsViewModel, EventErrorCatcher);
     TaskParamsViewModel       = new TaskParamsViewModel(BaseLayer, TaskParamErrorCatcher);
     EventsDepActionsViewModel = new EventsDepActionsViewModel(BaseLayer, EventErrorCatcher);
     EventDepActionViewModel   = new EventDepActionViewModel(BaseLayer, CreateEventTemplate(), EventsDepActionsViewModel, EventErrorCatcher);
 }
コード例 #10
0
        public HotkeyViewModel Clone()
        {
            var clonedHotkey = new Hotkey();

            return(new HotkeyViewModel(AllGroups, HotkeyGroup, clonedHotkey, _actionDescriptions)
            {
                Key = Key,
                ModifierKeys = ModifierKeys,
                ActionsViewModel = ActionsViewModel.Clone(clonedHotkey.Actions)
            });
        }
コード例 #11
0
ファイル: RoomViewModel.cs プロジェクト: syrompetka/mudclient
        /// <summary>
        /// Updates the specified room view model.
        /// </summary>
        /// <param name="roomViewModel">The room view model.</param>
        public void Update([NotNull] RoomViewModel roomViewModel)
        {
            Assert.ArgumentNotNull(roomViewModel, "roomViewModel");

            _actionsViewModel                   = null;
            AdditionalRoomParameters            = roomViewModel.AdditionalRoomParameters;
            AdditionalRoomParameters.HasChanges = true;
            OnPropertyChanged("Icon");
            OnPropertyChanged("Color");
            OnPropertyChanged("Alias");
            OnPropertyChanged("Comments");
        }
コード例 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AliasViewModel"/> class.
        /// </summary>
        /// <param name="allGroups">All groups.</param>
        /// <param name="aliasGroup">The alias group.</param>
        /// <param name="commandAlias">The alias.</param>
        /// <param name="actionDescriptions">The action descriptions.</param>
        public AliasViewModel([NotNull] IEnumerable <GroupViewModel> allGroups, [NotNull] GroupViewModel aliasGroup, [NotNull] CommandAlias commandAlias, [NotNull] IEnumerable <ActionDescription> actionDescriptions)
        {
            Assert.ArgumentNotNull(allGroups, "allGroups");
            Assert.ArgumentNotNull(aliasGroup, "aliasGroup");
            Assert.ArgumentNotNull(commandAlias, "commandAlias");
            Assert.ArgumentNotNull(actionDescriptions, "actionDescriptions");

            _aliasGroup         = aliasGroup;
            _actionDescriptions = actionDescriptions;
            CommandAlias        = commandAlias;
            AllGroups           = allGroups;
            ActionsViewModel    = new ActionsViewModel(commandAlias.Actions, actionDescriptions);
        }
コード例 #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TriggerViewModel"/> class.
        /// </summary>
        /// <param name="allGroups">All groups.</param>
        /// <param name="triggersGroup">The triggers group.</param>
        /// <param name="trigger">The trigger.</param>
        /// <param name="actionDescriptions">The action descriptions.</param>
        public TriggerViewModel([NotNull] IEnumerable <GroupViewModel> allGroups, [NotNull] GroupViewModel triggersGroup, [NotNull] TextTrigger trigger, [NotNull] IEnumerable <ActionDescription> actionDescriptions)
        {
            Assert.ArgumentNotNull(allGroups, "allGroups");
            Assert.ArgumentNotNull(triggersGroup, "triggersGroup");
            Assert.ArgumentNotNull(trigger, "trigger");
            Assert.ArgumentNotNull(actionDescriptions, "actionDescriptions");

            AllGroups           = allGroups;
            _triggersGroup      = triggersGroup;
            _actionDescriptions = actionDescriptions;
            Trigger             = trigger;
            ActionsViewModel    = new ActionsViewModel(trigger.Actions, _actionDescriptions);
        }
コード例 #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HotkeyViewModel"/> class.
        /// </summary>
        /// <param name="allGroups">All groups.</param>
        /// <param name="hotkeyGroup">The hot key group.</param>
        /// <param name="hotkey">The hotkey.</param>
        /// <param name="actionDescriptions">The action descriptions.</param>
        public HotkeyViewModel([NotNull] IEnumerable <GroupViewModel> allGroups, [NotNull] GroupViewModel hotkeyGroup, [NotNull] Hotkey hotkey, [NotNull] IEnumerable <ActionDescription> actionDescriptions)
        {
            Assert.ArgumentNotNull(allGroups, "allGroups");
            Assert.ArgumentNotNull(hotkeyGroup, "hotkeyGroup");
            Assert.ArgumentNotNull(hotkey, "hotkey");
            Assert.ArgumentNotNull(actionDescriptions, "actionDescriptions");

            AllGroups           = allGroups;
            _hotkeyGroup        = hotkeyGroup;
            _actionDescriptions = actionDescriptions;
            Hotkey           = hotkey;
            ActionsViewModel = new ActionsViewModel(hotkey.Actions, _actionDescriptions);
        }
コード例 #15
0
        public GlobalHotkeyViewModel Clone()
        {
            var clonedHotkey = new Hotkey()
            {
                Key = Key, ModifierKeys = ModifierKeys
            };

            return(new GlobalHotkeyViewModel(clonedHotkey, _actionDescriptions)
            {
                Key = Key,
                ModifierKeys = ModifierKeys,
                ActionsViewModel = ActionsViewModel.Clone(clonedHotkey.Actions)
            });
        }
コード例 #16
0
        public PopupWindow(ActionsViewModel vm)
        {
            InitializeComponent();

            this.viewModel   = vm;
            this.uiHelper    = new WindowOverTrayHelper(this, viewModel);
            this.DataContext = viewModel;
            this.viewModel.NewActionRetreived += viewModel_NewActionRetreived;

            this.hideTimer     = new DispatcherTimer(DispatcherPriority.ContextIdle);
            hideTimer.Interval = TimeSpan.FromSeconds(ShowTimeoutSeconds);
            hideTimer.Tick    += hideTimer_Tick;

            this.chimePlayer = new SoundPlayer(AppResources.chime);
        }
コード例 #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConditionalActionViewModel"/> class.
        /// </summary>
        /// <param name="action">The action.</param>
        /// <param name="actionDescriptor">The action descriptor.</param>
        /// <param name="allDescriptors">All descriptors.</param>
        /// <param name="parameterDescriptions">The parameter descriptions.</param>
        public ConditionalActionViewModel([NotNull] ConditionalAction action, [NotNull] ActionDescription actionDescriptor, [NotNull] IEnumerable <ActionDescription> allDescriptors, [NotNull] IEnumerable <ParameterDescription> parameterDescriptions)
            : base(action, actionDescriptor, allDescriptors)
        {
            Assert.ArgumentNotNull(action, "action");
            Assert.ArgumentNotNull(actionDescriptor, "actionDescriptor");
            Assert.ArgumentNotNull(allDescriptors, "allDescriptors");
            Assert.ArgumentNotNull(parameterDescriptions, "parameterDescriptions");

            _action                 = action;
            _allDescriptors         = allDescriptors;
            ParameterDescriptions   = parameterDescriptions;
            _leftConditionParameter = ActionParametersViewModel.CreateParameterViewModel(_action.LeftConditionParameter, parameterDescriptions);
            _leftConditionParameter.PropertyChanged += HandleParameterOrActionDescriptionChange;
            _rightConditionParameter = ActionParametersViewModel.CreateParameterViewModel(_action.RightConditionParameter, parameterDescriptions);
            _rightConditionParameter.PropertyChanged += HandleParameterOrActionDescriptionChange;

            _actionsToExecute = new ActionsViewModel(action.ActionsToExecute, allDescriptors);
            _actionsToExecute.PropertyChanged += HandleParameterOrActionDescriptionChange;
        }
コード例 #18
0
        public async Task WorksCorrectly()
        {
            const string actionDisplayName = "Test action display name";

            var actionsVM = new ActionsViewModel();

            var actionMock = new Mock <IReversibleAction>();

            actionMock.Setup(a => a.Act()).Verifiable();
            actionMock.Setup(a => a.Revert()).Verifiable();
            actionMock.SetupGet(a => a.DisplayName).Returns(actionDisplayName);

            await actionsVM.Execute.Execute(actionMock.Object);

            Assert.Equal(actionDisplayName, actionsVM.LastDone);

            await actionsVM.Undo.Execute();

            await Task.Delay(1); // without this the variables do not get updated for some reason.

            Assert.Equal(actionDisplayName, actionsVM.LastUndone);
            Assert.NotEqual(actionDisplayName, actionsVM.LastDone);

            await actionsVM.Redo.Execute();

            await Task.Delay(1); // without this the variables do not get updated for some reason.

            Assert.Equal(actionDisplayName, actionsVM.LastDone);
            Assert.NotEqual(actionDisplayName, actionsVM.LastUndone);

            actionMock.Verify(a => a.Act(), Times.Exactly(2));
            actionMock.Verify(a => a.Revert(), Times.Once);

            // make sure clearing works
            await actionsVM.Clear.Execute();

            Assert.Null(actionsVM.LastDone);
            Assert.Null(actionsVM.LastUndone);
        }
コード例 #19
0
        /// <summary>
        /// Запустить функциональность проверки недавних действий
        /// </summary>
        public void StartActivity()
        {
            this.viewModel         = new ActionsViewModel();
            this.uiHelper          = new WindowOverTrayHelper(this, viewModel);
            this.DataContext       = viewModel;
            this.popupNotifyWindow = new PopupWindow(viewModel);
            SetupNotifyIcon();

            if (SettingsStore.Instance.IsCleanRun)
            {
                ShowNotifyBaloon();
            }

            // Таймер проверки новых действий
            checkTimer          = new DispatcherTimer(DispatcherPriority.ApplicationIdle);
            checkTimer.Interval = TimeSpan.FromSeconds(CheckIntervalSeconds);
            checkTimer.Tick    += checkTimer_Tick;
            checkTimer.Start();

            // Проверить сразу же
            checkTimer_Tick(this, EventArgs.Empty);
        }
コード例 #20
0
 public ActionsView(ActionsViewModel model)
 {
     InitializeComponent();
     DataContext = model;
 }
コード例 #21
0
 private void OnActionsCommandExecute()
 {
     CurrentManagerPage = new ActionsViewModel();
 }
コード例 #22
0
 public ActionsListBoxSample()
 {
     InitializeComponent();
     DataContext = new ActionsViewModel();
 }
コード例 #23
0
 public void Initialize()
 {
     _model = ContainerHelper.Container.Resolve <ActionsViewModel>();
 }
コード例 #24
0
 public ActionsView()
 {
     InitializeComponent();
     DataContext = new ActionsViewModel();
 }