예제 #1
0
 private void ClearChecked()
 {
     foreach (var selectedField in SpContext.SelectedListItems)
     {
         foreach (var field in selectedField.Fields.Where(a => a.Selected))
         {
             field.Selected = false;
         }
     }
     CheckListSpLists.ClearSelected();
 }
예제 #2
0
        private void toolStripOpen_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            CheckListSpFields_ItemCheck_Disabled           = true;
            CheckListSpLists_SelectedIndexChanged_Disabled = true;
            if (openFile.ShowDialog
                    () == System.Windows.Forms.DialogResult.OK)
            {
                SaveUtils saveUtil            = new SaveUtils();
                var       loadedSelectedLists = saveUtil.OpenInfo(openFile.FileName);
                SpContext.NamespaceString = loadedSelectedLists.NamespaceString;
                SpContext.ModelFolder     = loadedSelectedLists.ModelFoler;
                SpContext.ContextName     = loadedSelectedLists.ContextName;
                ClearChecked();
                foreach (var info in loadedSelectedLists.SelectedListCollection)
                {
                    for (int i = 0; i < CheckListSpLists.Items.Count; i++)
                    {
                        var listItem = (List)((CheckListItem)CheckListSpLists.Items[i]).Value;
                        if (listItem.Id == info.ListGuid)
                        {
                            CheckListSpLists.SetItemChecked(i, true);
                            var loadedList = LoadListFromSp(listItem);
                            if (info.CheckedFieldGuids != null)
                            {
                                foreach (var fieldListItem in loadedList.Fields)
                                {
                                    if (info.CheckedFieldGuids.Contains(fieldListItem.Field.Id))
                                    {
                                        fieldListItem.Selected = true;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            CheckListSpFields_ItemCheck_Disabled           = false;
            CheckListSpLists_SelectedIndexChanged_Disabled = false;

            Cursor.Current = Cursors.Default;
        }