Пример #1
0
        public RepositoryView(ExploreView exploreView, ICredentialsProvider credentialsProvider)
        {
            this.exploreView         = exploreView;
            menu                     = new RepositoryMenu(exploreView);
            this.credentialsProvider = credentialsProvider;

            // setup main column with image/text data
            TreeViewColumn     column = new TreeViewColumn();
            CellRendererText   crt    = new CellRendererText();
            CellRendererPixbuf crp    = new CellRendererPixbuf();

            column.Title = "Repository";
            column.PackStart(crp, false);
            column.PackStart(crt, true);
            column.AddAttribute(crp, "pixbuf", 0);
            column.AddAttribute(crt, "text", 1);
            column.SetCellDataFunc(crt, new Gtk.TreeCellDataFunc(RenderRepositoryName));
            AppendColumn(column);

            WorkspaceInfo[] infos = Workstation.Current.GetAllLocalWorkspaceInfo();
            foreach (WorkspaceInfo info in infos)
            {
                ICredentials         credentials = credentialsProvider.GetCredentials(info.ServerUri, null);
                TeamFoundationServer tfs         = TeamFoundationServerFactory.GetServer(info.ServerUri.ToString(), credentials);
                VersionControlServer vcs         = tfs.GetService(typeof(VersionControlServer)) as VersionControlServer;

                Workspace workspace = vcs.GetWorkspace(info.Name, info.OwnerName);
                workspace.RefreshMappings();

                string       label      = String.Format("{0}@{1}", info.Name, info.ServerUri.Host.ToString());
                Gtk.TreeIter serverIter = store.AppendValues(Images.Repository, label, info.ServerUri.ToString(), VersionControlPath.RootFolder, workspace, true);
                store.AppendValues(serverIter, null, "", "", "", null, true);
            }

            Model            = store;
            HeadersVisible   = true;
            KeyReleaseEvent += MyKeyReleaseEventHandler;

            ShowAll();
        }
Пример #2
0
        public RepositoryView(ExploreView exploreView, ICredentialsProvider credentialsProvider)
        {
            this.exploreView = exploreView;
                menu = new RepositoryMenu(exploreView);
                this.credentialsProvider = credentialsProvider;

                // setup main column with image/text data
                TreeViewColumn column = new TreeViewColumn ();
                CellRendererText crt = new CellRendererText();
                CellRendererPixbuf crp = new CellRendererPixbuf();
                column.Title = "Repository";
                column.PackStart(crp, false);
                column.PackStart(crt, true);
                column.AddAttribute(crp, "pixbuf", 0);
                column.AddAttribute(crt, "text", 1);
                column.SetCellDataFunc(crt, new Gtk.TreeCellDataFunc (RenderRepositoryName));
                AppendColumn(column);

                WorkspaceInfo[] infos = Workstation.Current.GetAllLocalWorkspaceInfo();
                foreach (WorkspaceInfo info in infos)
                    {
                        ICredentials credentials = credentialsProvider.GetCredentials(info.ServerUri, null);
                        TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(info.ServerUri.ToString(), credentials);
                        VersionControlServer vcs = tfs.GetService(typeof(VersionControlServer)) as VersionControlServer;

                        Workspace workspace = vcs.GetWorkspace(info.Name, info.OwnerName);
                        workspace.RefreshMappings();

                        string label = String.Format("{0}@{1}", info.Name, info.ServerUri.Host.ToString());
                        Gtk.TreeIter serverIter = store.AppendValues(Images.Repository, label, info.ServerUri.ToString(), VersionControlPath.RootFolder, workspace, true);
                        store.AppendValues(serverIter, null, "", "", "", null, true);
                    }

                Model = store;
                HeadersVisible = true;
                KeyReleaseEvent += MyKeyReleaseEventHandler;

                ShowAll();
        }