private void backgroundWorkerContexts_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.buttonLogin.Enabled = true; this.listViewViews.Items.Clear(); ResponseContext response = e.Result as ResponseContext; if (response == null) { return; } foreach (IfdContext ifdContext in response.IfdContext) { ListViewItem lvi = new ListViewItem(); lvi.Tag = ifdContext; if (ifdContext.fullNames != null && ifdContext.fullNames.Length > 0) { string name = ifdContext.fullNames[0].name; // fallback on first name returned // for now, hard-code to english ... todo: configure foreach (IfdName ifdName in ifdContext.fullNames) { if (ifdName.language.languageCode == "en" && ifdName.nameType == "FULLNAME") { name = ifdName.name; } } lvi.Text = name; // version lvi.SubItems.Add(ifdContext.versionId); // version date lvi.SubItems.Add(ifdContext.versionDate); // version date lvi.SubItems.Add(ifdContext.status); string access = ""; if (ifdContext.restricted) { access = "Restricted"; } else if (ifdContext.readOnly) { access = "Read-Only"; } else { access = "Read/Write"; } lvi.SubItems.Add(access); this.listViewViews.Items.Add(lvi); } // how to deal with contexts without names? don't add them for now } }
private void backgroundWorkerContexts_DoWork(object sender, DoWorkEventArgs e) { ResponseContext response = DataDictionary.GetContexts(this.m_project, this.backgroundWorkerContexts, this.textBoxUrl.Text, this.textBoxUsername.Text, this.textBoxPassword.Text); e.Result = response; }