/// <inheritdoc/> protected async override void OnApplyTemplate() { ClearTasks(); Buckets.Clear(); Plans.Clear(); if (_list != null) { _list.ItemClick -= List_ItemClick; _list.Tapped += List_Tapped; if (_isPreviewKeyUpEventSupported) { _list.PreviewKeyUp -= List_PreviewKeyUp; } } if (_add != null) { _add.Click -= Add_Click; } if (_input != null) { _input.KeyUp -= Input_KeyUp; } base.OnApplyTemplate(); if (GetTemplateChild(ControlTasks) is ListView list) { _list = list; _list.ItemClick += List_ItemClick; _list.Tapped += List_Tapped; if (_isPreviewKeyUpEventSupported) { _list.PreviewKeyUp += List_PreviewKeyUp; } } if (GetTemplateChild(ControlAdd) is Button add) { _add = add; _add.Click += Add_Click; } _input = GetTemplateChild(ControlInput) as TextBox; if (_input != null) { _input.KeyUp += Input_KeyUp; } if (MicrosoftGraphService.Instance.IsAuthenticated) { await LoadPlansAsync(); } else { MicrosoftGraphService.Instance.IsAuthenticatedChanged -= Instance_IsAuthenticatedChanged; MicrosoftGraphService.Instance.IsAuthenticatedChanged += Instance_IsAuthenticatedChanged; } }
/// <summary> /// Initialize the list of buckets. Get the bucket sizes /// (and bucket lengths) from the bucket sizes provider. /// </summary> /// <param name="inUseCounts"> /// Map of current buckets and their in use counts. /// </param> private void InitBuckets(Dictionary <int, int> inUseCounts) { lock (_poolGate) { Preconditions.CheckNotNull(inUseCounts); // Clear out all the buckets Buckets.Clear(); // Create the new buckets Dictionary <int, int> bucketSizes = _poolParams.BucketSizes; if (bucketSizes != null) { foreach (KeyValuePair <int, int> entry in bucketSizes) { int bucketSize = entry.Key; int maxLength = entry.Value; int bucketInUseCount = 0; inUseCounts.TryGetValue(bucketSize, out bucketInUseCount); Buckets.Add(bucketSize, new Bucket <T>( GetSizeInBytes(bucketSize), maxLength, bucketInUseCount)); } _allowNewBuckets = false; } else { _allowNewBuckets = true; } } }
private async Task InitPlanAsync() { try { ClearTasks(); GraphServiceClient graphClient = await GraphServiceHelper.GetGraphServiceClientAsync(); if (graphClient != null) { IPlannerPlanBucketsCollectionPage buckets = await graphClient.Planner.Plans[PlanId].Buckets.Request().GetAsync(); List <PlannerBucket> bucketList = new List <PlannerBucket>(); while (true) { foreach (PlannerBucket bucket in buckets) { bucketList.Add(bucket); } if (buckets.NextPageRequest == null) { break; } buckets = await buckets.NextPageRequest.GetAsync(); } TaskFilterSource.Clear(); Buckets.Clear(); TaskFilterSource.Add(new PlannerBucket { Id = TaskTypeAllTasksId, Name = AllTasksLabel }); foreach (PlannerBucket bucket in bucketList) { Buckets.Add(bucket); TaskFilterSource.Add(bucket); } TaskFilterSource.Add(new PlannerBucket { Id = TaskTypeClosedTasksId, Name = ClosedTasksLabel }); TaskType = TaskTypeAllTasksId; await LoadAllTasksAsync(); } } catch (Exception exception) { MessageDialog messageDialog = new MessageDialog(exception.Message); await messageDialog.ShowAsync(); } }
/// <summary> /// refresh the bucket list /// </summary> void RefreshBuckets() { //init buckets and files SelectedBucket = ""; SelectedFile = ""; Buckets.Clear(); Files.Clear(); //get the buckets IEnumerable <string> buckets; if (!CloudStorage.GetBuckets(out buckets)) { MessageBox.Show("There was an error getting buckets."); return; } //copy into our list buckets.ToList().ForEach(b => Buckets.Add(b)); }
private void ClearBroadphase() { Buckets.Clear(); _tmpPairs.Clear(); _tmpPairsList.Clear(); }
internal void Clear() { Buckets.Clear(); Add(new Bucket()); }