Esempio n. 1
0
        /// <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
Esempio n. 2
0
        public async void LoadFile(IFile f, PackageView owner = null)
        {
            var pkgView = await Loader(f);

            if (owner != null && pkgView != null)
            {
                owner.AddChildPackage(pkgView);
            }
        }
Esempio n. 3
0
 public void SetParentPackage(PackageView p)
 {
     parent = p;
 }
Esempio n. 4
0
 public void RemoveChildPackage(PackageView p)
 {
     this.children.Remove(p);
 }
Esempio n. 5
0
 public void AddChildPackage(PackageView p)
 {
     this.children.Add(p);
     p.SetParentPackage(this);
 }
Esempio n. 6
0
 private void SetParentPackage(PackageView p)
 {
     parent = p;
 }
Esempio n. 7
0
 private void RemoveChildPackage(PackageView p)
 {
     this.children.Remove(p);
 }