private void lists_ItemChecked(object sender, ItemCheckedEventArgs e) { // // Track selection of list mappings. Make sure the selected item is a ListListViewItem. // ListListViewItem item = e.Item as ListListViewItem; Debug.Assert(item != null); // // If checked, make sure the list definition is loaded and add it to the result context. // if (item.Checked) { if (!item.Loaded) { LoadList(item, true); } else { ctx.ResultContext.Lists.Add(item.List); // // Work available. Signal "can next" as true. // _next = true; if (StateChanged != null) { StateChanged(this, new EventArgs()); } // // Checking an item should cause it to get selected. // item.Selected = true; lists.Focus(); } } // // If unchecked, remove it from the result context. // else if (ctx.ResultContext.Lists.Contains(item.List)) { ctx.ResultContext.Lists.Remove(item.List); // // Work left to be done? If not signal "can next" as false. // if (ctx.ResultContext.Lists.Count == 0) { _next = false; if (StateChanged != null) { StateChanged(this, new EventArgs()); } } } }
/// <summary> /// Loads a list definition. /// </summary> /// <param name="item">List view item for the list mapping object to load the list definition for.</param> /// <param name="check">Indicates the list should be checked after loading or not.</param> private void LoadList(ListListViewItem item, bool check) { // // Load list in background. // OnWorking(); itemUpdating = item; checkListAfterLoad = check; bgList.RunWorkerAsync(item); }
private void lists_Enter(object sender, EventArgs e) { if (lists.SelectedItems.Count == 1) { ListListViewItem list = lists.SelectedItems[0] as ListListViewItem; Debug.Assert(list != null); properties.SelectedObject = list.List; } }
/// <summary> /// Loads a list definition. /// </summary> /// <param name="item">List view item for the list mapping object to load the list definition for.</param> /// <param name="check">Indicates the list should be checked after loading or not.</param> private void LoadList(ListListViewItem item, bool check) { // // Load list in background. // if (Working != null) { Working(this, new EventArgs()); } itemUpdating = item; checkListAfterLoad = check; bgList.RunWorkerAsync(item); }
private void bgList_DoWork(object sender, DoWorkEventArgs e) { // // Get worker invocation argument. // ListListViewItem item = e.Argument as ListListViewItem; Debug.Assert(item != null); // // Get the list object. // e.Result = Helpers.GetList(ctx.FullContext.Connection, item.List.Id.ToString()); }
private void DoListSelect() { // // Make sure an item has been selected; single-select mode should be on. // if (lists.SelectedItems.Count == 1) { // // Get the selected item; it should be of type ListListViewItem. // ListListViewItem item = lists.SelectedItems[0] as ListListViewItem; Debug.Assert(item != null); // // If list definition isn't loaded yet, load it now. // if (!item.Loaded) { // // Will happen asynchronously. The same event will be raised again, but item.Loaded will be true. // LoadList(item, false); } else { // // Show the fields. // fields.Items.Clear(); fields.Items.AddRange(item.Fields.ToArray()); fields.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.ColumnContent); // // Show properties for the list. // properties.SelectedObject = item.List; } } }