protected LotFormViewModel() { LotService = new LotService(); CategoryService = new CategoryService(); Session = Session.CurrentSession; Categories = CategoryService.GetCategories(); ConfirmCommand = new FormCommand(Confirm, ConfirmCanExecute); AddPhotoCommand = new FormCommand(AddPhoto, AddPhotoCanExecute); DeletePhotoCommand = new FormCommand(DeletePhoto); CancelCommand = new FormCommand(ClearForm); Photos = new ObservableCollection <LotContent>(); DaysCount = new List <LotDaysToExpire> { new LotDaysToExpire(3, "3 дня"), new LotDaysToExpire(5, "5 дней"), new LotDaysToExpire(7, "7 дней"), new LotDaysToExpire(10, "10 дней"), new LotDaysToExpire(14, "14 дней"), new LotDaysToExpire(21, "21 день"), new LotDaysToExpire(30, "30 дней") }; ValidatableFieldsNames = new List <string> { nameof(Title), nameof(SelectedCategory), nameof(Description), nameof(StartBid), nameof(SelectedDaysCount) }; }
public CategoryListViewModel() { _categoryService = new CategoryService(); CategoryItems = _categoryService.GetCategories(); LinkCommand = new FormCommand(OpenLink); }
public override void ExecuteCommand(FormCommand operation) { if (_detailEditor.IsCurrentRowDirty && !_detailEditor.EndEdit()) { return; } base.ExecuteCommand(operation); }
public MainWindow() { InitializeComponent(); _session = Session.CurrentSession; _userService = new UserService(); _notificationService = new NotificationService(); DataContext = this; OpenCategoriesCommand = new FormCommand(GetCategories); _session.CurrentUserUpdated += _session_CurrentUserUpdated; _session.CurrentUserUpdated += SubscribeOnLoginLogout; this.Closing += OnClosing; }
public IActionResult Form(FormCommand command) { // ModelStateEntry.RawValueはstringかstring[]っぽい // checkboxにチェックを入れるとstring[] foreach (var entry in ModelState) { var builder = new StringBuilder(); builder.Append("ModelState:") .Append($" {nameof(entry.Key)}={entry.Key}") .Append($", {nameof(entry.Value.RawValue)}.Type={entry.Value.RawValue.GetType()}") .Append($", {nameof(entry.Value.RawValue)}={entry.Value.GetRawValueAsString()}"); _logger.LogInformation(builder.ToString()); } return(RedirectToAction(nameof(Form))); }
public UserProfileViewModel(IPasswordView passwordView = null) { _passwordView = passwordView; _session = Session.CurrentSession; _userService = new UserService(); _defaultPhotoVisibility = Visibility.Visible; _userPhotoVisibility = Visibility.Collapsed; MessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(1)); ConfirmCommand = new FormCommand(Confirm); CancelCommand = new FormCommand(Cancel); EditPhotoCommand = new FormCommand(EditPhoto); Initialize(); }
public DisplayLotViewModel() { _session = Session.CurrentSession; _session.CurrentUserUpdated += SessionOnCurrentUserUpdated; MakeBidCommand = new FormCommand(MakeBid, CanExecuteMakeBid); CloseLotCommand = new FormCommand(CloseLot); EditLotCommand = new FormCommand(EditLot); OpenBidHistoryCommand = new FormCommand(OpenBidHistory, OpenBidHistoryCanExecute); ShowSellerLotsCommand = new FormCommand(ShowSellerLots); _lotService = new LotService(); if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) { IsLotLoaded = true; } }
public virtual void ExecuteCommand(FormCommand operation) { GetType().GetMethod(operation.ToString(), BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(this, null); }