这是indexloc提供的服务,不要输入任何密码
Skip to content

[Feedback-Required] Making layout serialization async #264

@X39

Description

@X39

I recently came across the need to make layout serialization async.

While this was quite an unpleasent experience, i got it to work....
Not, the reason i created this ticket is the following:

I plan on creating a PR that actually provides that capability to "the masses" and look for advice on what exactly to change.

On my journy to making this async, i found numerous of interfaces encapsulated internal, making the approach i chose for doing things async utilize reflection as the required changes where requiring replacing the event-callback system with a method-callback system (and making everything async down to that point.)

To be more precise, this code:

foreach (var lcToAttach in layout.Descendents().OfType<ILayoutPreviousContainer>().Where(lc => lc.PreviousContainerId != null))
{
var paneContainerToAttach = layout.Descendents().OfType<ILayoutPaneSerializable>().FirstOrDefault(lps => lps.Id == lcToAttach.PreviousContainerId);
if (paneContainerToAttach == null)
throw new ArgumentException($"Unable to find a pane with id ='{lcToAttach.PreviousContainerId}'");
lcToAttach.PreviousContainer = paneContainerToAttach as ILayoutContainer;
}

is a mess right now since all of it requires internally encapsulated stuff:
internal interface ILayoutPaneSerializable
{
/// <summary>Gets/sets the unique id for this layout pane.</summary>
string Id { get; set; }
}

internal interface ILayoutPreviousContainer
{
ILayoutContainer PreviousContainer { get; set; }
string PreviousContainerId { get; set; }
}

To come to an end (TL;DR):

  • Should i split up that method into multiple parts?
  • Make the interfaces public?
  • Something else?

Also regarding an async approach, the question is also wether to utilize a single callback method or something else here too?

Thanks for your time,
X39

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions