本文整理汇总了C#中XCore.List.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# List.ToArray方法的具体用法?C# List.ToArray怎么用?C# List.ToArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XCore.List
的用法示例。
在下文中一共展示了List.ToArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: GetLastRunInfoForCheck
/// ------------------------------------------------------------------------------------
/// <summary>
/// Gets the earliest date and time the specified check was run.
/// </summary>
/// ------------------------------------------------------------------------------------
private DateTime GetLastRunInfoForCheck(Guid checkId, out string[] bookChkInfo)
{
List<string> bookChkInfoList = new List<string>();
bookChkInfo = new string[] { };
if (m_bookFilter.BookIds == null)
return DateTime.MinValue;
FdoOwningSequence<IScrBookAnnotations> booksAnnotations =
m_cache.LangProject.TranslatedScriptureOA.BookAnnotationsOS;
string fmtTip =
TeResourceHelper.GetResourceString("kstidScrChecksTreeNodeTipFormat");
string fmtLastRunDate =
TeResourceHelper.GetResourceString("kstidScrCheckRunDateTimeFormat");
string fmtLastRunNever =
TeResourceHelper.GetResourceString("kstidScrCheckNeverRunMsg");
DateTime overallLastRun = DateTime.MaxValue;
// Go through the books in the filter.
foreach (int bookId in m_bookFilter.BookIds)
{
DateTime lastRun = DateTime.MinValue;
string lastRunText = fmtLastRunNever;
IScrBookAnnotations annotations = booksAnnotations[bookId - 1];
// Is there any history of this check having been run on this book?
if (annotations.ChkHistRecsOC.Count == 0)
overallLastRun = DateTime.MinValue;
else
{
// Go through the records of each time this test was run for
// this book and get the date and time of the last run. While
// finding that time, also keep track of the earliest time the
// check was run for all books.
foreach (ScrCheckRun scr in annotations.ChkHistRecsOC)
{
if (scr.CheckId == checkId)
{
if (overallLastRun > scr.RunDate && overallLastRun != DateTime.MinValue)
overallLastRun = scr.RunDate;
if (lastRun < scr.RunDate)
lastRun = scr.RunDate;
}
}
if (lastRun > DateTime.MinValue)
lastRunText = string.Format(fmtLastRunDate, lastRun);
}
bookChkInfoList.Add(string.Format(fmtTip,
m_bookFilter.GetBookByOrd(bookId).BestUIName, lastRunText));
}
bookChkInfo = bookChkInfoList.ToArray();
return (overallLastRun == DateTime.MaxValue ? DateTime.MinValue : overallLastRun);
}
示例3: GetItems
/// <summary>
/// Get the items to be compared against the filter.
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
protected override int[] GetItems(ManyOnePathSortItem item)
{
ISilDataAccess sda = m_cache.MainCacheAccessor;
List<int> results = new List<int>();
if (item.PathLength > 0 && item.PathFlid(0) == kflidMsas)
{
// sorted by MSA, match just the one MSA.
// I don't think this path can occur with the current XML spec where this is used.
int hvoMsa;
if (item.PathLength > 1)
hvoMsa = item.PathObject(1);
else
hvoMsa = item.KeyObject;
GetItemsForMsaType(sda, ref results, hvoMsa);
}
else if (item.PathLength >= 1 && item.PathFlid(0) == kflidEntrySenses)
{
// sorted in a way that shows one sense per row, test that sense's MSA.
int hvoSense;
if (item.PathLength > 1)
hvoSense = item.PathObject(1);
else
hvoSense = item.KeyObject;
int hvoMsa = sda.get_ObjectProp(hvoSense, (int)LexSense.LexSenseTags.kflidMorphoSyntaxAnalysis);
GetItemsForMsaType(sda, ref results, hvoMsa);
}
else
{
int hvoEntry = item.RootObject.Hvo;
int cmsa = sda.get_VecSize(hvoEntry, kflidMsas);
for (int imsa = 0; imsa < cmsa; imsa++)
{
int hvoMsa = sda.get_VecItem(hvoEntry, kflidMsas, imsa);
GetItemsForMsaType(sda, ref results, hvoMsa);
}
}
return results.ToArray();
}
示例4: 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;
}
示例5: SetNewOccurrencesOfWordforms
private void SetNewOccurrencesOfWordforms(ProgressDialogWorkingOn progress)
{
Set<int> changes = new Set<int>();
foreach (ParaChangeInfo info in m_changedParas.Values)
{
changes.AddRange(info.Changes);
}
if (AllChanged)
{
m_newOccurrencesOldWf = new int[0]; // no remaining occurrences
}
else
{
// Only some changed, need to figure m_newOccurrences
List<int> newOccurrencesOldWf = new List<int>();
foreach (int hvo in OldOccurrencesOfOldWordform)
{
//The offsets of our occurrences have almost certainly changed.
//Update them so that the respelling dialog view will appear correct.
var occur = RespellSda.OccurrenceFromHvo(hvo) as LocatedAnalysisOccurrence;
if (occur != null)
{
occur.ResetSegmentOffsets();
}
if (!changes.Contains(hvo))
{
newOccurrencesOldWf.Add(hvo);
}
}
m_newOccurrencesOldWf = newOccurrencesOldWf.ToArray();
}
UpdateProgress(progress);
List<int> newOccurrences = new List<int>(m_oldOccurrencesNewWf.Length + changes.Count);
newOccurrences.AddRange(m_oldOccurrencesNewWf);
newOccurrences.AddRange(changes);
m_newOccurrencesNewWf = newOccurrences.ToArray();
RespellSda.ReplaceOccurrences(OldWordform, m_newOccurrencesOldWf);
RespellSda.ReplaceOccurrences(NewWordform, m_newOccurrencesNewWf);
SendCountVirtualPropChanged(NewWordform);
SendCountVirtualPropChanged(OldWordform);
}
示例6: GetMessageTargets
/// ------------------------------------------------------------------------------------
/// <summary>
/// Gets the message targets.
/// </summary>
/// <returns></returns>
/// ------------------------------------------------------------------------------------
public IxCoreColleague[] GetMessageTargets()
{
CheckDisposed();
// return list of view windows with focused window being the first one
List<IxCoreColleague> targets = new List<IxCoreColleague>();
foreach (RootSiteGroup group in m_groups)
{
foreach (IRootSiteSlave slave in group.Slaves)
{
if (slave is IxCoreColleague &&
(((Control)slave).Contains((Control)FocusedRootSite) || slave == FocusedRootSite))
{
targets.AddRange(((IxCoreColleague)slave).GetMessageTargets());
break;
}
}
}
targets.Add(this);
return targets.ToArray();
}
示例7: ResetSlotCombo
/// <summary>
/// Reset the slot combo box.
/// </summary>
private void ResetSlotCombo()
{
m_fwcbSlots.SuspendLayout();
m_fwcbSlots.Items.Clear();
int matchIdx = -1;
if (m_selectedMainPOS != null)
{
// Cache items to add, which prevents prop changed being called for each add. (Fixes FWR-3083)
List<HvoTssComboItem> itemsToAdd = new List<HvoTssComboItem>();
foreach (var slot in GetSlots())
{
string name = slot.Name.BestAnalysisAlternative.Text;
if (name != null && name.Length > 0) // Don't add empty strings.
{
HvoTssComboItem newItem = new HvoTssComboItem(slot.Hvo,
m_tsf.MakeString(name, m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle));
itemsToAdd.Add(newItem);
if (m_selectedSlot != null && m_selectedSlot.Hvo == newItem.Hvo)
matchIdx = itemsToAdd.Count - 1;
}
}
m_fwcbSlots.Items.AddRange(itemsToAdd.ToArray());
}
if (matchIdx == -1)
{
m_fwcbSlots.SelectedIndex = -1;
m_selectedSlot = null; // if the current proposed slot isn't possible for the POS, forget it.
}
else
{
try
{
m_skipEvents = true;
m_fwcbSlots.SelectedIndex = matchIdx;
}
finally
{
m_skipEvents = false;
}
}
m_fwcbSlots.Enabled = m_fwcbSlots.Items.Count > 0;
m_lSLots.Enabled = m_fwcbSlots.Enabled;
m_fwcbSlots.ResumeLayout();
}
示例8: MakePropertyArrayForSerializing
private Property[] MakePropertyArrayForSerializing(string settingsId, string[] omitSettingIds)
{
if (!Monitor.TryEnter(m_properties))
{
TraceVerboseLine(">>>>>>>***** colision: <i> ********<<<<<<<<<<<");
Monitor.Enter(m_properties);
}
List<Property> list = new List<Property>(m_properties.Count);
foreach (KeyValuePair<string, Property> kvp in m_properties)
{
Property property = kvp.Value;
if (!property.doPersist)
continue;
if (!property.name.StartsWith(GetPathPrefixForSettingsId(settingsId)))
continue;
bool fIncludeThis = true;
foreach (string omitSettingsId in omitSettingIds)
{
if (property.name.StartsWith(GetPathPrefixForSettingsId(omitSettingsId)))
{
fIncludeThis = false;
break;
}
}
if (fIncludeThis)
list.Add(property);
}
Monitor.Exit(m_properties);
return list.ToArray();
}
示例9: GetMessageTargets
/// ------------------------------------------------------------------------------------
/// <summary>
/// Get the possible message targets, i.e. the view(s) we are showing
/// </summary>
/// <returns>Message targets</returns>
/// ------------------------------------------------------------------------------------
public IxCoreColleague[] GetMessageTargets()
{
CheckDisposed();
// return list of view windows with focused window being the first one
List<IxCoreColleague> targets = new List<IxCoreColleague>();
foreach (Control control in m_rgClientViews.Values)
{
IxCoreColleague view = control as IxCoreColleague;
if (view != null && control != null)
{
if (control.Focused || control == ActiveView)
targets.InsertRange(0, view.GetMessageTargets());
else if (control.Visible || control.ContainsFocus)
targets.AddRange(view.GetMessageTargets());
}
}
targets.Add(this);
return targets.ToArray();
}
示例10: 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()
{
CheckDisposed();
Control first = FirstControl;
if (first != null && first.FindForm() == null)
first = null;
Control second = SecondControl;
if (second != null && second.FindForm() == null)
second = null;
var targets = new List<IxCoreColleague> {this};
if (m_prioritySecond)
{
if (first != null)
targets.Insert(0, first as IxCoreColleague);
if (second != null)
targets.Insert(0, second as IxCoreColleague);
}
else
{
if (second != null)
targets.Insert(0, second as IxCoreColleague);
if (first != null)
targets.Insert(0, first as IxCoreColleague);
}
return targets.ToArray();
}
示例11: MakeSliceContextMenu
protected ContextMenu MakeSliceContextMenu(Slice slice, bool fHotLinkOnly)//, bool retrieveDoNotShow)
{
XmlNode configuration =slice.ConfigurationNode;
XmlNode caller = slice.CallerNode;
string menuId = null;
if (caller != null)
menuId = ShowContextMenu2Id(caller, fHotLinkOnly);
if (menuId == null || menuId.Length == 0)
menuId = ShowContextMenu2Id(configuration, fHotLinkOnly);
XWindow window = (XWindow)m_mediator.PropertyTable.GetValue("window");
//an empty menu attribute means no menu
if (menuId != null && menuId.Length== 0)
return null;
/* //a missing menu attribute means "figure out a default"
if (menuId == null)
{
//todo: this is probably too simplistic
//we are trying to select out just atomic objects
//of this will currently also select "place keeping" nodes
if(slice.IsObjectNode)
// configuration.HasChildNodes /*<-- that's dumb
// && configuration.SelectSingleNode("seq")== null
// && !(e.Slice.Object.Hvo == slice.Container.RootObjectHvo))
{
menuId="mnuDataTree-Object";
}
else //we could not figure out a default menu for this item, so fall back on the auto menu
{ //todo: this must not be used in the final product!
// return m_dataEntryForm.GetAutoMenu(sender, e);
return null;
}
}
if (menuId == "")
return null; //explicitly stated that there should not be a menu
*/
//ChoiceGroup group;
if(fHotLinkOnly)
{
return window.GetWindowsFormsContextMenu(menuId);
}
else
{
//string[] menus = new string[2];
List<string> menus = new List<string>();
menus.Add(menuId);
if (slice is MultiStringSlice)
menus.Add("mnuDataTree-MultiStringSlice");
else
menus.Add("mnuDataTree-Object");
window.ShowContextMenu(menus.ToArray(),
new Point(Cursor.Position.X, Cursor.Position.Y),
null, // Don't care about a temporary colleague
null); // or MessageSequencer
return null;
}
// group.ConfigurationNode.AppendChild(group.ConfigurationNode.OwnerDocument.ImportNode(addon,true));
// This causes the menu to be actually populated with the items. It's a rather
// ugly way to do it...happens all over again when the menu pops up...but we
// need to know the actual items for various purposes, such as populating a
// summary slice's command list. Refactoring is complicated because part of
// the code is in a DotNetBar UiAdapter class that I can't easily modify.
// group.OnDisplay(null, new EventArgs());
// return menu;
}
示例12: 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()
{
CheckDisposed();
//note: we just let navigation commands go straight to the clerk, which will then send us a message.
/*
* important note about messages and record clerk: see the top of the recordClerk.cs file.
*/
List<IxCoreColleague> targets = new List<IxCoreColleague>();
// HACK: This needs to be controlled better, since this method is being called,
// while the object is being disposed, which causes the call to the Clerk property to crash
// with a null reference exception on the mediator.
if (m_mediator != null)
{
// Additional targets are typically child windows that should have a chance to intercept
// messages before the Clerk sees them.
targets.AddRange(GetMessageAdditionalTargets());
targets.Add(Clerk);
targets.Add(this);
}
return targets.ToArray();
}
示例13: CreateSummaryView
/// ------------------------------------------------------------------------------------
/// <summary>
/// Create a view with multiple LexEntry objects.
/// </summary>
/// <param name="rghvoEntries"></param>
/// <param name="cache"></param>
/// <param name="styleSheet"></param>
/// <returns></returns>
/// ------------------------------------------------------------------------------------
private XmlView CreateSummaryView(List<int> rghvoEntries, FdoCache cache, IVwStylesheet styleSheet)
{
// Make a decorator to publish the list of entries as a fake property of the LexDb.
int kflidEntriesFound = 8999950; // some arbitrary number not conflicting with real flids.
var sda = new ObjectListPublisher(cache.DomainDataByFlid as ISilDataAccessManaged, kflidEntriesFound);
int hvoRoot = RootHvo;
sda.CacheVecProp(hvoRoot, rghvoEntries.ToArray());
//TODO: Make this method return a GeckoBrowser control, and generate the content here.
// The name of this property must match the property used by the publishFound layout.
sda.SetOwningPropInfo(LexDbTags.kflidClass, "LexDb", "EntriesFound");
// Make an XmlView which displays that object using the specified layout.
XmlView xv = new XmlView(hvoRoot, "publishFound", null, false, sda);
xv.Cache = cache;
xv.Mediator = m_mediator;
xv.StyleSheet = styleSheet;
return xv;
}
示例14: TryParseGenDate
private bool TryParseGenDate(string sData, List<string> rgsFmt, out GenDate gdt)
{
GenDate.PrecisionType prec = GenDate.PrecisionType.Exact;
if (sData[0] == '~')
{
prec = GenDate.PrecisionType.Approximate;
sData = sData.Substring(1).Trim();
}
else if (sData[0] == '<')
{
prec = GenDate.PrecisionType.Before;
sData = sData.Substring(1).Trim();
}
else if (sData[0] == '>')
{
prec = GenDate.PrecisionType.After;
sData = sData.Substring(1).Trim();
}
if (sData.Length == 0)
{
gdt = new GenDate();
return false;
}
int year = 0;
bool fAD = true;
DateTime dt;
if (DateTime.TryParseExact(sData, rgsFmt.ToArray(), null, DateTimeStyles.None, out dt))
{
if (dt.Year > 0)
{
year = dt.Year;
}
else
{
year = -dt.Year;
fAD = false;
}
gdt = new GenDate(prec, dt.Month, dt.Day, year, fAD);
return true;
}
foreach (string sFmt in rgsFmt)
{
GenDateInfo gdi;
string sResidue = ParseFormattedDate(sData, sFmt, out gdi);
if (!gdi.error)
{
year = gdi.year;
if (prec == GenDate.PrecisionType.Exact)
{
if (sResidue.Trim().StartsWith("?"))
prec = GenDate.PrecisionType.Approximate;
else
prec = gdi.prec;
}
if (year < 0)
{
year = -year;
fAD = false;
}
gdt = new GenDate(prec, gdi.ymon, gdi.mday, year, fAD);
return true;
}
}
gdt = new GenDate();
return false;
}
示例15: ResetMatches
/// <summary>
/// Reset the list of matching items.
/// </summary>
/// <param name="searchKey"></param>
protected override void ResetMatches(string searchKey)
{
Cursor = Cursors.WaitCursor;
try
{
if (m_oldSearchKey == searchKey)
return; // Nothing new to do, so skip it.
else
btnOK.Enabled = false; // disable Go button until we rebuild our match list.
m_oldSearchKey = searchKey;
List<ExtantWfiWordformInfo> matches = ExtantWfiWordformInfo.ExtantWordformInfo(m_cache, searchKey,
StringUtils.GetWsAtOffset(m_tbForm.Tss, 0));
this.matchingEntries.SuspendLayout();
List<int> rghvo = new List<int>(matches.Count);
foreach (ExtantWfiWordformInfo match in matches)
{
bool isFiltered = false;
foreach (ExtantWfiWordformInfo ewi in m_filteredEntries)
{
if (match.ID == ewi.ID)
{
isFiltered = true;
break;
}
}
if (!isFiltered)
rghvo.Add(match.ID);
}
(Clerk as MatchingItemsRecordClerk).UpdateList(rghvo.ToArray());
this.matchingEntries.ResumeLayout(true);
if (rghvo.Count == 0)
{
(this.matchingEntries as BrowseViewer).SelectedIndex = -1;
m_selEntryID = 0;
}
else
{
(this.matchingEntries as BrowseViewer).SelectedIndex = Clerk.CurrentIndex;
m_selEntryID = Clerk.CurrentObject.Hvo;
//RaiseSelectionChanged();
//RaiseRestoreFocus();
}
this.matchingEntries.TabStop = rghvo.Count > 0;
btnOK.Enabled = (m_selEntryID > 0);
}
finally
{
matchingEntries_RestoreFocus(null, null);
Cursor = Cursors.Default;
}
}