Chorus Send/Receive

August 26, 2009

Using Chorus to download a project in your application

Filed under: Chorus — hattonjohn @ 12:52 pm

(Chorus is an open-source version control porcelain (over Mercurial plumbing) designed to enable workflows appropriate for typical language development teams who are geographically distributed.  Chorus is designed to be integrated into other applications, and installed with their installers.  This blog is the third in which I describe what an application developer needs to do to incorporate Chorus.)

Last time, I showed how it’s easy to let Chorus deal with finding USB keys, find projects on then, and get a clone to the user’s computer.  This time, we’ll see that you do about the same thing on your end, but the user gets a different dialog.   For some context, here’s a portion of WeSay “Welcome” screen:

2009-08-26_15-34-36-979

 

Here’s the code WeSay runs when the user clicks the “Get from Internet”:

private void OnGetFromInternet(object sender, LinkLabelLinkClickedEventArgs e)
{
   using (var dlg = new Chorus.UI.Clone.GetCloneFromInternetDialog(WeSay.Project.WeSayWordsProject.NewProjectDirectory))
    {
        if (DialogResult.Cancel == dlg.ShowDialog())
            return;
        OpenSpecifiedProject(dlg.PathToNewProject);
    }
}

And here’s what Chorus puts up in response:

2009-08-26_15-38-22-518

This dialog has a lot of code to help the user over many of the little things that can go wrong, but with the URL and the intended destination.  When you type in a valid URL, a destination folder is filled in for you,  and it tells you if there is already a folder with that name there:

2009-08-26_15-40-35-056

Once everybody is happy, the “Download” button is enabled:

2009-08-26_15-41-33-816

And clicking it starts the download:

2009-08-26_15-41-42-560

2009-08-26_15-42-05-584

 

 

 

If something goes wrong, the dialog will attempt to interpret some common network errors to help the user figure out the problem:

2009-08-26_15-49-50-906

 

Final Notes

Chorus enters the URL that was used in the .hgrc file of the downloaded project, so when the user goes to sync, the location is presented to the user as the place they probably want to synchronize with.

Not shown here, because I haven’t done anything about it yet, is user names and passwords.  For the moment, these can just be embedded in the URL in the usual way:  http://john_hatton:mypassword@hg-public.languagedepot.org.

Advertisement

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.