public DependencyForm(MpeCore.PackageClass pak) { InitializeComponent(); package = pak; this.Text = pak.GeneralInfo.Name + " - Dependencies"; versionLabel.Text = string.Format("MediaPortal {0} (API: {1}) - Skin {2}", MediaPortal.Common.Utils.CompatibilityManager.MediaPortalReleaseForApiVersion(MediaPortal.Common.Utils.CompatibilityManager.GetCurrentMaxVersion()), MediaPortal.Common.Utils.CompatibilityManager.GetCurrentVersion(), MediaPortal.Common.Utils.CompatibilityManager.SkinVersion); generalDepBindSource.DataSource = package.Dependencies.Items; dataGridView1.AutoGenerateColumns = false; SetColumnsGeneral(); dataGridView1.RowHeadersVisible = false; dataGridView1.DataSource = generalDepBindSource; dataGridView1.CellFormatting += new DataGridViewCellFormattingEventHandler(dataGridView1_CellFormatting); MpeCore.Classes.DependencyItem dep; if (!package.CheckMPDependency(out dep)) MPdepLabel.Visible = true; if (package.IsSkin) { skindepLabel.Visible = true; if (package.CheckSkinDependency(out dep)) skindepLabel.Visible = false; } if (!package.ProvidesPlugins() && !package.PluginDependencies.Items.Any()) { tabControl1.Controls.Remove(tabPage2); } else if (package.PluginDependencies.Items.Count == 0) { pluginLabel.Visible = true; tabControl1.Controls.Remove(tabPage2); } else { List<SimplePluginDependency> pluginDeps = new List<SimplePluginDependency>(); var mpVersion = MediaPortal.Common.Utils.CompatibilityManager.GetCurrentSubSystemVersion("*"); foreach (MpeCore.Classes.PluginDependencyItem item in package.PluginDependencies.Items) { pluginDeps.Add(new SimplePluginDependency(item) { CurrentVersion = mpVersion, SubSystem ="*" }); if (item.SubSystemsUsed != null) { foreach (var subSystem in item.SubSystemsUsed.Items) { var subSystemVersion = MediaPortal.Common.Utils.CompatibilityManager.GetCurrentSubSystemVersion(subSystem.Name); pluginDeps.Add(new SimplePluginDependency(item) { SubSystem = subSystem.Name, CurrentVersion = subSystemVersion }); } } } pluginDepBindSource.DataSource = pluginDeps; dataGridView2.AutoGenerateColumns = true; dataGridView2.RowHeadersVisible = false; dataGridView2.DataSource = pluginDepBindSource; dataGridView2.CellToolTipTextNeeded += new DataGridViewCellToolTipTextNeededEventHandler(dataGridView2_CellToolTipTextNeeded); dataGridView2.AutoResizeColumns( DataGridViewAutoSizeColumnsMode.AllCells); dataGridView2.CellFormatting += new DataGridViewCellFormattingEventHandler(dataGridView2_CellFormatting); } }
private void packageClass_FileUnInstalled(object sender, MpeCore.Classes.Events.UnInstallEventArgs e) { if (progressBar1.Value < progressBar1.Maximum) progressBar1.Value++; label1.Text = e.Message; progressBar1.Refresh(); label1.Refresh(); Refresh(); }
public DependencyForm(MpeCore.PackageClass pak) { InitializeComponent(); package = pak; this.Text = pak.GeneralInfo.Name + " - Dependencies"; versionLabel.Text = MediaPortal.Common.Utils.CompatibilityManager.GetCurrentVersion().ToString(); generalDepBindSource.DataSource = package.Dependencies.Items; dataGridView1.AutoGenerateColumns = false; SetColumnsGeneral(); dataGridView1.RowHeadersVisible = false; dataGridView1.DataSource = generalDepBindSource; dataGridView1.CellFormatting += new DataGridViewCellFormattingEventHandler(dataGridView1_CellFormatting); MpeCore.Classes.DependencyItem dep; if (!package.CheckMPDependency(out dep)) MPdepLabel.Visible = true; if (package.IsSkin) { skindepLabel.Visible = true; if (package.CheckSkinDependency(out dep)) skindepLabel.Visible = false; } if (!package.ProvidesPlugins()) { tabControl1.Controls.Remove(tabPage2); } else if (package.PluginDependencies.Items.Count == 0) { pluginLabel.Visible = true; tabControl1.Controls.Remove(tabPage2); } else { List<SimplePluginDependency> pluginDeps = new List<SimplePluginDependency>(); foreach (MpeCore.Classes.PluginDependencyItem item in package.PluginDependencies.Items) { pluginDeps.Add(new SimplePluginDependency(item)); } pluginDepBindSource.DataSource = pluginDeps; dataGridView2.AutoGenerateColumns = true; dataGridView2.RowHeadersVisible = false; dataGridView2.DataSource = pluginDepBindSource; dataGridView2.AutoResizeColumns( DataGridViewAutoSizeColumnsMode.AllCells); dataGridView2.CellFormatting += new DataGridViewCellFormattingEventHandler(dataGridView2_CellFormatting); } }
private static DependencyItem CreateStrictDependency(MpeCore.Interfaces.IVersionProvider depType) { DependencyItem depItem = new DependencyItem(); depItem.Type = depType.DisplayName; depItem.WarnOnly = false; depItem.MinVersion = depType.Version(null); depItem.MaxVersion = depType.Version(null); depItem.Name = depType.DisplayName; return depItem; }
/// <summary> /// Checks if package has a dependency of the specified type. /// </summary> /// <param name="depType">Type of VersionProvider to check for</param> /// <param name="depItem">Specific dependency item in dpendencies collection that is of the desired type</param> /// <returns>Returns true if package has the dependency</returns> public bool CheckDependency(MpeCore.Interfaces.IVersionProvider depType, out DependencyItem depItem) { depItem = null; foreach (DependencyItem item in Dependencies.Items) { if (item.Type == depType.DisplayName) { depItem = item; return true; } } return false; }
public SimplePluginDependency(MpeCore.Classes.PluginDependencyItem item) { baseItem = item; }