public ExternalPortView BuildInput() { var input = portBuilder.Build(PortType.Input, GetPlace()); scheme.AddToView(input); return(input); }
public static async Task Load(SchemeView scheme) { StorageFolder folder = ApplicationData.Current.LocalFolder; scheme.Recreate(); //serialization of gates StorageFile gateFile = await folder.GetFileAsync(gatePath); if (gateFile == null) { await folder.CreateFileAsync(gatePath); } var gates = JsonConvert.DeserializeObject <List <GateDto> >(await FileIO.ReadTextAsync(gateFile)); var gatesToAdd = new List <GateView>(gates.Select(g => new GateView(g.Type, g.Location, g.Inputs, g.Outputs))); gatesToAdd.ForEach(g => scheme.AddToView(g)); //serialization of wires StorageFile lineFile = await folder.GetFileAsync(linePath); if (lineFile == null) { await folder.CreateFileAsync(linePath); } var wires = JsonConvert.DeserializeObject <List <WireDto> >(await FileIO.ReadTextAsync(lineFile)); var wiresToAdd = new List <WireView>(wires.Select(w => new WireView(w.Connection))); wiresToAdd.ForEach(w => scheme.AddToView(w)); }