private void Start() { switch (ModeController.Mode) { case SimulatorMode.Development: case SimulatorMode.Race: QualitySettings.vSyncCount = 0; // VSync must be disabled Application.targetFrameRate = 60; Time.captureFramerate = 60; Time.fixedDeltaTime = 0.002f; break; default: QualitySettings.vSyncCount = 1; Application.targetFrameRate = 60; Time.captureFramerate = 0; Time.fixedDeltaTime = 0.02f; break; } raceParameters = RaceParameters.readRaceParameters(); Observables.Delay(TimeSpan.FromMilliseconds(0)).Subscribe(_ => { if (ModeController.Mode == SimulatorMode.Playback || ModeController.Mode == SimulatorMode.RemoteControl) { setState(new Playback(this)); } else if (ModeController.Mode == SimulatorMode.Race) { setState(new RaceLobby(this)); } else { setState(new FreePractice(this)); } }); }
private async Task GetVersions() { Title = "finding previous versions ..."; List <R2PackagePart> parts; try { parts = await _partsMgr.ListByPkgName(Filename, new CancellationToken()); } catch (Exception ex) { Error = ex.Info(); return; } var list = new List <PackageVersionRowVM>(); foreach (var verGrp in parts.GroupBy(x => x.PackageHash)) { var row = new PackageVersionRowVM(verGrp, _partsMgr); list.Add(row); } var sortd = list.OrderByDescending(x => x.UploadDate); Rows = new Observables <PackageVersionRowVM>(sortd); Title = $"Previous Versions ({list.Count})"; }
public override async void Reload() { ILoader <BookItem> Loader = ZS.CreateLoader(); IsLoading = true; MessageBus.Subscribe(this, MessageBus_OnDelivery); IList <GRRow <BookDisplay> > FirstPage = (await Loader.NextPage(30)).Remap(ToGRRow); MessageBus.Unsubscribe(this, MessageBus_OnDelivery); Observables <BookItem, GRRow <BookDisplay> > ItemsObservable = new Observables <BookItem, GRRow <BookDisplay> >(FirstPage); ItemsObservable.LoadEnd += (s, e) => { MessageBus.Unsubscribe(this, MessageBus_OnDelivery); IsLoading = false; }; ItemsObservable.LoadStart += (s, e) => { IsLoading = true; MessageBus.Subscribe(this, MessageBus_OnDelivery); }; ItemsObservable.ConnectLoader(Loader, b => b.Remap(ToGRRow)); BkTable.Items = ItemsObservable; IsLoading = false; }
public ObservablesListViewModel(IConcurrencyService concurrencyService, IObservablesScreenItemFactory factory) { var items = new ObservableCollectionExtended <ObservablesListItem>(); Items = new ReadOnlyObservableCollection <ObservablesListItem>(items); WhenSelectionChanges = mWhenSelectionChanges .ObserveOn(concurrencyService.TaskPoolRxScheduler) .AddKey(item => item.ObservableInstance.ObservableId) .Transform(item => item.ObservableInstance) .AsObservableCache() .Connect(); this.WhenActivated((CompositeDisposable disposables) => { Observables .Transform(obs => factory.CreateItem(obs)) .Sort(Utility.Comparer <ObservablesListItem> .ByKey(x => - x.ObservableInstance.ObservableId)) .SubscribeOn(concurrencyService.TaskPoolRxScheduler) .ObserveOn(concurrencyService.DispatcherRxScheduler) .Bind(items) .Transform(item => item.Activator.Activate()) .DisposeMany() .Subscribe() .DisposeWith(disposables); }); }
public TodoViewModel(ITodo presentation) : base(presentation) { if (!Observables.Any()) { Mvx.IoCProvider.Resolve <IListBusiness <int, Domain.Todo> >().PublishFromStorage(); } }
void SimulateWebClient() { Observables.Delay(TimeSpan.FromSeconds(1)).Subscribe(_ => { StartFreePractice(); SendFromWeb("{\"type\":\"CarLogin\",\"teamId\":\"j\u00E4s\u00E4\",\"name\":\"J\u00E4s\u00E4Bot\",\"color\":\"#FFFF00\",\"imageWidth\":8}"); }); }
public UserViewModel(IListPresentation <int, Observable.User, Observable.User> presentation) : base(presentation) { if (!Observables.Any()) { Mvx.IoCProvider.Resolve <IListBusiness <int, Domain.User> >().PublishFromStorage(); } }
public void DisposeTheDisposableResourceOnLastSubsequentDisposal() { int instantiations = 0; IDisposable disposable = Disposable.Create(() => -- instantiations); Func <IDisposable> build = () => { ++instantiations; return(disposable); }; IObservable <int> observable = Observables.UsingRefCounted(build, value => Observable.Never <int>()); using (observable.Subscribe()) { using (observable.Subscribe()) { Assert.That(instantiations, Is.EqualTo(1)); } Assert.That(instantiations, Is.EqualTo(1)); } Assert.That(instantiations, Is.EqualTo(0)); }
public async void OpenCommentStack(string CommId) { CommInit = true; DisplayControls(CommentControls); CommentSection.Visibility = Visibility.Visible; bool LoadFirst = true; Func <SHTarget, int, uint, string[], PostData> StackRequest = (a, b, c, Ids) => { if (LoadFirst) { LoadFirst = false; return(Shared.ShRequest.GetCommentStack(Ids[0])); } return(Shared.ShRequest.GetComments(a, b, c, Ids)); }; HSLoader <HSComment> CLoader = new HSLoader <HSComment>(CommId, SHTarget.COMMENT, StackRequest) { ConvertResult = (x) => x.Flattern(y => y.Replies) }; IEnumerable <HSComment> FirstPage = await CLoader.NextPage(); CommentsSource = new Observables <HSComment, HSComment>(FirstPage.ToArray()); CommentsSource.LoadStart += (x, y) => MarkLoading(); CommentsSource.LoadEnd += (x, y) => MarkNotLoading(); CommentsSource.ConnectLoader(CLoader); CommentList.ItemsSource = CommentsSource; }
protected virtual async void ListUpdatedHandler(MessageBase <IList <TDomain> > messageBase) { // Might need to add new threads and main thread requests. IsLoading = true; var objects = await Resolver.Resolve <IListBusiness <TId, TDomain> >().GetAllAsync().ConfigureAwait(false); var deleteIds = 0; try { deleteIds = Observables.Select(x => x.Id).Except(objects.Select(x => x.Id)).Count(); } catch (Exception) { } var count = objects.Count + deleteIds; VerifyAndResetCountdown(count); var dispatcher = Resolver.Resolve <IExMainThreadDispatcher>(); foreach (var observable in Observables.Reverse()) { TObservable tmpObservable = observable; dispatcher.InvokeOnMainThread(() => { Observables.Remove(tmpObservable); SignalCde(); }); } foreach (var domainObject in objects) { if (ObservablesContainsId(domainObject.Id)) { var observable = Observables.First(x => x.Id.Equals(domainObject.Id)); DomainObservableMapper.UpdateDestination(domainObject, observable); SignalCde(); } else { var observable = DomainObservableMapper.Map(domainObject); dispatcher.InvokeOnMainThread(() => { Observables.InsertItem(observable); SignalCde(); }); } } if (SelectedObservable.IsTransient() && Observables.Any()) { ObservableSelectedMapper.UpdateDestination(Observables.First(), SelectedObservable); } IsLoading = false; }
public void LoadTrack(string fileName) { SplineMesh.SplineNode[] trackNodes = null; if (fileName != null) { string json = null; if (File.Exists(fileName)) { Debug.Log("Loading track from filesystem: " + fileName); json = new StreamReader(fileName).ReadToEnd(); } else { Debug.Log("Loading track as Unity resource: " + fileName); json = Resources.Load <TextAsset>("Tracks/" + fileName.Replace(".json", ""))?.text; } if (json != null) { trackNodes = FromJson <SplineMesh.SplineNode>(json); } else { Debug.Log("Unknown track " + fileName + ": not found as a resource or in the file system"); } } if (trackNodes != null && trackNodes.Length > 0) { track.enabled = false; track.IsLoop = false; while (track.nodes.Count > trackNodes.Length) { track.RemoveNode(track.nodes.Last()); } for (int i = 0; i < trackNodes.Length; i++) { var node = trackNodes[i]; if (i < track.nodes.Count) { track.nodes[i].Position = node.Position; track.nodes[i].Direction = node.Direction; track.nodes[i].Up = node.Up; track.nodes[i].Scale = node.Scale; track.nodes[i].Roll = node.Roll; } else { track.AddNode(node); } } track.IsLoop = true; track.enabled = true; Observables.Delay(TimeSpan.FromSeconds(1)).Subscribe(_ => { EventBus.Publish(new CameraFollow(null)); }); } }
private async void ViewFile( StorageFile file ) { StorageFileStreamer SFS = new StorageFileStreamer( file ); IList<string> FirstRead = await SFS.NextPage( 50 ); Observables<string, string> OSF = new Observables<string, string>( FirstRead ); OSF.ConnectLoader( SFS ); TextContent.ItemsSource = OSF; }
public void OnlyInstantiateTheResourceOnFirstSubscription() { int instantiations = 0; RefCounted <int> refCounted = new RefCounted <int>(() => ++ instantiations, value => -- instantiations); using (Observables.UsingRefCounted(refCounted, value => Observable.Never <int>()).Subscribe()) { Assert.That(instantiations, Is.EqualTo(1)); } }
private async void ViewFile(StorageFile file) { StorageFileStreamer SFS = new StorageFileStreamer(file); IList <string> FirstRead = await SFS.NextPage(50); Observables <string, string> OSF = new Observables <string, string>(FirstRead); OSF.ConnectLoader(SFS); TextContent.ItemsSource = OSF; }
public SharersHub() { SearchSet = new Observables <HubScriptItem, HubScriptItem>(); RCache = new RuntimeCache(); MessageBus.Subscribe(this, MessageBus_OnDelivery); SearchSet.LoadStart += (s, e) => { Searching = true; }; SearchSet.LoadEnd += (s, e) => { Searching = false; }; }
public void Clear() { Observables.Clear(); Observers.Clear(); SubjectFactories.Clear(); SubscriptionFactories.Clear(); Other.Clear(); Subscriptions.Clear(); Subjects.Clear(); ReliableSubscriptions.Clear(); }
public DishListViewModel(IMvxNavigationService navigationService) { _navigationService = navigationService; if (!Observables.Any()) { return; } Resolver.Resolve <IListBusiness <int, Domain.Dish> >().PublishFromStorageAsync(); ShowFilterCommand = new MvxAsyncCommand(async() => await _navigationService.Navigate <DishFilterViewModel>()); IsLoading = false; }
public IDisposable Run(Observables parent) { _gate = new object(); _isStopped = false; _group = new CompositeDisposable(); _sourceSubscription = new SingleAssignmentDisposable(); _group.Add(_sourceSubscription); _sourceSubscription.Disposable = parent._sources.SubscribeSafe(this); return(_group); }
public void Dispose() { Observables.Dispose(); Observers.Dispose(); SubjectFactories.Dispose(); SubscriptionFactories.Dispose(); Other.Dispose(); Templates.Dispose(); Subscriptions.Dispose(); Subjects.Dispose(); ReliableSubscriptions.Dispose(); }
private void OnEnable() { rigidBody = GetComponent <Rigidbody>(); allWheels = new WheelCollider[] { frontLeftWC, frontRightWC, rearLeftWC, rearRightWC }; EventBus.Subscribe <CarFinished>(this, f => { if (f.car.name == CarInfo.name) { this.finished = true; Observables.Delay(TimeSpan.FromSeconds(1)).Subscribe(_ => { Destroy(gameObject); }); } }); }
private void InsertFakeTweet(string FTweet) { TransitionDisplay.SetState(NCPlaceholder, TransitionState.Inactive); Observables <Tweet, Tweet> Tweets = (Observables <Tweet, Tweet>)TweetsView.ItemsSource; Tweets.Insert(0, new Tweet() { Text = FTweet , User = CurrentUser , CreatedAt = DateTime.Now.ToString("ddd MMM dd HH:mm:ss zzzz yyyy", CultureInfo.InvariantCulture) }); }
public void Countdown(int seconds, Action action) { var secondsRemaining = Observables.Countdown(seconds); Subscribe(secondsRemaining, EventBus.Publish); var timedOut = secondsRemaining.Where(s => s.secondsRemaining == 0).Select(s => new Unit()); var spaceBar = EventBus.Receive <ProceedToNextPhase>().Select(s => new Unit()); Subscribe( timedOut.Merge(spaceBar), action ); }
public void NotInstantiateTheResourceOnSubsequentSubscriptions() { int instantiations = 0; RefCounted <int> refCounted = new RefCounted <int>(() => ++ instantiations, value => -- instantiations); IObservable <int> observable = Observables.UsingRefCounted(refCounted, value => Observable.Never <int>()); using (observable.Subscribe()) { using (observable.Subscribe()) { Assert.That(instantiations, Is.EqualTo(1)); } } }
protected virtual void ItemUpdatedHandler(MessageBase <TDomain> messageBase) { // Update item in the list var itemInList = Observables.FirstOrDefault(x => x.Id.Equals(messageBase.Object.Id)); if (itemInList != null) { DomainObservableMapper.UpdateDestination(messageBase.Object, itemInList); } // Update the selected item only if updated and is selected if (SelectedObservable.Id.Equals(messageBase.Object.Id) && messageBase.State == EDomainState.Updated) { DomainSelectedMapper.UpdateDestination(messageBase.Object, SelectedObservable); } }
private void OnEnable() { switch (ModeController.Mode) { case SimulatorMode.Playback: case SimulatorMode.RemoteControl: break; default: Debug.Log("Initializing spectator socket"); StartListening(); RaceParameters raceParams = RaceParameters.readRaceParameters(); if (raceParams.raceLogFile != null) { Debug.Log("Writing race log to " + raceParams.raceLogFile); var stream = new BinaryWriter(File.Open(raceParams.raceLogFile, FileMode.Create)); Spectate(b => { stream.Write(b); }, () => stream.Close(), new CarInfo[] { }); } EventBus.Subscribe <CarAdded>(this, e => { CarInfo car = ((CarAdded)e).car; carInfos.Add(car.name, car); }); EventBus.Subscribe <CarRemoved>(this, e => { CarInfo car = ((CarRemoved)e).car; carInfos.Remove(car.name); }); EventBus.Subscribe <RaceFinished>(this, e => { Observables.Delay(TimeSpan.FromSeconds(1)).Subscribe(_ => { Debug.Log("Race finished, stopping updates"); raceEnded = true; EventBus.Publish(new GameStatus(new CarStatus[0])); var stream = new BinaryWriter(File.Open(raceParams.raceResultFile, FileMode.Create)); stream.Write(System.Text.Encoding.UTF8.GetBytes(JsonUtility.ToJson(e, true))); stream.Close(); }); Observables.Delay(TimeSpan.FromSeconds(3)).Subscribe(_ => { Debug.Log("Quitting application"); Application.Quit(); }); }); break; } }
public SharersHub() { Activities = new ObservableCollection<Activity>(); SearchSet = new Observables<HubScriptItem, HubScriptItem>(); RCache = new RuntimeCache(); Grants = new SHGrant[ 0 ]; Member = X.Singleton<IMember>( XProto.SHMember ); Member.OnStatusChanged += Member_OnStatusChanged; MessageBus.OnDelivery += MessageBus_OnDelivery; SearchSet.LoadStart += ( s, e ) => { Searching = true; }; SearchSet.LoadEnd += ( s, e ) => { Searching = false; }; UpdateLLText(); }
public void TruncateLoggedEntities(IQueryEngineRegistrySnapshot snapshot) { if (snapshot == null) { throw new ArgumentNullException(nameof(snapshot)); } Observers.ClearRemovedKeys(snapshot.RemovedObservers); Observables.ClearRemovedKeys(snapshot.RemovedObservables); SubjectFactories.ClearRemovedKeys(snapshot.RemovedSubjectFactories); Subjects.ClearRemovedKeys(snapshot.RemovedSubjects); ReliableSubscriptions.ClearRemovedKeys(snapshot.RemovedReliableSubscriptions); SubscriptionFactories.ClearRemovedKeys(snapshot.RemovedSubscriptionFactories); Subscriptions.ClearRemovedKeys(snapshot.RemovedSubscriptions); Other.ClearRemovedKeys(snapshot.RemovedOther); Templates.ClearRemovedKeys(snapshot.RemovedTemplates); }
private void UpdateCollection() { if (Observables.Count == _collectionCount) { return; } while (Observables.Count < _collectionCount) { Observables.Add(new object()); } while (Observables.Count > _collectionCount) { Observables.RemoveAt(0); } }
public void Reload(Func <IQueryable <Book>, IQueryable <Book> > Filter) { lock (this) { if (IsLoading) { return; } IsLoading = true; } StringResources stx = StringResources.Load("AppResources"); Message = stx.Text("Loading"); IQueryable <Book> Books = QuerySet(Shared.BooksDb.Books.AsQueryable()); if (Filter != null) { Books = Filter(Books); } if (!string.IsNullOrEmpty(Search)) { Books = Books.Where(x => x.Title.Contains(Search)); } Books = Books.Include(x => x.Info); QueryLoader <Book> BLoader = new QueryLoader <Book>(Books, Shared.BooksDb); Observables <Book, GRRow <BookDisplay> > ItemsObservable = new Observables <Book, GRRow <BookDisplay> >(); ItemsObservable.ConnectLoader(BLoader, x => x.Remap(ToGRRow)); ItemsObservable.LoadEnd += (s, e) => IsLoading = false; ItemsObservable.LoadStart += (s, e) => { Message = string.Format("{0} {1} / {2}", stx.Text("Loading"), BLoader.CurrentPage, BLoader.NTotal); IsLoading = true; }; BkTable.Items = ItemsObservable; IsLoading = false; }
public void OnlyInstantiateTheDisposableResourceOnFirstSubscription() { int instantiations = 0; IDisposable disposable = Disposable.Create(() => -- instantiations); Func <IDisposable> build = () => { ++instantiations; return(disposable); }; using (Observables.UsingRefCounted(build, value => Observable.Never <int>()).Subscribe()) { Assert.That(instantiations, Is.EqualTo(1)); } }
private void Start() { raceParameters = RaceParameters.readRaceParameters(); Observables.Delay(TimeSpan.FromMilliseconds(0)).Subscribe(_ => { if (ModeController.Mode == SimulatorMode.Playback) { setState(new Playback(this)); } else if (ModeController.Mode == SimulatorMode.Race) { setState(new RaceLobby(this)); } else { setState(new FreePractice(this)); } }); }
protected override async Task ListUpdatedHandler(MessageBase <IList <Domain.Todo> > messageBase) { await base.ListUpdatedHandler(messageBase); Cde.Wait(1000); var userPresentation = Mvx.IoCProvider.Resolve <ISinglePresentation <int, Observable.LoggedInUser> >(); if (!userPresentation.SelectedObservable.IsTransient()) { var dispatcher = Mvx.IoCProvider.Resolve <IMvxMainThreadAsyncDispatcher>(); dispatcher.ExecuteOnMainThreadAsync(() => { CurrentUserTodoObservables.Clear(); }); var todosFromUser = Observables.Where(x => x.UserId.Equals(userPresentation.SelectedObservable.Id)).Take(5); foreach (var todo in todosFromUser) { dispatcher.ExecuteOnMainThreadAsync(() => { CurrentUserTodoObservables.Add(todo); }); } } }
public async Task Load() { IsLoading = true; CommentLoader CL = new CommentLoader( ThisBook.Id , X.Call<XKey[]>( "wenku8.Settings.WRequest, wenku8-protocol", "GetComments", ThisBook.Id ) , new CommentLoader.CommentXMLParser( GetReviews ) ); IList<Comment> FirstLoad = await CL.NextPage(); IsLoading = false; Comments = new Observables<Comment, Comment>( FirstLoad ); Comments.LoadStart += ( s, e ) => IsLoading = true; Comments.LoadEnd += ( se, e ) => IsLoading = false; Comments.ConnectLoader( CL ); NotifyChanged( "Comments" ); SetControls( "NewComment", "Reload" ); }
public ReplyList() { this.InitializeComponent(); Replies = new Observables<Comment, Comment>(); RepliesView.ItemsSource = Replies; }
public async Task Init() { if ( DataReady ) return; IsLoading = true; try { ZSFeedbackLoader<BookItem> ZSF = new ZSFeedbackLoader<BookItem>( PM.CreateSpider() ); Data = new Observables<BookItem, BookItem>( await ZSF.NextPage() ); Data.ConnectLoader( ZSF ); Data.LoadStart += ( s, e ) => IsLoading = true; Data.LoadEnd += ( s, e ) => IsLoading = false; DataReady = true; NotifyChanged( "Data", "DataReady" ); } finally { IsLoading = false; } }
private Review[] GetReviews( string xml, out int PageCount ) { Review[] Comments = null; XDocument p = XDocument.Parse( xml ); IEnumerable<XElement> CPreviews = p.Descendants( "item" ); // Set pagelimit int.TryParse( p.Descendants( "page" ).ElementAt( 0 ).Attribute( "num" ).Value, out PageCount ); int l; Comments = new Review[ l = CPreviews.Count() ]; for ( int i = 0; i < l; i++ ) { XElement xe = CPreviews.ElementAt( i ); XElement xu = xe.Descendants( "user" ).ElementAt( 0 ); Comments[ i ] = new Review() { Id = xe.Attribute( "rid" ).Value , Username = xu.Value , Title = xe.Descendants( "content" ).ElementAt( 0 ).Value , UserId = xu.Attribute( "uid" ).Value , PostTime = xe.Attribute( "posttime" ).Value , LastReply = xe.Attribute( "replytime" ).Value , NumReplies = xe.Attribute( "replies" ).Value }; } return Comments; }
private async void ReloadComments() { if ( LoadingRing.IsActive ) return; MarkLoading(); HSLoader<HSComment> CLoader = new HSLoader<HSComment>( BindItem.Id, SHTarget.SCRIPT, Shared.ShRequest.GetComments ) { ConvertResult = ( x ) => x.Flattern( y => y.Replies ) }; IList<HSComment> FirstPage = await CLoader.NextPage(); MarkNotLoading(); if ( BindItem.Encrypted ) { if ( Crypt == null ) { CommentsSource = new Observables<HSComment, HSComment>( CrippledComments( FirstPage ) ); CommentsSource.ConnectLoader( CLoader, CrippledComments ); } else { CommentsSource = new Observables<HSComment, HSComment>( DecryptComments( FirstPage ) ); CommentsSource.ConnectLoader( CLoader, DecryptComments ); } } else { CommentsSource = new Observables<HSComment, HSComment>( FirstPage ); CommentsSource.ConnectLoader( CLoader ); } CommentsSource.LoadStart += ( x, y ) => MarkLoading(); CommentsSource.LoadEnd += ( x, y ) => MarkNotLoading(); CommentList.ItemsSource = CommentsSource; }
public async void OpenCommentStack( string CommId ) { CommInit = true; DisplayControls( CommentControls ); SimpleStory.DoubleAnimation( CommentStory, CommentSection , "(UIElement.RenderTransform).(TranslateTransform.Y)" , 0.25 * LayoutSettings.ScreenHeight, 0 ); SimpleStory.DoubleAnimation( CommentStory, CommentSection, "Opacity", 0, 1 ); CommentSection.Visibility = Visibility.Visible; bool LoadFirst = true; Func<SHTarget, int, uint, string[], PostData> StackRequest = ( a, b, c, Ids ) => { if ( LoadFirst ) { LoadFirst = false; return Shared.ShRequest.GetCommentStack( Ids[ 0 ] ); } return Shared.ShRequest.GetComments( a, b, c, Ids ); }; HSLoader<HSComment> CLoader = new HSLoader<HSComment>( CommId, SHTarget.COMMENT, StackRequest ) { ConvertResult = ( x ) => x.Flattern( y => y.Replies ) }; IEnumerable<HSComment> FirstPage = await CLoader.NextPage(); CommentsSource = new Observables<HSComment, HSComment>( FirstPage.ToArray() ); CommentsSource.LoadStart += ( x, y ) => MarkLoading(); CommentsSource.LoadEnd += ( x, y ) => MarkNotLoading(); CommentsSource.ConnectLoader( CLoader ); CommentList.ItemsSource = CommentsSource; CommentStory.Begin(); }
private async void ReloadRequests( SHTarget Target ) { if ( LoadingRing.IsActive ) return; ReqTarget = Target; MarkLoading(); HSLoader<SHRequest> CLoader = new HSLoader<SHRequest>( BindItem.Id , Target , ( _Target, _Skip, _Limit, _Ids ) => Shared.ShRequest.GetRequests( _Target, _Ids[0], _Skip, _Limit ) ); CLoader.ConvertResult = xs => { XParameter XParam = XGrant.Parameter( BindItem.Id ); if ( XParam != null ) { foreach ( SHRequest x in xs ) { x.Granted = XParam.FindParameter( x.Id ) != null; } } return xs.ToArray(); }; IList<SHRequest> FirstPage = await CLoader.NextPage(); MarkNotLoading(); RequestsSource = new Observables<SHRequest, SHRequest>( FirstPage ); RequestsSource.ConnectLoader( CLoader ); RequestsSource.LoadStart += ( x, y ) => MarkLoading(); RequestsSource.LoadEnd += ( x, y ) => MarkNotLoading(); RequestList.ItemsSource = RequestsSource; }
private void ScriptDetails_Unloaded( object sender, RoutedEventArgs e ) { DataContext = null; CommentsSource = null; HSComment.ActiveInstance = null; }
private void BookLoaded( IList<BookItem> aList ) { IsLoading.IsActive = false; SCondition.Visibility = SearchTerm.Visibility = Visibility.Collapsed ; Status.Visibility = Visibility.Visible; SearchTerm.IsEnabled = false; Status.Text = stx.Text( "Search_ResultStamp_A" ) + " " + LL.TotalCount + " " + stx.Text( "Search_ResultStamp_B" ); Observables<BookItem, BookItem> ItemsObservable = new Observables<BookItem, BookItem>( aList ); ItemsObservable.LoadEnd += ( a, b ) => { IsLoading.IsActive = false; }; ItemsObservable.LoadStart += ( a, b ) => { IsLoading.IsActive = true; }; ItemsObservable.ConnectLoader( LL ); VGrid.ItemsSource = ItemsObservable; }