void InstallMenuItem_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; Explorer.Update(); // Feature is not installed. string path = this.Tag as string; DirectoryInfo info = new DirectoryInfo(path); string featureName = info.Name + @"\feature.xml"; SPFarm spFarm = Explorer.CurrentFarm; SPFeatureDefinition definition = spFarm.FeatureDefinitions.Add(featureName, Guid.Empty, true); SPFeatureDefinition dd = new SPFeatureDefinition(); this.Text = definition.DisplayName; this.Name = definition.Id.ToString(); this.Tag = definition; FeatureCollectionDefinitionNode nodeCollection = (FeatureCollectionDefinitionNode)this.Parent; this.ImageIndex = nodeCollection.InstalledIndex; this.SelectedImageIndex = nodeCollection.InstalledIndex; IsInstalled = true; Explorer.EndUpdate(); Explorer.Refresh(); //Program.Window.propertyGrid.SelectedObject = this.Tag; Cursor.Current = Cursors.Default; }
private void UninstallMenuItem_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; Explorer.Update(); Explorer.CurrentFarm.FeatureDefinitions.Remove(Definition.Id, true); this.Text = Definition.DisplayName; this.Name = ""; this.Tag = Definition.RootDirectory; FeatureCollectionDefinitionNode nodeCollection = (FeatureCollectionDefinitionNode)this.Parent; this.ImageIndex = UnInstalledIndex; this.SelectedImageIndex = UnInstalledIndex; IsInstalled = false; Explorer.EndUpdate(); Explorer.Refresh(); //Program.Window.Explorer.SelectedNode = null; //Program.Window.Explorer.SelectedNode = this; Cursor.Current = Cursors.Default; }