public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider == null) { return(string.Empty); } IVsSolution vsSolution = (IVsSolution)ServiceHelper.GetService(provider, typeof(IVsSolution), this); HierarchyNode root = new HierarchyNode(vsSolution); HierarchyNode currentValue = null; if (value == null) { value = Guid.Empty; } try { VSShellHelper.SetWaitCursor(provider); if (!string.IsNullOrWhiteSpace(value.ToString())) { currentValue = new HierarchyNode(vsSolution, value.ToString()); } using (HierarchyNode newValue = EditValue(provider, root, currentValue)) { if (newValue != null) { return(newValue.UniqueName); } } } //Thrown if Project doesn't exist on solution catch (InvalidOperationException) { } //Thrown if Project doesn't exist on solution catch (COMException) { } catch (ServiceMissingException) { throw; } catch (Exception e) { VSShellHelper.ShowErrorDialog(provider, e.Message); } finally { if (root != null) { root.Dispose(); } if (currentValue != null) { currentValue.Dispose(); } } return(string.Empty); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider == null) { return string.Empty; } IVsSolution vsSolution = (IVsSolution)ServiceHelper.GetService(provider, typeof(IVsSolution), this); HierarchyNode root = new HierarchyNode(vsSolution); HierarchyNode currentValue = null; if (value == null) { value = Guid.Empty; } try { VSShellHelper.SetWaitCursor(provider); if (!string.IsNullOrWhiteSpace(value.ToString())) { currentValue = new HierarchyNode(vsSolution, value.ToString()); } using (HierarchyNode newValue = EditValue(provider, root, currentValue)) { if (newValue != null) { return newValue.UniqueName; } } } //Thrown if Project doesn't exist on solution catch (InvalidOperationException) { } //Thrown if Project doesn't exist on solution catch (COMException) { } catch (ServiceMissingException) { throw ;} catch (Exception e) { VSShellHelper.ShowErrorDialog(provider, e.Message); } finally { if (root != null) root.Dispose(); if (currentValue != null) currentValue.Dispose(); } return string.Empty; }