本文整理汇总了C#中XCore.List.Add方法的典型用法代码示例。如果您正苦于以下问题:C# List.Add方法的具体用法?C# List.Add怎么用?C# List.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XCore.List
的用法示例。
在下文中一共展示了List.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadDataFromInventory
/// <summary>
/// Get protected and user-stored dictionary configurations to load into the dialog.
/// Tests will override this to load the manager in their own fashion.
/// </summary>
private void LoadDataFromInventory(XmlNode current)
{
// Tuples are <uniqueCode, dispName, IsProtected>
var configList = new List<Tuple<string, string, bool>>();
// put them in configList and feed them into the Manager's dictionary.
foreach (var xnView in m_originalViewConfigNodes)
{
var sLabel = XmlUtils.GetManditoryAttributeValue(xnView, "label");
var sLayout = XmlUtils.GetManditoryAttributeValue(xnView, "layout");
var fProtected = !sLayout.Contains(Inventory.kcMarkLayoutCopy);
configList.Add(new Tuple<string, string, bool>(sLayout, sLabel, fProtected));
}
LoadInternalDictionary(configList);
var sLayoutCurrent = XmlUtils.GetManditoryAttributeValue(current, "layout");
m_originalView = sLayoutCurrent;
m_currentView = m_originalView;
if (m_configList.Count == 0)
return;
// Now set up the actual dialog's contents
RefreshView();
}
示例2: PossibilityAutoComplete
public PossibilityAutoComplete(FdoCache cache, Mediator mediator, ICmPossibilityList list, Control control,
string displayNameProperty, string displayWs)
{
m_cache = cache;
m_mediator = mediator;
m_control = control;
m_displayNameProperty = displayNameProperty;
m_displayWs = displayWs;
m_listBox = new ComboListBox {DropDownStyle = ComboBoxStyle.DropDownList, ActivateOnShow = false};
m_listBox.SelectedIndexChanged += HandleSelectedIndexChanged;
m_listBox.SameItemSelected += HandleSameItemSelected;
m_listBox.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);
m_listBox.WritingSystemFactory = cache.WritingSystemFactory;
m_searcher = new StringSearcher<ICmPossibility>(SearchType.Prefix, cache.ServiceLocator.WritingSystemManager);
m_possibilities = new List<ICmPossibility>();
var stack = new Stack<ICmPossibility>(list.PossibilitiesOS);
while (stack.Count > 0)
{
ICmPossibility poss = stack.Pop();
m_possibilities.Add(poss);
foreach (ICmPossibility child in poss.SubPossibilitiesOS)
stack.Push(child);
}
m_control.KeyDown += HandleKeyDown;
m_control.KeyPress += HandleKeyPress;
}
示例3: GetMessageTargets
/// <summary>
/// return an array of all of the objects which should
/// 1) be queried when looking for someone to deliver a message to
/// 2) be potential recipients of a broadcast
/// </summary>
/// <returns></returns>
public IxCoreColleague[] GetMessageTargets()
{
List<IxCoreColleague> colleagues = new List<IxCoreColleague>();
colleagues.Add(this);
// Add current FindComboFiller & UsedByFiller.
// Those
return colleagues.ToArray();
}
示例4: PopulateCtrlTabTargetCandidateList
public Control PopulateCtrlTabTargetCandidateList(List<Control> targetCandidates)
{
CheckDisposed();
if (targetCandidates == null)
throw new ArgumentNullException("targetCandidates");
targetCandidates.Add(this);
return ContainsFocus ? this : null;
}
示例5: PopulateCtrlTabTargetCandidateList
public Control PopulateCtrlTabTargetCandidateList(List<Control> targetCandidates)
{
if (targetCandidates == null)
throw new ArgumentNullException("'targetCandidates' is null.");
targetCandidates.Add(this);
return ContainsFocus ? this : null;
}
示例6: InitMacro_SurvivesTooManyMacros
public void InitMacro_SurvivesTooManyMacros()
{
var ml = new MacroListener();
var macroImplementors = new List<IFlexMacro>();
for (int i = 0; i < 20; i++)
macroImplementors.Add(new MacroF4());
var macros = ml.AssignMacrosToSlots(macroImplementors);
Assert.That(macros[0], Is.EqualTo(macroImplementors[1])); // first free slot gets the second one
Assert.That(macros[2], Is.EqualTo(macroImplementors[0])); // first one that wants to be a F4
Assert.That(macros[1], Is.EqualTo(macroImplementors[2])); // can't put where it wants to be, put it in next free slot.
Assert.That(macros[3], Is.EqualTo(macroImplementors[3])); // from here on they line up.
}
示例7: GatherPartsOfSpeech
/// <summary>
/// Traverse a tree of objects.
/// Put the appropriate descendant identifiers into collector.
/// </summary>
/// <param name="cache">data access to retrieve info</param>
/// <param name="rootHvo">starting object</param>
/// <param name="rootFlid">the children of rootHvo are in this property.</param>
/// <param name="subFlid">grandchildren and great...grandchildren are in this one</param>
/// <param name="itemFlid">want children where this is non-empty in the collector</param>
/// <param name="flidName">multistring prop to get name of item from</param>
/// <param name="wsName">multistring writing system to get name of item from</param>
/// <param name="collector">Add for each item an HvoTreeNode with the name and id of the item.</param>
internal static void GatherPartsOfSpeech(FdoCache cache,
int rootHvo, int rootFlid, int subFlid, int itemFlid, int flidName, int wsName, List<HvoTreeNode> collector)
{
ISilDataAccess sda = cache.MainCacheAccessor;
int chvo = sda.get_VecSize(rootHvo, rootFlid);
for (int ihvo = 0; ihvo < chvo; ihvo++)
{
int hvoItem = sda.get_VecItem(rootHvo, rootFlid, ihvo);
if (sda.get_VecSize(hvoItem, itemFlid) > 0)
{
ITsString tssLabel = GetTssLabel(cache, hvoItem, flidName, wsName);
collector.Add(new HvoTreeNode(tssLabel, hvoItem));
}
GatherPartsOfSpeech(cache, hvoItem, subFlid, subFlid, itemFlid, flidName, wsName, collector);
}
}
示例8: GetControlsFromChoice
public List<ListView> GetControlsFromChoice(ListPropertyChoice choice)
{
List<ListView> controls = new List<ListView>();
if (choice.ParameterNode == null)
return null;
foreach(XmlNode panel in choice.ParameterNode.SelectNodes("panels/listPanel"))
{
string listId = XmlUtils.GetManditoryAttributeValue(panel, "listId");
string label = XmlUtils.GetManditoryAttributeValue(panel, "label");
ListView list = MakeList(listId, label);
controls.Add(list);
}
return controls;
}
示例9: FLExBridgeListener
static FLExBridgeListener()
{
OldLiftBridgeProjects = new List<string>();
var repoMapFile = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "LiftBridge"),
"LanguageProject_Repository_Map.xml");
// look for old liftbridge repo info in path similar to C:\Users\<user>\AppData\Local\LiftBridge\LanguageProject_Repository_Map.xml
if(File.Exists(repoMapFile))
{
var repoMapDoc = new XmlDocument();
repoMapDoc.Load(repoMapFile);
var mappingNodes = repoMapDoc.SelectNodes("//Mapping");
if(mappingNodes != null)
{
foreach(XmlElement mappingNode in mappingNodes)
{
OldLiftBridgeProjects.Add(mappingNode.Attributes["projectguid"].Value);
}
}
}
}
示例10: OnMoveReversalPOS
public bool OnMoveReversalPOS(object cmd)
{
FdoCache cache = Cache;
var labels = new List<ObjectLabel>();
foreach (IPartOfSpeech pos in MergeOrMoveCandidates)
{
if (!pos.SubPossibilitiesOS.Contains(POS))
{
labels.Add(ObjectLabel.CreateObjectLabelOnly(cache, pos, "ShortNameTSS", "best analysis"));
}
}
using (SimpleListChooser dlg = new SimpleListChooser(cache, null, m_mediator.HelpTopicProvider, labels, null,
LexEdStrings.ksCategoryToMoveTo, null))
{
dlg.SetHelpTopic("khtpChoose-CategoryToMoveTo");
if (dlg.ShowDialog() == DialogResult.OK)
{
IPartOfSpeech currentPOS = POS;
IPartOfSpeech newOwner = (IPartOfSpeech)dlg.ChosenOne.Object;
UndoableUnitOfWorkHelper.Do(LexEdStrings.ksUndoMoveRevCategory,
LexEdStrings.ksRedoMoveRevCategory, cache.ActionHandlerAccessor,
() =>
{
newOwner.MoveIfNeeded(currentPOS); //important when an item is moved into it's own subcategory
if (!newOwner.SubPossibilitiesOS.Contains(currentPOS)) //this is also prevented in the interface, but I'm paranoid
{
newOwner.SubPossibilitiesOS.Add(currentPOS);
}
});
// Note: PropChanged should happen on the old owner and the new in the 'Add" method call.
// Have to jump to a main PartOfSpeech, as RecordClerk doesn't know anything about subcategories.
m_mediator.BroadcastMessageUntilHandled("JumpToRecord", newOwner.MainPossibility.Hvo);
}
}
return true;
}
示例11: AddHvoPOStoResults
private static void AddHvoPOStoResults(ISilDataAccess sda, List<int> results, int hvoMsa, int flidPos)
{
int hvoPOS;
hvoPOS = sda.get_ObjectProp(hvoMsa, flidPos);
if (hvoPOS != 0)
results.Add(hvoPOS);
}
示例12: GetAnalysisOccurrences
/// <summary>
/// Get the occurrences of a particular analysis in the currently interesting texts.
/// </summary>
private int[] GetAnalysisOccurrences(int hvo, bool includeChildren)
{
int[] values;
if (m_values.TryGetValue(hvo, out values))
return values;
var analysis = (IAnalysis)m_services.GetObject(hvo);
var wf = analysis.Wordform;
var bag = wf.OccurrencesBag;
var valuesList = new List<int>(bag.Count);
foreach (var seg in from item in bag.Items where BelongsToInterestingText(item) select item)
{
foreach (var occurrence in seg.GetOccurrencesOfAnalysis(analysis, bag.Occurrences(seg), includeChildren))
{
var hvoOcc = m_nextId--;
valuesList.Add(hvoOcc);
m_occurrences[hvoOcc] = occurrence;
}
}
AddAdditionalOccurrences(hvo, m_occurrences, ref m_nextId, valuesList);
values = valuesList.ToArray();
m_values[hvo] = values;
return values;
}
示例13: OnMasterRefresh
/// <summary>
/// This is the one (and should be only) handler for the user Refresh command.
/// Refresh wants to first clean up the cache, then give things like Clerks a
/// chance to reload stuff (calling the old OnRefresh methods), then give
/// windows a chance to redisplay themselves.
/// </summary>
public void OnMasterRefresh(object sender)
{
// TODO: This is no longer called by the Mediator, since this class
// is no longer an xcore colleague. But, it can't be removed either,
// since it is used by another method on this clsss. :-(
CheckDisposed();
// Susanna asked that refresh affect only the currently active project, which is
// what the string and List variables below attempt to handle. See LT-6444.
FwXWindow activeWnd = ActiveForm as FwXWindow;
List<FwXWindow> rgxw = new List<FwXWindow>();
foreach (IFwMainWnd wnd in MainWindows)
{
FwXWindow xwnd = wnd as FwXWindow;
if (xwnd != null)
{
xwnd.PrepareToRefresh();
rgxw.Add(xwnd);
}
}
if (activeWnd != null)
rgxw.Remove(activeWnd);
foreach (FwXWindow xwnd in rgxw)
{
xwnd.FinishRefresh();
xwnd.Refresh();
}
// LT-3963: active window changes as a result of a refresh.
// Make sure focus doesn't switch to another FLEx application / window also
// make sure the application focus isn't lost all together.
// ALSO, after doing a refresh with just a single application / window,
// the application would loose focus and you'd have to click into it to
// get that back, this will reset that too.
if (activeWnd != null)
{
// Refresh it last, so its saved settings get restored.
activeWnd.FinishRefresh();
activeWnd.Refresh();
activeWnd.Activate();
}
}
示例14: HandleIncomingLink
public void HandleIncomingLink(FwLink link)
{
CheckDisposed();
FwXWindow fwxwnd = null;
string server = link.Server.Replace(".", Environment.MachineName);
// = FwLink.RestoreServerFromURL(link.Server).Replace(".", Environment.MachineName);
Debug.Assert(server != null && server != String.Empty);
string database = link.Database;
Debug.Assert(database != null && database != String.Empty);
string key = MakeKey(server, database);
if (!m_caches.ContainsKey(key))
{
// Add command line info.
Dictionary<string, List<String>> oldTable = m_commandLineArgs; // Save original args.
m_commandLineArgs = new Dictionary<string, List<String>>();
List<String> list = new List<String>();
list.Add(server);
m_commandLineArgs.Add("c", list);
list = new List<String>();
list.Add(database);
m_commandLineArgs.Add("db", list);
list = new List<String>();
list.Add(link.ToString());
m_commandLineArgs.Add("link", list);
Form frm = ActiveForm;
fwxwnd = (FwXWindow)NewMainWindow(null, false);
AdjustNewWindowPosition(fwxwnd, frm);
m_commandLineArgs = oldTable; // Restore oringinal args.
}
else
{
FdoCache cache = m_caches[key];
// Get window that uses the given DB.
foreach (FwXWindow wnd in m_rgMainWindows)
{
if (wnd.Cache == cache)
{
fwxwnd = wnd;
break;
}
}
}
fwxwnd.Mediator.SendMessage("FollowLink", link);
bool topmost = fwxwnd.TopMost;
fwxwnd.TopMost = true;
fwxwnd.TopMost = topmost;
fwxwnd.Activate();
}
示例15: m_btnDuplicate_Click
private void m_btnDuplicate_Click(object sender, EventArgs e)
{
Debug.Assert(m_current.Level > 0);
StoreNodeData(); // Ensure duplicate has current data.
LayoutTreeNode ltnDup = (LayoutTreeNode)m_current.Clone();
ltnDup.IsDuplicate = true;
// Generate a unique label to identify this as the n'th duplicate in the list.
List<string> rgsLabels = new List<string>();
string sBaseLabel = null;
for (int i = 0; i < m_current.Parent.Nodes.Count; ++i)
{
LayoutTreeNode ltn = (LayoutTreeNode)m_current.Parent.Nodes[i];
if (ltn.Configuration == m_current.Configuration &&
ltn.LayoutName == m_current.LayoutName &&
ltn.PartName == m_current.PartName)
{
rgsLabels.Add(ltn.Label);
if (!ltn.IsDuplicate)
sBaseLabel = ltn.Label;
}
}
if (sBaseLabel == null)
sBaseLabel = m_current.Label;
int cDup = 1;
string sLabel = String.Format("{0} ({1})", sBaseLabel, cDup);
while (rgsLabels.Contains(sLabel))
{
++cDup;
sLabel = String.Format("{0} ({1})", sBaseLabel, cDup);
}
ltnDup.Label = sLabel; // sets Text as well.
string sDup = ltnDup.DupString;
if (String.IsNullOrEmpty(sDup))
sDup = cDup.ToString();
else
sDup = String.Format("{0}-{1}", sDup, cDup);
ltnDup.DupString = sDup;
int idx = m_current.Index;
m_current.Parent.Nodes.Insert(idx + 1, ltnDup);
m_tvParts.SelectedNode = ltnDup;
}