internal static string Open(ExtendedItem item, Microsoft.TeamFoundation.VersionControl.Client.Workspace workspace)
        {
            using (var dialog = new RenameDialog(item))
            {
                if (dialog.Run(Xwt.Toolkit.CurrentEngine.WrapWindow(MessageService.RootWindow)) == Command.Ok)
                {
                    using (var progress = VersionControlService.GetProgressMonitor("Undo", VersionControlOperationType.Pull))
                    {
                        progress.BeginTask("Rename", 1);
                        List<Failure> failures;
                        if (item.ItemType == Microsoft.TeamFoundation.VersionControl.Client.Enums.ItemType.File)
                            workspace.PendRenameFile(item.LocalItem, dialog.NewPath, out failures);
                        else
                            workspace.PendRenameFolder(item.LocalItem, dialog.NewPath, out failures);

                        if (failures != null && failures.Any(f => f.SeverityType == Microsoft.TeamFoundation.VersionControl.Client.Enums.SeverityType.Error))
                        {
                            progress.EndTask();
                            foreach (var failure in failures.Where(f => f.SeverityType == Microsoft.TeamFoundation.VersionControl.Client.Enums.SeverityType.Error))
                            {
                                progress.ReportError(failure.Code, new Exception(failure.Message));
                            }
                            return string.Empty;
                        }
                        progress.EndTask();
                        progress.ReportSuccess("Finish Undo");
                        return dialog.NewPath;
                    }
                }
                return string.Empty;
            }
        }
        //          <ExtendedItem lver="int" did="int" latest="int" type="Any or Folder or File" enc="int" itemid="int" local="string" titem="string" sitem="string" chg="None or Add or Edit or Encoding or Rename or Delete or Undelete or Branch or Merge or Lock or Rollback or SourceRename or Property" chgEx="int" ochg="boolean" lock="None or Checkin or CheckOut or Unchanged" lowner="string" lownerdisp="string" date="dateTime">
        //            <IsBranch>boolean</IsBranch>
        //            <PropertyValues xsi:nil="true" />
        //          </ExtendedItem>
        //        <s:complexType name="ExtendedItem">
        //            <s:sequence>
        //                <s:element minOccurs="0" maxOccurs="1" default="false" name="IsBranch" type="s:boolean"/>
        //                <s:element minOccurs="0" maxOccurs="1" name="PropertyValues" type="tns:ArrayOfPropertyValue"/>
        //            </s:sequence>
        //            <s:attribute default="0" name="lver" type="s:int"/>
        //            <s:attribute default="0" name="did" type="s:int"/>
        //            <s:attribute default="0" name="latest" type="s:int"/>
        //            <s:attribute default="Any" name="type" type="tns:ItemType"/>
        //            <s:attribute default="-3" name="enc" type="s:int"/>
        //            <s:attribute default="0" name="itemid" type="s:int"/>
        //            <s:attribute name="local" type="s:string"/>
        //            <s:attribute name="titem" type="s:string"/>
        //            <s:attribute name="sitem" type="s:string"/>
        //            <s:attribute default="None" name="chg" type="tns:ChangeType"/>
        //            <s:attribute default="0" name="chgEx" type="s:int"/>
        //            <s:attribute default="false" name="ochg" type="s:boolean"/>
        //            <s:attribute default="None" name="lock" type="tns:LockLevel"/>
        //            <s:attribute name="lowner" type="s:string"/>
        //            <s:attribute name="lownerdisp" type="s:string"/>
        //            <s:attribute name="date" type="s:dateTime" use="required"/>
        //        </s:complexType>
        internal static ExtendedItem FromXml(XElement element)
        {
            ExtendedItem item = new ExtendedItem
            {
                ChangeType            = ChangeType.None,
                VersionLocal          = 0,
                DeletionId            = 0,
                VersionLatest         = 0,
                ItemType              = ItemType.Any,
                Encoding              = -3,
                ItemId                = 0,
                HasOtherPendingChange = false,
                LockStatus            = LockLevel.None
            };

            item.ChangeType            = EnumHelper.ParseChangeType(element.GetAttribute("chg"));
            item.HasOtherPendingChange = GeneralHelper.XmlAttributeToBool(element.GetAttribute("ochg"));
            item.LockStatus            = EnumHelper.ParseLockLevel(element.GetAttribute("lock"));
            item.LockOwner             = element.GetAttribute("lowner");
            item.LocalItem             = TfsPath.ToPlatformPath(element.GetAttribute("local"));
            item.TargetServerItem      = element.GetAttribute("titem");
            item.SourceServerItem      = element.GetAttribute("sitem");
            item.ItemType      = EnumHelper.ParseItemType(element.GetAttribute("type"));
            item.ItemId        = GeneralHelper.XmlAttributeToInt(element.GetAttribute("itemid"));
            item.Encoding      = GeneralHelper.XmlAttributeToInt(element.GetAttribute("enc"));
            item.VersionLocal  = GeneralHelper.XmlAttributeToInt(element.GetAttribute("lver"));
            item.VersionLatest = GeneralHelper.XmlAttributeToInt(element.GetAttribute("latest"));
            item.DeletionId    = GeneralHelper.XmlAttributeToInt(element.GetAttribute("did"));
            item.CheckinDate   = GeneralHelper.XmlAttributeToDate(element.GetAttribute("date"));

            if (element.Element(XmlNamespaces.GetMessageElementName("IsBranch")) != null &&
                !string.IsNullOrEmpty(element.Element(XmlNamespaces.GetMessageElementName("IsBranch")).Value))
            {
                item.IsBranch = GeneralHelper.XmlAttributeToBool(element.Element(XmlNamespaces.GetMessageElementName("IsBranch")).Value);
            }

            return(item);
        }
        //          <ExtendedItem lver="int" did="int" latest="int" type="Any or Folder or File" enc="int" itemid="int" local="string" titem="string" sitem="string" chg="None or Add or Edit or Encoding or Rename or Delete or Undelete or Branch or Merge or Lock or Rollback or SourceRename or Property" chgEx="int" ochg="boolean" lock="None or Checkin or CheckOut or Unchanged" lowner="string" lownerdisp="string" date="dateTime">
        //            <IsBranch>boolean</IsBranch>
        //            <PropertyValues xsi:nil="true" />
        //          </ExtendedItem>
        //        <s:complexType name="ExtendedItem">
        //            <s:sequence>
        //                <s:element minOccurs="0" maxOccurs="1" default="false" name="IsBranch" type="s:boolean"/>
        //                <s:element minOccurs="0" maxOccurs="1" name="PropertyValues" type="tns:ArrayOfPropertyValue"/>
        //            </s:sequence>
        //            <s:attribute default="0" name="lver" type="s:int"/>
        //            <s:attribute default="0" name="did" type="s:int"/>
        //            <s:attribute default="0" name="latest" type="s:int"/>
        //            <s:attribute default="Any" name="type" type="tns:ItemType"/>
        //            <s:attribute default="-3" name="enc" type="s:int"/>
        //            <s:attribute default="0" name="itemid" type="s:int"/>
        //            <s:attribute name="local" type="s:string"/>
        //            <s:attribute name="titem" type="s:string"/>
        //            <s:attribute name="sitem" type="s:string"/>
        //            <s:attribute default="None" name="chg" type="tns:ChangeType"/>
        //            <s:attribute default="0" name="chgEx" type="s:int"/>
        //            <s:attribute default="false" name="ochg" type="s:boolean"/>
        //            <s:attribute default="None" name="lock" type="tns:LockLevel"/>
        //            <s:attribute name="lowner" type="s:string"/>
        //            <s:attribute name="lownerdisp" type="s:string"/>
        //            <s:attribute name="date" type="s:dateTime" use="required"/>
        //        </s:complexType>
        internal static ExtendedItem FromXml(XElement element)
        {
            ExtendedItem item = new ExtendedItem
            {
                ChangeType = ChangeType.None,
                VersionLocal = 0,
                DeletionId = 0,
                VersionLatest = 0,
                ItemType = ItemType.Any,
                Encoding = -3,
                ItemId = 0,
                HasOtherPendingChange = false,
                LockStatus = LockLevel.None
            };

            item.ChangeType = EnumHelper.ParseChangeType(element.GetAttribute("chg"));
            item.HasOtherPendingChange = GeneralHelper.XmlAttributeToBool(element.GetAttribute("ochg"));
            item.LockStatus = EnumHelper.ParseLockLevel(element.GetAttribute("lock"));
            item.LockOwner = element.GetAttribute("lowner");
            item.LocalItem = TfsPath.ToPlatformPath(element.GetAttribute("local"));
            item.TargetServerItem = element.GetAttribute("titem");
            item.SourceServerItem = element.GetAttribute("sitem");
            item.ItemType = EnumHelper.ParseItemType(element.GetAttribute("type"));
            item.ItemId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("itemid"));
            item.Encoding = GeneralHelper.XmlAttributeToInt(element.GetAttribute("enc"));
            item.VersionLocal = GeneralHelper.XmlAttributeToInt(element.GetAttribute("lver"));
            item.VersionLatest = GeneralHelper.XmlAttributeToInt(element.GetAttribute("latest"));
            item.DeletionId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("did"));
            item.CheckinDate = GeneralHelper.XmlAttributeToDate(element.GetAttribute("date"));

            if (element.Element(XmlNamespaces.GetMessageElementName("IsBranch")) != null &&
                !string.IsNullOrEmpty(element.Element(XmlNamespaces.GetMessageElementName("IsBranch")).Value))
                item.IsBranch = GeneralHelper.XmlAttributeToBool(element.Element(XmlNamespaces.GetMessageElementName("IsBranch")).Value);

            return item;
        }
 public RenameDialog(ExtendedItem item)
 {
     this.item = item;
     BuildGui();
 }