/// <summary> /// Deal with a new file. /// </summary> /// <param name="file"></param> private async Task <PackageView> LoadFile(IFile file) { var newPage = new TabPage(); newPage.Text = "Loading..."; packagesTabControl.Controls.Add(newPage); PackageView packageView = null; try { var newPackage = await Task.Run(() => PackageReader.ReadPackageFromFile(file)); packageView = new PackageView(newPackage); newPage.Text = newPackage.FileName; newPage.Controls.Add(packageView); packageView.Tag = newPage; packageView.SetView(view); packageView.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; packageView.Dock = System.Windows.Forms.DockStyle.Fill; packageView.Location = new System.Drawing.Point(3, 3); packageView.Margin = new System.Windows.Forms.Padding(0); packageView.Name = "packageView"; packageView.TabIndex = 0; packagesTabControl.SelectedTab = newPage; } catch (Exception ex) { packagesTabControl.Controls.Remove(newPage); MessageBox.Show("Could not load archive!" + Environment.NewLine + ex.Message, "Error"); } return(packageView); }//LoadFile
public async void LoadFile(IFile f, PackageView owner = null) { var pkgView = await Loader(f); if (owner != null && pkgView != null) { owner.AddChildPackage(pkgView); } }
public void SetParentPackage(PackageView p) { parent = p; }
public void RemoveChildPackage(PackageView p) { this.children.Remove(p); }
public void AddChildPackage(PackageView p) { this.children.Add(p); p.SetParentPackage(this); }
private void SetParentPackage(PackageView p) { parent = p; }
private void RemoveChildPackage(PackageView p) { this.children.Remove(p); }