Exemple #1
0
        public void Workspace_TryGetLocalItemForServerItem_PassValidItem()
        {
            string serverItem = Environment.GetEnvironmentVariable("TFS_PROJECT");
            string item1      = Path.Combine(Environment.CurrentDirectory, "foo.txt");
            string item2      = workspace.TryGetLocalItemForServerItem(String.Format("$/{0}/{1}", serverItem, "foo.txt"));

            Assert.AreEqual(item1, item2);
        }
        public WorkingFolderDialog(Workspace workspace, string serverPath)
            : base("Working Folder Mapping")
        {
            this.serverPath = serverPath;
                Table table = new Table(3, 3, false);
                table.RowSpacing = ((uint)(6));
                table.ColumnSpacing = ((uint)(6));
                table.BorderWidth = ((uint)(12));

                Label label = new Label("_Server Path: ");
                table.Attach(label, 0, 1, 1, 2);
                Label labelPath = new Label(serverPath);
                labelPath.Xalign = 0;
                table.Attach(labelPath, 1, 2, 1, 2);

                localPath = AddLabeledEntry(table, "_Local Path:", 2, 3);
                localPath.WidthChars = 32;

                browseButton = new Button("Browse...");
                table.Attach(browseButton, 2, 3, 2, 3);

                string lpath = workspace.TryGetLocalItemForServerItem(serverPath);
                if (!String.IsNullOrEmpty(lpath))
                    {
                        localPath.Text = lpath;
                        deleteButton = AddButton("Remove Mapping", ResponseType.Reject) as Button;
                    }

                VBox.Add(table);

                okButton = AddButton("OK", ResponseType.Ok) as Button;
                browseButton.Pressed += OnBrowseButtonPressed;

                AddCloseButton("Cancel");
                DefaultResponse = ResponseType.Ok;
                ShowAll();
        }