Ejemplo n.º 1
0
 /// <summary>
 /// Deregister an accordion for observed accordions
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public virtual async Task Deregister(IAccordionModel model)
 {
     if (this.Items.Contains(model))
     {
         this.Items.Remove(model);
     }
     await Task.CompletedTask;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Opens the targeted accordion
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public virtual async Task Open(IAccordionModel model)
 {
     foreach (var accordion in this.Items.Where(accordion => !accordion.AllowsMultiple))
     {
         await this.Close(accordion);
     }
     model.IsExpanded = true;
     await Task.CompletedTask;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Toggles the targeted accordion
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public virtual async Task Toggle(IAccordionModel model)
 {
     if (model.IsExpanded)
     {
         await this.Close(model);
     }
     else
     {
         await this.Open(model);
     }
     await Task.CompletedTask;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Closes the targeted accordion
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public virtual async Task Close(IAccordionModel model)
 {
     model.IsExpanded = false;
     await Task.CompletedTask;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Register an accordion to be interacted with
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public virtual async Task Register(IAccordionModel model)
 {
     this.Items.Add(model);
     await Task.CompletedTask;
 }