public SyncManager( ISyncStateQueue queue, IStateMachineOrchestrator orchestrator, IAnalyticsService analyticsService, ILastTimeUsageStorage lastTimeUsageStorage, ITimeService timeService, IAutomaticSyncingService automaticSyncingService) { Ensure.Argument.IsNotNull(queue, nameof(queue)); Ensure.Argument.IsNotNull(orchestrator, nameof(orchestrator)); Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService)); Ensure.Argument.IsNotNull(lastTimeUsageStorage, nameof(lastTimeUsageStorage)); Ensure.Argument.IsNotNull(timeService, nameof(timeService)); Ensure.Argument.IsNotNull(automaticSyncingService, nameof(automaticSyncingService)); this.queue = queue; this.timeService = timeService; this.orchestrator = orchestrator; this.analyticsService = analyticsService; this.lastTimeUsageStorage = lastTimeUsageStorage; this.automaticSyncingService = automaticSyncingService; progress = new BehaviorSubject <SyncProgress>(SyncProgress.Unknown); ProgressObservable = progress.AsObservable(); errors = new Subject <Exception>(); Errors = errors.AsObservable(); orchestrator.SyncCompleteObservable.Subscribe(syncOperationCompleted); isFrozen = false; automaticSyncingService.Start(this); }
public ReportsCalendarQuickSelectCollectionViewSource(UICollectionView collectionView) { Ensure.Argument.IsNotNull(collectionView, nameof(collectionView)); collectionView.RegisterNibForCell(ReportsCalendarQuickSelectViewCell.Nib, cellIdentifier); ShortcutTaps = shortcutTaps.AsObservable(); this.collectionView = collectionView; }
public UpcomingEventsNotificationSettingsSource(UITableView tableView, IList <CalendarNotificationsOption> options) { selectedOptionSubject = new Subject <CalendarNotificationsOption>(); SelectedOptionChanged = selectedOptionSubject.AsObservable().DistinctUntilChanged(); AvailableOptions = options; tableView.RegisterNibForCellReuse(UpcomingEventsOptionCell.Nib, cellIdentifier); }
public ProcessManager() { var launched = new Subject<Tuple<ProcessStartInfo, int>>(); _launched = Subject.Synchronize(launched); Launched = _launched.AsObservable(); _subjects.Add(launched); var killed = new Subject<Tuple<ProcessStartInfo, int, TimeSpan, string>>(); _monitorKilled = Subject.Synchronize(killed); MonitorKilled = _monitorKilled.AsObservable(); _subjects.Add(killed); var started = new Subject<Tuple<ProcessStartInfo, int, string>>(); _monitorStarted = Subject.Synchronize(started); MonitorStarted = _monitorStarted.AsObservable(); _subjects.Add(started); var stopped = new Subject<Tuple<ProcessStartInfo, int, string>>(); _monitorStopped = Subject.Synchronize(stopped); MonitorStopped = _monitorStopped.AsObservable(); _subjects.Add(stopped); var terminated = new Subject<Tuple<ProcessStartInfo, int, int>>(); _terminated = Subject.Synchronize(terminated); Terminated = _terminated.AsObservable(); _subjects.Add(terminated); }
public PricingEverydayPriceListGroup() { PriceLists = new ReactiveList <PricingEverydayPriceList>(); _priceListChangeSubject = new Subject <PricingEverydayPriceList>(); PriceListSelectedChanges = _priceListChangeSubject.AsObservable(); }
HystrixRequestEventsStream() { this.writeOnlyRequestEventsSubject = Subject.Synchronize <HystrixRequestEvents, HystrixRequestEvents>(new Subject <HystrixRequestEvents>()); this.readOnlyRequestEvents = writeOnlyRequestEventsSubject.AsObservable(); //writeOnlyRequestEventsSubject = PublishSubject.create(); // TODO: readOnlyRequestEvents = writeOnlyRequestEventsSubject.onBackpressureBuffer(1024); }
protected override void AdditionalSetup() { ProgressSubject = new Subject <SyncProgress>(); var syncManager = Substitute.For <ISyncManager>(); syncManager.ProgressObservable.Returns(ProgressSubject.AsObservable()); DataSource.SyncManager.Returns(syncManager); }
public TogglDataSourceTest() { SyncManager.ProgressObservable.Returns(ProgressSubject.AsObservable()); DataSource = new TogglDataSource( Database, TimeService, AnalyticsService); }
public AutocompleteEditText(Context context, IAttributeSet attrs) : base(context, attrs) { AddTextChangedListener(this); TextObservable = this.Text().CombineLatest(positionChanged.AsObservable(), (text, _) => text); }
public ReportsCalendarCollectionViewSource(UICollectionView collectionView) : base(collectionView) { collectionView.RegisterNibForCell(ReportsCalendarViewCell.Nib, cellIdentifier); DayTaps = dayTaps.AsObservable(); CurrentPageWhileScrollingObservable = currentPageWhileScrollingSubject.AsObservable().DistinctUntilChanged(); CurrentPageNotScrollingObservable = currentPageNotScrollingSubject.AsObservable().DistinctUntilChanged(); }
public IObservable <GuestModel> Guest() { return(_guestStream //.Select(guest => guest) .AsObservable()); // return Observable.Interval(TimeSpan.FromSeconds(1)).Select(s => new GuestModel { Name = s.ToString() }); }
private void prepareSwipeGesturesOnboarding(IOnboardingStorage storage, IObservable <bool> tapToEditStepIsVisible) { timeEntriesCountSubject.OnNext(ViewModel.TimeEntriesCount); timeEntriesCountDisposable = ViewModel.WeakSubscribe(() => ViewModel.TimeEntriesCount, onTimeEntriesCountChanged); var swipeRightCanBeShown = tapToEditStepIsVisible.Select(isVisible => !isVisible); swipeRightStep = new SwipeRightOnboardingStep(swipeRightCanBeShown, timeEntriesCountSubject.AsObservable()) .ToDismissable(nameof(SwipeRightOnboardingStep), storage); var swipeLeftCanBeShown = Observable.CombineLatest( tapToEditStepIsVisible, swipeRightStep.ShouldBeVisible, (tapToEditIsVisible, swipeRightIsVisble) => !tapToEditIsVisible && !swipeRightIsVisble); swipeLeftStep = new SwipeLeftOnboardingStep(swipeLeftCanBeShown, timeEntriesCountSubject.AsObservable()) .ToDismissable(nameof(SwipeLeftOnboardingStep), storage); swipeLeftStep.DismissByTapping(SwipeLeftBubbleView); swipeLeftOnboardingDisposable = swipeLeftStep.ManageVisibilityOf(SwipeLeftBubbleView); swipeLeftAnimationDisposable = swipeLeftStep.ManageSwipeActionAnimationOf(firstTimeEntry, Direction.Left); swipeRightStep.DismissByTapping(SwipeRightBubbleView); swipeRightOnboardingDisposable = swipeRightStep.ManageVisibilityOf(SwipeRightBubbleView); swipeRightAnimationDisposable = swipeRightStep.ManageSwipeActionAnimationOf(firstTimeEntry, Direction.Right); swipeToContinueWasUsedDisposable = Observable.FromEventPattern(source, nameof(MainTableViewSource.SwipeToContinueWasUsed)) .Subscribe(_ => { swipeRightStep.Dismiss(); swipeToContinueWasUsedDisposable?.Dispose(); swipeToContinueWasUsedDisposable = null; }); swipeToDeleteWasUsedDisposable = Observable.FromEventPattern(source, nameof(MainTableViewSource.SwipeToDeleteWasUsed)) .Subscribe(_ => { swipeLeftStep.Dismiss(); swipeToDeleteWasUsedDisposable?.Dispose(); swipeToDeleteWasUsedDisposable = null; }); updateSwipeDismissGestures(firstTimeEntry); }
protected override void AdditionalSetup() { StateObservableSubject = new Subject <SyncState>(); var syncManager = Substitute.For <ISyncManager>(); var observable = StateObservableSubject.AsObservable(); syncManager.StateObservable.Returns(observable); DataSource.SyncManager.Returns(syncManager); }
public MutableSectionedListTableViewSource(IReadOnlyList <IReadOnlyList <TModel> > items, string cellIdentifier) { this.items = items; this.cellIdentifier = cellIdentifier; ItemSelected = itemSelectedSubject.AsObservable(); reloadDisplayedData(); }
public iOSEventSource(OmniGuiView view) { this.view = view; this.view.AddGestureRecognizer(new UITapGestureRecognizer(Action)); Pointer = pointSubject.AsObservable(); TextInput = view.TextInput; KeyInput = view.KeyInput; }
public Timer() { _subject = new Subject<ITick>(); Delta = TimeSpan.FromSeconds(0.25); _timer = Observable.Interval(Delta); Ticks = _subject.AsObservable(); LastTickTime = new Tick(); }
public MonitoringGroup(string name, IObservableCache <IMonitoredCall, int> monitoredCalls) { mNameSubject = new BehaviorSubject <string>(name ?? throw new ArgumentNullException(nameof(name))); mCallIds = new SourceCache <int, int>(id => id); WhenNameChanges = mNameSubject.AsObservable(); Calls = monitoredCalls.Connect() .InnerJoin(mCallIds.Connect(), id => id, (call, _) => call) .RemoveKey(); }
public SubjectMessageBus(IScheduler scheduler) { _subject = Subject.Synchronize(new Subject <TMessage>()); Messages = scheduler == null? _subject.AsObservable() : _subject.ObserveOn(scheduler) .PublishRefCountRetriable() .AsObservable(); }
public PreferencesDataSource(ISingleObjectStorage <IDatabasePreferences> storage) { Ensure.Argument.IsNotNull(storage, nameof(storage)); this.storage = storage; currentPreferencesSubject = new ReplaySubject <IDatabasePreferences>(1); Current = currentPreferencesSubject.AsObservable(); Get().Do(currentPreferencesSubject.OnNext); }
public TheStopTimeEntryCommand() { var timeEntry = Substitute.For <IDatabaseTimeEntry>(); subject = new BehaviorSubject <IDatabaseTimeEntry>(timeEntry); var observable = subject.AsObservable(); DataSource.TimeEntries.CurrentlyRunningTimeEntry.Returns(observable); ViewModel.Initialize().Wait(); Scheduler.AdvanceBy(TimeSpan.FromMilliseconds(50).Ticks); }
private void InitializeInternal() { _activitySubject = new Subject <bool>(); _onError = () => SetServiceActivity(false); _onSuccess = () => SetServiceActivity(true); IsActive = _activitySubject.AsObservable(); Initialize(); }
public TogglDataSourceTest() { SyncManager.ProgressObservable.Returns(ProgressSubject.AsObservable()); DataSource = new TogglDataSource( Api, Database, TimeService, _ => SyncManager, NotificationService, ApplicationShortcutCreator, AnalyticsService); }
protected override void AdditionalSetup() { var preferencesObservable = durationFormatSubject.Select(format => new MockPreferences { DurationFormat = format } as IThreadSafePreferences); DataSource.Preferences.Current .Returns(preferencesObservable); InteractorFactory.ObserveTimeTrackedToday().Execute() .Returns(trackedTimeSubject.AsObservable()); }
protected override void AdditionalSetup() { var preferencesObservable = dateFormatSubject.Select(format => new MockPreferences { DateFormat = format } as IThreadSafePreferences); DataSource.Preferences.Current .Returns(preferencesObservable); TimeService.CurrentDateTimeObservable .Returns(dateSubject.AsObservable()); }
public override async Task Initialize() { await base.Initialize(); var now = timeService.CurrentDateTime; initialMonth = new CalendarMonth(now.Year, now.Month).AddMonths(-(MonthsToShow - 1)); beginningOfWeekObservable = dataSource.User.Current .Select(user => user.BeginningOfWeek) .DistinctUntilChanged(); DayHeadersObservable = beginningOfWeekObservable.Select(mapDayHeaders); ReloadObservable = reloadSubject.AsObservable(); MonthsObservable = beginningOfWeekObservable.CombineLatest( timeService.MidnightObservable.StartWith(timeService.CurrentDateTime), (beginningOfWeek, today) => { var monthIterator = new CalendarMonth(today.Year, today.Month).AddMonths(-(MonthsToShow - 1)); var months = new List <ReportsCalendarPageViewModel>(); for (int i = 0; i < MonthsToShow; i++, monthIterator = monthIterator.Next()) { months.Add(new ReportsCalendarPageViewModel(monthIterator, beginningOfWeek, today)); } return(months); }); RowsInCurrentMonthObservable = MonthsObservable.CombineLatest( CurrentPageObservable.DistinctUntilChanged(), (months, page) => months[page].RowCount) .Select(CommonFunctions.Identity); CurrentMonthObservable = monthSubject .AsObservable() .StartWith(MonthsToShow - 1) .Select(convertPageIndexToCalendarMonth) .Share(); QuickSelectShortcutsObservable = beginningOfWeekObservable.Select(createQuickSelectShortcuts); beginningOfWeek = (await dataSource.User.Current.FirstAsync()).BeginningOfWeek; QuickSelectShortcuts = createQuickSelectShortcuts(beginningOfWeek); SelectPeriod(reportPeriod); isInitialized = true; viewAppearedOnce = false; }
public IObservable <TDto> Connect(IScheduler scheduler, long connectionTimeoutDelay) { if (!_isServiceActive) { _resilientStream = new Subject <TDto>(); _doCancel = new CancellationTokenSource(); _cancel = _doCancel.Token; _resilientStreamProcess = scheduler.Schedule(async() => await StartResilientStream(TimeSpan.FromMilliseconds(connectionTimeoutDelay))); } SetServiceActivity(true); return(_resilientStream.AsObservable()); }
public CommandAPI(CancellationToken token, string uniquePipeId = null) { _token = token; if (uniquePipeId == null) { uniquePipeId = DefaultUniquePipeId; } _messageReceived = Subject.Synchronize(new Subject <IReceiveOnlyMessage>()); MessageReceived = _messageReceived.AsObservable(); PipeTag = defaultPipeGuid + uniquePipeId; _pipeClient = new NamedPipeClientStream(".", PipeTag, PipeDirection.InOut, PipeOptions.Asynchronous); }
public TogglDataSourceTest() { SyncManager.ProgressObservable.Returns(ProgressSubject.AsObservable()); DataSource = new TogglDataSource( Api, Database, TimeService, ErrorHandlingService, BackgroundService, _ => SyncManager, MinimumTimeInBackgroundForFullSync, ApplicationShortcutCreator, AnalyticsService); }
public SyncManager(ISyncStateQueue queue, IStateMachineOrchestrator orchestrator) { Ensure.Argument.IsNotNull(queue, nameof(queue)); Ensure.Argument.IsNotNull(orchestrator, nameof(orchestrator)); this.queue = queue; this.orchestrator = orchestrator; progress = new BehaviorSubject <SyncProgress>(SyncProgress.Unknown); ProgressObservable = progress.AsObservable(); orchestrator.SyncCompleteObservable.Subscribe(syncOperationCompleted); isFrozen = false; }
public PreferencesDataSource(ISingleObjectStorage <IDatabasePreferences> storage) { Ensure.Argument.IsNotNull(storage, nameof(storage)); this.storage = storage; currentPreferencesSubject = new BehaviorSubject <IDatabasePreferences>(Preferences.DefaultPreferences); Current = currentPreferencesSubject.AsObservable(); // right after login/signup the database does not contain the preferences and retreiving // it will fail we can ignore this error because it will be immediately fetched and until // then the default preferences will be used initializationDisposable = Get().Subscribe(currentPreferencesSubject.OnNext, (Exception _) => { }); }
public NotificationCenterMessageHandler(UserSettings settings) { _settings = settings; var subject1 = new Subject <ITrayNotification>(); _subjects.Add(subject1); _trayNotificationObservable = Subject.Synchronize(subject1); TrayNotification = _trayNotificationObservable.AsObservable(); var subject2 = new Subject <NotificationBaseDataModel>(); _subjects.Add(subject2); _notificationCenterObservable = Subject.Synchronize(subject2); NotificationCenter = _notificationCenterObservable.AsObservable(); }
public TimeEntriesLogViewSource(UITableView tableView) : base(tableView, cellIdentifier, headerCellIdentifier) { tableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; tableView.RegisterNibForCellReuse(TimeEntriesLogViewCell.Nib, cellIdentifier); tableView.RegisterNibForHeaderFooterViewReuse(TimeEntriesLogHeaderViewCell.Nib, headerCellIdentifier); deleteTableViewRowAction = UITableViewRowAction.Create( UITableViewRowActionStyle.Destructive, Resources.Delete, handleDeleteTableViewRowAction); deleteTableViewRowAction.BackgroundColor = Color.TimeEntriesLog.DeleteSwipeActionBackground.ToNativeColor(); firstTimeEntrySubject = new ReplaySubject <TimeEntriesLogViewCell>(1); FirstTimeEntry = firstTimeEntrySubject.AsObservable(); }