public EventCommandTestViewModel() { TestCommand = new ViewAction("Test", execute: (a, o) => MessageBox.Show("Now!")); TestCaption = "Hello"; }
private void LoadActions() { SearchAction = new ViewAction(caption: "Filter", execute: (action, o) => Controller.Notification("Filter happens here")); ClearFilterAction = new ViewAction(caption: "Clear Filter", execute: (action, o) => Controller.Notification("Clear Filter")); AddSideToCartAction = new ViewAction(caption: "Add Side to Cart", execute: (action, o) => Controller.Notification("Side added to cart.")); SetParentActions(); }
public NotificationSettingsViewModel( INavigationService navigationService, IBackgroundService backgroundService, IPermissionsChecker permissionsChecker, IUserPreferences userPreferences, ISchedulerProvider schedulerProvider, IRxActionFactory rxActionFactory) : base(navigationService) { Ensure.Argument.IsNotNull(backgroundService, nameof(backgroundService)); Ensure.Argument.IsNotNull(permissionsChecker, nameof(permissionsChecker)); Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences)); Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider)); Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory)); PermissionGranted = backgroundService.AppResumedFromBackground .SelectUnit() .StartWith(Unit.Default) .SelectMany(_ => permissionsChecker.NotificationPermissionGranted) .DistinctUntilChanged() .AsDriver(schedulerProvider); UpcomingEvents = userPreferences.CalendarNotificationsSettings() .Select(s => s.Title()) .DistinctUntilChanged() .AsDriver(schedulerProvider); RequestAccess = rxActionFactory.FromAction(requestAccess); OpenUpcomingEvents = rxActionFactory.FromAsync(openUpcomingEvents); }
public RatingViewModel( ITimeService timeService, IRatingService ratingService, IAnalyticsService analyticsService, IOnboardingStorage onboardingStorage, INavigationService navigationService, ISchedulerProvider schedulerProvider, IRxActionFactory rxActionFactory) : base(navigationService) { Ensure.Argument.IsNotNull(timeService, nameof(timeService)); Ensure.Argument.IsNotNull(ratingService, nameof(ratingService)); Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService)); Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage)); Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider)); Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory)); this.timeService = timeService; this.ratingService = ratingService; this.analyticsService = analyticsService; this.onboardingStorage = onboardingStorage; this.schedulerProvider = schedulerProvider; Impression = impressionSubject.AsDriver(this.schedulerProvider); IsFeedbackSuccessViewShowing = isFeedbackSuccessViewShowing.AsDriver(this.schedulerProvider); HideRatingView = hideRatingView.AsDriver(this.schedulerProvider); PerformMainAction = rxActionFactory.FromAsync(performMainAction); }
public MyModel() { HeaderClick = new ViewAction("Test", execute: (a, o) => { var paras = o as HeaderClickCommandParameters; if (paras == null) { return; } MessageBox.Show(paras.Column.Header.ToString()); }); OtherModels = new ObservableCollection <StandardViewModel>(); for (var x = 0; x < 5; x++) { OtherModels.Add(new StandardViewModel { Text1 = "Item #" + x + " a", Text2 = "Item #" + x + " b", Text3 = "Item #" + x + " c", Text4 = "Item #" + x + " d", Text5 = "Item #" + x + " e" }); } }
private void itemBorder_PreviewMouseDown(object sender, MouseButtonEventArgs e) { var btn = (Border)sender; var data = (PersonEvents)btn.Tag; ViewAction?.Invoke(data); }
public ForgotPasswordViewModel( ITimeService timeService, IUserAccessManager userAccessManager, IAnalyticsService analyticsService, INavigationService navigationService, IRxActionFactory rxActionFactory) : base(navigationService) { Ensure.Argument.IsNotNull(timeService, nameof(timeService)); Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager)); Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService)); Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory)); this.timeService = timeService; this.userAccessManager = userAccessManager; this.analyticsService = analyticsService; this.rxActionFactory = rxActionFactory; Reset = rxActionFactory.FromObservable(reset, Email.Select(email => email.IsValid)); var resetActionStartedObservable = Reset .Executing .Where(executing => executing) .Select(_ => (Exception)null); ErrorMessage = Reset.Errors .Merge(resetActionStartedObservable) .Select(toErrorString) .StartWith("") .DistinctUntilChanged(); PasswordResetSuccessful = Reset.Elements .Select(_ => true) .StartWith(false); }
public void MoveUp(Guid moverActionId, Guid staticActionId, out ViewAction moverAction, out ViewAction staticAction) { moverAction = ViewActionDao.FindById(moverActionId); staticAction = ViewActionDao.FindById(staticActionId); int seq1 = moverAction.Sequence; int seq2 = staticAction.Sequence; if (seq1 != seq2) { int temp = seq2; seq2 = seq1; seq1 = temp; } else { seq2++; } moverAction.Sequence = seq1; staticAction.Sequence = seq2; ViewActionDao.SaveOrUpdate(moverAction); ViewActionDao.SaveOrUpdate(staticAction); }
public SelectDateTimeViewModel(IRxActionFactory rxActionFactory, INavigationService navigationService) : base(navigationService) { Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory)); Save = rxActionFactory.FromAction(save); }
public NoWorkspaceViewModel( ISyncManager syncManager, IInteractorFactory interactorFactory, INavigationService navigationService, IAccessRestrictionStorage accessRestrictionStorage, ISchedulerProvider schedulerProvider, IRxActionFactory rxActionFactory) : base(navigationService) { Ensure.Argument.IsNotNull(syncManager, nameof(syncManager)); Ensure.Argument.IsNotNull(accessRestrictionStorage, nameof(accessRestrictionStorage)); Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory)); Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider)); Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory)); this.syncManager = syncManager; this.accessRestrictionStorage = accessRestrictionStorage; this.interactorFactory = interactorFactory; this.rxActionFactory = rxActionFactory; CreateWorkspaceWithDefaultName = rxActionFactory.FromObservable(createWorkspaceWithDefaultName); TryAgain = rxActionFactory.FromAsync(tryAgain); IsLoading = Observable.CombineLatest( CreateWorkspaceWithDefaultName.Executing, TryAgain.Executing, CommonFunctions.Or); }
public bool Play() { DisplayWelcomeMessageAndHands(); if (m_game.IsGameOver()) { m_view.DisplayGameOver(m_game.IsDealerWinner()); } ViewAction action = m_view.GetAction(); if (action == ViewAction.Newgame) { m_game.NewGame(); } else if (action == ViewAction.Hit) { m_game.Hit(); } else if (action == ViewAction.Stand) { m_game.Stand(); } return(action != ViewAction.Quit); }
public ListViewModel() { Actions.Add(new ViewAction("Print", brushResourceKey: "CODE.Framework-Icon-Print", execute: (a, o) => Controller.Message("The print example has not been implemented.", "Example", MessageBoxButtons.OKCancel), significance: ViewActionSignificance.Highest, accessKey: 'P', shortcutKeyModifiers: ModifierKeys.Alt)); Actions.Add(new CloseCurrentViewAction(this, beginGroup: true) { Significance = ViewActionSignificance.Highest }); Actions.Add(new ViewAction("Another Test Message", execute: (a, o) => Controller.Message("Another Test", "Test Header", MessageBoxButtons.OKCancel)) { GroupTitle = "Status" }); Search = new ViewAction("Search", execute: (o, a) => LoadData()); EditCustomer = new ViewAction("Edit", execute: (o, a) => Controller.Action("Subscriber", "Edit")); ChangeSortOrder = new ViewAction("Change Sort", execute: (o, a) => { if (SortOrder == SortOrder.Ascending) { SortOrder = SortOrder.Descending; } else if (SortOrder == SortOrder.Descending) { SortOrder = SortOrder.Unsorted; } else { SortOrder = SortOrder.Ascending; } }); }
public ViewAction SaveOrUpdateMerge(ViewAction viewAction) { object mergedObj = Session.Merge(viewAction); HibernateTemplate.SaveOrUpdate(mergedObj); return((ViewAction)mergedObj); }
public MyModel(int count = 5) { HeaderClick = new ViewAction("Test", execute: (a, o) => { var paras = o as HeaderClickCommandParameters; if (paras == null) { return; } MessageBox.Show(paras.Column.Header.ToString()); }); OtherModels = new ObservableCollection <ExtendedStandardViewModel>(); for (var x = 0; x < count; x++) { OtherModels.Add(new ExtendedStandardViewModel { Text1 = "Item #" + (x + 1) + " a - wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww", Text2 = "Item #" + (x + 1) + " b", Text3 = "Item #" + (x + 1) + " c", Text4 = "Item #" + (x + 1) + " d", Text5 = "Item #" + (x + 1) + " e", Text6 = "List Item #" + (x + 1), IsChecked = x % 2 == 0, IsExpanded = x % 2 == 1 }); } }
private void LoadActions() { SearchAction = new ViewAction(caption: "Filter", execute: (action, o) => Controller.Notification("Filter happens here")); ClearFilterAction = new ViewAction(caption: "Clear Filter", execute: (action, o) => Controller.Notification("Clear Filter")); CustomizePizzaAction = new ViewAction(caption: "Customize This Pizza", execute: (action, o) => Controller.Message("Coming Soon!")); AddPizzaToCartAction = new ViewAction(caption: "AddPizzaToCart", execute: (action, o) => Controller.Notification("Pizza Added to Cart!")); SetParentActions(); }
public TermsOfServiceViewModel(IRxActionFactory rxActionFactory, INavigationService navigationService) : base(navigationService) { Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory)); ViewPrivacyPolicy = rxActionFactory.FromAsync(openPrivacyPolicy); ViewTermsOfService = rxActionFactory.FromAsync(openTermsOfService); }
public static IDisposable BindAction(this IReactive <UIView> reactive, ViewAction action) { return(Observable.Using( () => action.Enabled.Subscribe(e => { reactive.Base.UserInteractionEnabled = e; }), _ => reactive.Base.Rx().Tap() ) .Subscribe(action.Inputs)); }
/// <summary> /// Refreshes the message. /// </summary> private void RefreshMessageView(ViewAction action) { Type type = this.ParentForm.GetType(); MethodInfo method = type.GetMethod(SupportedMethodName); if (method != null) { method.Invoke(this.ParentForm, new object[] { action }); } }
public ViewAction Save(ViewAction viewAction) { if (viewAction.Id == Guid.Empty) { viewAction.Id = Guid.NewGuid(); } HibernateTemplate.Save(viewAction); return(viewAction); }
public CalendarPermissionDeniedViewModel(INavigationService navigationService, IPermissionsChecker permissionsChecker, IRxActionFactory rxActionFactory) : base(navigationService) { Ensure.Argument.IsNotNull(permissionsChecker, nameof(permissionsChecker)); Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory)); this.permissionsChecker = permissionsChecker; EnableAccess = rxActionFactory.FromAction(enableAccess); }
public AboutViewModel( IRxActionFactory rxActionFactory, INavigationService navigationService) : base(navigationService) { Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory)); OpenLicensesView = rxActionFactory.FromAsync(openLicensesView); OpenPrivacyPolicyView = rxActionFactory.FromAsync(openPrivacyPolicyView); OpenTermsOfServiceView = rxActionFactory.FromAsync(openTermsOfServiceView); }
public OutdatedAppViewModel(IPlatformInfo platformInfo, IRxActionFactory rxActionFactory, INavigationService navigationService) : base(navigationService) { Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo)); Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory)); storeUrl = platformInfo.StoreUrl; UpdateApp = rxActionFactory.FromAsync(updateApp); OpenWebsite = rxActionFactory.FromAsync(openWebsite); }
public PasswordGeneratorViewModel() { HashCommand = new ViewAction("Encrypt", execute: (a, o) => { ComputeHash(); }, canExecute: (a, o) => { return(!string.IsNullOrWhiteSpace(this.Password)); }, brushResourceKey: "CODE.Framework-Icon-Collapsed"); ClearCommand = new ViewAction("Clear", execute: (a, o) => { Clear(); }, brushResourceKey: "CODE.Framework-Icon-No"); Actions.Add(HashCommand); Actions.Add(ClearCommand); Actions.Add(new CloseCurrentViewAction(this, beginGroup: true)); this.EncryptedPassword = string.Empty; this.Password = string.Empty; }
public PasteFromClipboardViewModel( IRxActionFactory rxActionFactory, IOnboardingStorage onboardingStorage, INavigationService navigationService) : base(navigationService) { Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage)); Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory)); this.onboardingStorage = onboardingStorage; DoNotShowAgain = rxActionFactory.FromAction(doNotShowAgain); }
public void SetAction(ViewAction action) { Init(); Debug.LogFormat("WrapItem: SetAction index:{0} act:{1}", index, action); switch (action) { case ViewAction.after_add_view: add_cor = StartCoroutine(AddCor()); break; } last_action = action; }
public ListDependencyProperties() { InitializeComponent(); DataContext = this; CopyProps = new ViewAction(execute: (a, o) => Clipboard.SetText(DependencyPropList)); var layout = new MetroTiles(); Title = layout.ToString(); DependencyProps = GetDependencyProperties(layout); }
public ShaGeneratorViewModel() { HashCommand = new ViewAction("Hash", execute: (a, o) => { ComputeHash(); }, canExecute: (a, o) => { return(!string.IsNullOrWhiteSpace(this.Input)); }, brushResourceKey: "CODE.Framework-Icon-Collapsed"); Actions.Add(HashCommand); Actions.Add(new CloseCurrentViewAction(this, beginGroup: true)); this.Input = string.Empty; this.Output = string.Empty; this.Messages = new ObservableCollection <StandardDataList>(); LoadMessages(); }
public TimeEntriesViewModel( ITogglDataSource dataSource, IInteractorFactory interactorFactory, IAnalyticsService analyticsService, ISchedulerProvider schedulerProvider, IRxActionFactory rxActionFactory, ITimeService timeService) { Ensure.Argument.IsNotNull(dataSource, nameof(dataSource)); Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory)); Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService)); Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider)); Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory)); Ensure.Argument.IsNotNull(timeService, nameof(timeService)); this.interactorFactory = interactorFactory; this.analyticsService = analyticsService; this.schedulerProvider = schedulerProvider; DelayDeleteTimeEntries = rxActionFactory.FromAction <long[]>(delayDeleteTimeEntries); ToggleGroupExpansion = rxActionFactory.FromAction <GroupId>(toggleGroupExpansion); CancelDeleteTimeEntry = rxActionFactory.FromAction(cancelDeleteTimeEntry); groupsFlatteningStrategy = new TimeEntriesGroupsFlattening(timeService); var deletingOrPressingUndo = timeEntriesPendingDeletionSubject.SelectUnit(); var collapsingOrExpanding = ToggleGroupExpansion.Elements; var visibleTimeEntries = interactorFactory.ObserveAllTimeEntriesVisibleToTheUser().Execute() .Select(timeEntries => timeEntries.Where(isNotRunning)) .ReemitWhen(deletingOrPressingUndo) .Select(timeEntries => timeEntries.Where(isNotDeleted)) .Select(group) .ReemitWhen(collapsingOrExpanding); TimeEntries = Observable.CombineLatest( visibleTimeEntries, dataSource.Preferences.Current, groupsFlatteningStrategy.Flatten) .AsDriver(schedulerProvider); Empty = TimeEntries .Select(groups => groups.None()) .AsDriver(schedulerProvider); Count = TimeEntries .Select(log => log.Sum(day => day.Items.Count)) .AsDriver(schedulerProvider); TimeEntriesPendingDeletion = timeEntriesPendingDeletionSubject.AsObservable().AsDriver(schedulerProvider); }
public SiriShortcutsViewModel( IInteractorFactory interactorFactory, IRxActionFactory rxActionFactory, ISchedulerProvider schedulerProvider, INavigationService navigationService) : base(navigationService) { Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory)); Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory)); Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider)); this.interactorFactory = interactorFactory; this.schedulerProvider = schedulerProvider; NavigateToCustomReportShortcut = rxActionFactory.FromAsync(navigateToCustomReportShortcut); NavigateToCustomTimeEntryShortcut = rxActionFactory.FromAsync(navigateToCustomTimeEntryShortcut); }
public void SetAction(float tm_act, float tm_cur, ViewAction action) { Init(); //Debug.LogFormat("WrapItem SetAction action={0}, tm_act={1}, tm_cur={2}", action, tm_act, tm_cur); if (Mathf.Approximately(tm_cur, 0)) { return; } switch (action) { case ViewAction.before_delete_view: Vector2 scale = Vector2.Lerp(Vector2.one, new Vector3(0, 0, 1), tm_cur / tm_act); transform.localScale = scale; break; } last_action = action; }
public CalendarSettingsViewModel( IUserPreferences userPreferences, IInteractorFactory interactorFactory, IOnboardingStorage onboardingStorage, IAnalyticsService analyticsService, INavigationService navigationService, IRxActionFactory rxActionFactory, IPermissionsChecker permissionsChecker) : base(userPreferences, interactorFactory, onboardingStorage, analyticsService, navigationService, rxActionFactory) { Ensure.Argument.IsNotNull(permissionsChecker, nameof(permissionsChecker)); this.permissionsChecker = permissionsChecker; RequestAccess = rxActionFactory.FromAction(requestAccess); TogglCalendarIntegration = rxActionFactory.FromAsync(togglCalendarIntegration); CalendarListVisible = calendarListVisibleSubject.AsObservable().DistinctUntilChanged(); }
public MyModel() { HeaderClick = new ViewAction("Test", execute: (a, o) => { var paras = o as HeaderClickCommandParameters; if (paras == null) return; MessageBox.Show(paras.Column.Header.ToString()); }); OtherModels = new ObservableCollection<StandardViewModel>(); for (var x = 0; x < 5; x++) OtherModels.Add(new StandardViewModel { Text1 = "Item #" + x + " a", Text2 = "Item #" + x + " b", Text3 = "Item #" + x + " c", Text4 = "Item #" + x + " d", Text5 = "Item #" + x + " e" }); }
private void LoadActions() { SearchAction = new ViewAction(caption: "Filter", execute: (action, o) => Controller.Notification("Filter happens here")); ClearFilterAction = new ViewAction(caption: "Clear Filter", execute: (action, o) => Controller.Notification("Clear Filter")); AddSideToCartAction = new ViewAction(caption:"Add Side to Cart", execute:(action, o) => Controller.Notification("Side added to cart.")); SetParentActions(); }
public MultiPanelTestViewModel() { CloseAction = new ViewAction(execute: (a, o) => Panel1Visible = Visibility.Collapsed); }
private void LoadActions() { ReviewPizzasAction = new ViewAction("Pizza Selection", execute: (a, o) => ReviewPizzas()); ReviewSidesAction = new ViewAction("Side Orders", execute: (a, o) => ReviewSides()); Actions.Add(new CloseCurrentViewAction(this, beginGroup: true)); }
public FlowDocReaderModel() { TestAction = new ViewAction(execute: (a, o) => MessageBox.Show("Now!")); }
/// <summary> /// Refreshes the message view. /// </summary> /// <param name="action">The action.</param> public void RefreshMessageView(ViewAction action) { if (action == ViewAction.RefreshOutbox) { ctlOutbox.RefreshView(); } else if (action == ViewAction.RefreshInbox) { ctlInbox.RefreshView(); } else if (action == ViewAction.RefreshArchivedInbox) { ctlArchivedInbox.RefreshView(); } else if (action == ViewAction.RefreshArchivedOutbox) { ctlArchivedOutbox.RefreshView(); } else if (action == ViewAction.RefreshFailedOutbox) { ctlOutboxFailed.RefreshView(); } }