public CardsSampleViewModel() { Items = new ObservableCollection <object> { new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Red }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Green }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Gold }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Silver }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Blue } }; PanPositionChangedCommand = new Command(v => { var val = (bool)v; if (val) { CurrentIndex += 1; return; } CurrentIndex -= 1; }); RemoveCurrentItemCommand = new Command(() => { if (!Items.Any()) { return; } Items.RemoveAt(CurrentIndex.ToCyclingIndex(Items.Count)); }); }
public CardsSampleViewModel() { Items = new ObservableCollection <object> { new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Red }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Green }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Gold }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Silver }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Blue } }; PanPositionChangedCommand = new Command(v => { if (IsAutoAnimationRunning || IsUserInteractionRunning) { return; } var index = CurrentIndex + ((bool)v ? 1 : -1); if (index < 0 || index >= Items.Count) { return; } CurrentIndex = index; }); RemoveCurrentItemCommand = new Command(() => { if (!Items.Any()) { return; } Items.RemoveAt(CurrentIndex.ToCyclingIndex(Items.Count)); }); }
/// <summary> /// Prints the property status in the trace log. /// </summary> /// <remarks>For debugging purposes only.</remarks> private void PrintStatus() { DebugTrace("CurrentIndex=" + CurrentIndex.ToString()); DebugTrace("PageSize=" + PageSize.ToString()); DebugTrace("RecordCount=" + RecordCount.ToString()); DebugTrace("CurrentGroup=" + CurrentGroup.ToString()); }
/// <summary> /// Method to apply updated index files from master index to slave indexes /// </summary> /// <returns>Hashtable of updated indexes</returns> public Hashtable CopyAllFiles() { Hashtable htUpdates = new Hashtable(); bool bCopy = false; foreach (IndexSet idxSet in this._arIndexSet) { bCopy = false; if (idxSet.CurrentIndex != null && idxSet.CurrentIndex.CanCopy) { bCopy = idxSet.CurrentIndex.Copy(); } if (bCopy && !htUpdates.ContainsKey(idxSet.CurrentIndex.StatusDirectory)) { htUpdates.Add(idxSet.CurrentIndex.StatusDirectory, idxSet.CurrentIndex); } } foreach (DictionaryEntry de in htUpdates) { string sTargetDir = de.Key.ToString(); CurrentIndex ci = (CurrentIndex)de.Value; ci.UpdateRefresh(); } return(htUpdates); }
public ActionResult Index() { var model = new BestBetsViewModel(CurrentLanguage); foreach (KeyValuePair <string, string> language in Languages) { var name = language.Value; name = String.Concat(name.Substring(0, 1).ToUpper(), name.Substring(1)); var indexName = SwapLanguage(CurrentIndex, language.Key); model.BestBetsByLanguage.Add(new BestBetsByLanguage { LanguageName = name, LanguageId = language.Key, Indices = UniqueIndices, BestBets = GetBestBetsForLanguage(language.Key, indexName) }); } var config = ElasticSearchSection.GetConfiguration(); foreach (ContentSelectorConfiguration entry in config.ContentSelector) { model.SelectorTypes.Add(entry.Type.ToLower()); model.SelectorRoots.Add(new ContentReference(entry.Id, entry.Provider)); } var currentType = config.IndicesParsed.FirstOrDefault(i => CurrentIndex.StartsWith(i.Name, StringComparison.InvariantCultureIgnoreCase))?.Type; ViewBag.TypeName = !String.IsNullOrEmpty(currentType) ? Type.GetType(currentType)?.AssemblyQualifiedName : typeof(IndexItem).AssemblyQualifiedName; return(View("~/Views/ElasticSearchAdmin/BestBets/Index.cshtml", model)); }
private void label_Click(object sender, EventArgs e) { Label button = sender as Label; if (button != null) { button.BackColor = Color.White; } if (button.Tag != null) { if (Enum.TryParse <ResourceType>(button.Tag.ToString(), out App.ResourceType)) { Globals.ThisAddIn.RightWidget.CurrentIndex = 1; Globals.ThisAddIn.RightWidget.FilterText = textBox.Text; Globals.ThisAddIn.RightWidget.pageBox.Text = CurrentIndex.ToString(); Globals.ThisAddIn.RightWidget.updateRightLableText(); //Globals.ThisAddIn.RightWidget.ResetPageCount(); //Globals.ThisAddIn.RightWidget.UpdateResourceList(); } else { App.ResourceType = ResourceType.None; } //ResetButton(); } }
private void QueryButton_Click(object sender, EventArgs e) { CurrentIndex = 1; FilterText = textBox.Text; pageBox.Text = CurrentIndex.ToString(); UpdateResourceList(); }
private string RenderCurrent() { //string result = "<a class=\"" // + _CurrentPageCssClass + "\" href=\"{0}\" " // + GetAlternativeText(CurrentIndex) + " >" // + CurrentIndex.ToString() + "</a> "; string result = "<span class=\"" + _CurrentPageCssClass + "\"" + GetAlternativeText(CurrentIndex) + "><strong>" + CurrentIndex.ToString() + "</strong></span> "; if (_RenderAsTable) { result = "<td class=\"" + _CurrentPageCellCssClass + "\">" + result + "</td>"; } if (_PageURLFormat.Length > 0) { string templateURL = String.Format(PageURLFormat, (CurrentIndex).ToString()); return(String.Format( result, templateURL)); } return(result); }
protected Size Draw(ViewInfo view, int x, int y, string type, HotSpotType exchange) { Contract.Requires(view != null); Contract.Requires(type != null); if (IsHidden) { return(DrawHidden(view, x, y)); } DrawInvalidMemoryIndicator(view, y); var origX = x; var origY = y; AddSelection(view, x, y, view.Font.Height); x = AddOpenClose(view, x, y); x = AddIcon(view, x, y, Icons.Array, -1, HotSpotType.None); var tx = x; x = AddAddressOffset(view, x, y); x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name); x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "["); x = AddText(view, x, y, view.Settings.IndexColor, 0, Count.ToString()); x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "]"); x = AddIcon(view, x, y, Icons.LeftArrow, 2, HotSpotType.Click); x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "("); x = AddText(view, x, y, view.Settings.IndexColor, 1, CurrentIndex.ToString()); x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, ")"); x = AddIcon(view, x, y, Icons.RightArrow, 3, HotSpotType.Click) + view.Font.Width; x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name} Size={MemorySize}>") + view.Font.Width; x = AddIcon(view, x + 2, y, Icons.Change, 4, exchange); x += view.Font.Width; x = AddComment(view, x, y); AddTypeDrop(view, y); AddDelete(view, y); y += view.Font.Height; var size = new Size(x - origX, y - origY); if (levelsOpen[view.Level]) { var childSize = DrawChild(view, tx, y); size.Width = Math.Max(size.Width, childSize.Width + tx - origX); size.Height += childSize.Height; } return(size); }
protected Size Draw(DrawContext context, int x, int y, string type) { if (IsHidden && !IsWrapped) { return(DrawHidden(context, x, y)); } var origX = x; AddSelection(context, x, y, context.Font.Height); x = AddOpenCloseIcon(context, x, y); x = AddIcon(context, x, y, context.IconProvider.Array, HotSpot.NoneId, HotSpotType.None); var tx = x; x = AddAddressOffset(context, x, y); x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; if (!IsWrapped) { x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name); } x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "["); x = AddText(context, x, y, context.Settings.IndexColor, IsReadOnly ? HotSpot.NoneId : 0, Count.ToString()); x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "]"); x = AddIcon(context, x, y, context.IconProvider.LeftArrow, 2, HotSpotType.Click); x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "("); x = AddText(context, x, y, context.Settings.IndexColor, 1, CurrentIndex.ToString()); x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, ")"); x = AddIcon(context, x, y, context.IconProvider.RightArrow, 3, HotSpotType.Click) + context.Font.Width; x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"<Size={MemorySize}>") + context.Font.Width; x = AddIcon(context, x + 2, y, context.IconProvider.Change, 4, HotSpotType.ChangeWrappedType); x += context.Font.Width; x = AddComment(context, x, y); DrawInvalidMemoryIndicatorIcon(context, y); AddContextDropDownIcon(context, y); AddDeleteIcon(context, y); y += context.Font.Height; var size = new Size(x - origX, context.Font.Height); if (LevelsOpen[context.Level]) { var childSize = DrawChild(context, tx, y); size.Width = Math.Max(size.Width, childSize.Width + tx - origX); size.Height += childSize.Height; } return(size); }
protected string GetTypeName() { var config = ElasticSearchSection.GetConfiguration(); var currentType = config.IndicesParsed.FirstOrDefault(i => CurrentIndex.StartsWith(i.Name, StringComparison.InvariantCultureIgnoreCase))?.Type; return(!String.IsNullOrEmpty(currentType) ? Type.GetType(currentType)?.AssemblyQualifiedName : typeof(IndexItem).AssemblyQualifiedName); }
private void textBox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == 13) { CurrentIndex = 1; FilterText = textBox.Text; pageBox.Text = CurrentIndex.ToString(); UpdateResourceList(); } }
private void BindTermDocs(Term term) { if (CurrentIndex.IsIndexBeOpend()) { IOpen open = CurrentIndex.GetCurrentOpendIndex(); TermDocumentsRelation tdr = new TermDocumentsRelation(open); docs = tdr.DocumentCount(term); label6.Text = string.Format("文档数:{0}", docs.Count); } }
public CarouselSampleXamlViewModel() { Items = new ObservableCollection <object> { new { Source = "tools1.png", Color = Color.Red }, new { Source = "tools2.png", Color = Color.Green }, new { Source = "tools3.png", Color = Color.Gold }, new { Source = "tools4.png", Color = Color.Silver }, new { Source = "tools5.png", Color = Color.Blue }, new { Source = "tools6.png", Color = Color.Red }, new { Source = "tools7.png", Color = Color.Green }, new { Source = "tools8.png", Color = Color.Gold }, new { Source = "tools9.png", Color = Color.Silver }, new { Source = "tools10.png", Color = Color.Blue }, new { Source = "tools11.png", Color = Color.Blue }, new { Source = "tools12.png", Color = Color.Blue }, new { Source = "tools13.png", Color = Color.Blue } //new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Red }, //new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Green }, //new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Gold }, //new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Silver }, //new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Blue } }; PanPositionChangedCommand = new Command(v => { if (IsAutoAnimationRunning || IsUserInteractionRunning) { return; } var index = CurrentIndex + (bool.Parse(v.ToString()) ? 1 : -1); if (index < 0 || index >= Items.Count) { return; } CurrentIndex = index; }); RemoveCurrentItemCommand = new Command(() => { if (!Items.Any()) { return; } Items.RemoveAt(CurrentIndex.ToCyclingIndex(Items.Count)); }); GoToLastCommand = new Command(() => { CurrentIndex = Items.Count - 1; }); }
// All the private methods. #region Private Methods /// <summary> /// Builds the information panel content. /// </summary> /// <param name="cell">The table cell.</param> /// <param name="designTime">Specify if we need the design time string.</param> internal override void BuildInfo(TableCell cell, bool designTime) { string info = (this.RecordCount == 0 && !string.IsNullOrEmpty(InfoTemplateNoRecords) ? InfoTemplateNoRecords : InfoTemplate); info = info.Replace("$RECORDCOUNT$", (designTime ? "##" : RecordCount.ToString())); info = info.Replace("$CURRENTPAGE$", (designTime ? "##" : (this.RecordCount == 0 ? "0" : CurrentPage.ToString()))); info = info.Replace("$PAGECOUNT$", (designTime ? "##" : PageCount.ToString())); info = info.Replace("$CURRENTINDEX$", (designTime ? "##" : CurrentIndex.ToString())); System.Web.UI.WebControls.Label infoText = new System.Web.UI.WebControls.Label(); infoText.Text = info; cell.Controls.Add(infoText); }
private void pageBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { if (int.TryParse(pageBox.Text, out int pageIndex)) { CurrentIndex = pageIndex; labelPage.Text = CurrentIndex + "/" + PageCount; pageBox.Text = CurrentIndex.ToString(); UpdateResourceList(); } } }
/// <inheritdoc/> public XmlElement ToXmlElement(XmlDocument xmlDocument, ref IList <object> id_source, string name = "") { if (xmlDocument is null) { throw new ArgumentNullException(nameof(xmlDocument)); } if (id_source is null) { throw new ArgumentNullException(nameof(id_source)); } if (name is null) { throw new ArgumentNullException(nameof(name)); } if (name == "") { name = GetType().Name; } XmlElement xmlThis = xmlDocument.CreateElement(name); if (id_source.Contains(this)) { xmlThis.SetAttribute("ref", id_source.IndexOf(this).ToString("x16")); } else { xmlThis.SetAttribute("id", id_source.Count.ToString("x16")); id_source.Add(this); xmlThis.SetAttribute("type", GetType().FullName); XmlElement xmlRoute = xmlDocument.CreateElement("RouteType"); xmlThis.AppendChild(xmlRoute); xmlRoute.InnerText = RouteType.ToString(); XmlElement xmlRouteMode = xmlDocument.CreateElement("RouteMode"); xmlThis.AppendChild(xmlRouteMode); xmlRouteMode.InnerText = RouteMode.ToString(); XmlElement xmlIncrease = xmlDocument.CreateElement("Increase"); xmlThis.AppendChild(xmlIncrease); xmlIncrease.InnerText = _increase.ToString(); XmlElement xmlCurrentIndex = xmlDocument.CreateElement("CurrentIndex"); xmlThis.AppendChild(xmlCurrentIndex); xmlCurrentIndex.InnerText = CurrentIndex is null ? "null" : CurrentIndex.ToString(); XmlElement xmlEntries = xmlDocument.CreateElement("Entries"); xmlThis.AppendChild(xmlEntries); foreach (T entry in this) { XmlElement xmlEntry = CyclicalMethods.ToXmlElement(entry, xmlDocument, ref id_source, "Entry"); xmlEntries.AppendChild(xmlEntry); } } return(xmlThis); }
private string RenderCurrent() { //string result = "<a class=\"" // + _CurrentPageCssClass + "\" href=\"{0}\" " // + GetAlternativeText(CurrentIndex) + " >" // + CurrentIndex.ToString() + "</a> "; string result; if (leaveOutSpans) { result = "<a" + GenerateClassAttribute(_CurrentPageCssClass) + " href=\"{0}\" " + GetAlternativeText(CurrentIndex) + " >" + CurrentIndex.ToString() + "</a> "; //result = CurrentIndex.ToString(); } else { result = "<span class=\"" + _CurrentPageCssClass + "\"" + GetAlternativeText(CurrentIndex) + ">" + CurrentIndex.ToString() + "</span> "; } if (_RenderAsTable) { result = "<td class=\"" + _CurrentPageCellCssClass + "\">" + result + "</td>"; } else if (renderAsList) { result = "<li" + GenerateClassAttribute(_CurrentPageCellCssClass) + ">" + result + "</li>"; } if (_PageURLFormat.Length > 0) { string templateURL = String.Format(PageURLFormat, (CurrentIndex).ToString()); return(String.Format( result, templateURL)); } return(result); }
protected int Draw(ViewInfo view, int x, int y, string type, HotSpotType exchange) { Contract.Requires(view != null); Contract.Requires(type != null); if (IsHidden) { return(DrawHidden(view, x, y)); } AddSelection(view, x, y, view.Font.Height); AddDelete(view, x, y); AddTypeDrop(view, x, y); x = AddOpenClose(view, x, y); x = AddIcon(view, x, y, Icons.Array, -1, HotSpotType.None); var tx = x; x = AddAddressOffset(view, x, y); x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name); x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, "["); x = AddText(view, x, y, Program.Settings.IndexColor, 0, Count.ToString()); x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, "]"); x = AddIcon(view, x, y, Icons.LeftArrow, 2, HotSpotType.Click); x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, "("); x = AddText(view, x, y, Program.Settings.IndexColor, 1, CurrentIndex.ToString()); x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, ")"); x = AddIcon(view, x, y, Icons.RightArrow, 3, HotSpotType.Click); x = AddText(view, x, y, Program.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name} Size={MemorySize}>"); x = AddIcon(view, x + 2, y, Icons.Change, 4, exchange); x += view.Font.Width; AddComment(view, x, y); y += view.Font.Height; if (levelsOpen[view.Level]) { y = DrawChild(view, tx, y); } return(y); }
public void afterClick(string tag) { if (Enum.TryParse <ResourceType>(tag, out App.ResourceType)) { Globals.ThisAddIn.RightWidget.CurrentIndex = 1; Globals.ThisAddIn.RightWidget.FilterText = textBox.Text; Globals.ThisAddIn.RightWidget.pageBox.Text = CurrentIndex.ToString(); Globals.ThisAddIn.RightWidget.ResetPageCount(); Globals.ThisAddIn.RightWidget.UpdateResourceList(); } else { App.ResourceType = ResourceType.None; } ResetButton(); }
public void UpdateUI() { if (CurrentIndex.IsIndexBeOpend()) { IndexOpen open = CurrentIndex.GetCurrentOpendIndex(); docNum = open.Reader.MaxDoc(); label1.Text = string.Format("共有文档{0}条", docNum); FieldTermsRelation rela = FieldTermsRelation.getInstance(); for (int i = 0; i < rela.Fields.Length; i++) { comboBox1.Items.Add(rela.Fields[i]); } if (comboBox1.Items.Count > 0) { comboBox1.SelectedIndex = 0; } } }
public CubeSampleViewModel() { Items = new ObservableCollection <object> { new { Source = "Tips1.jpg", Color = Color.Red }, new { Source = "Tips2.jpg", Color = Color.Green }, new { Source = "Tips3.jpg", Color = Color.Gold }, new { Source = "Tips4.jpg", Color = Color.Silver }, new { Source = "Tips5.jpg", Color = Color.Blue }, new { Source = "Tips6.jpg", Color = Color.Gold }, new { Source = "Tips7.jpg", Color = Color.Yellow }, new { Source = "Tips8.jpg", Color = Color.Black } }; PanPositionChangedCommand = new Command(v => { if (IsAutoAnimationRunning || IsUserInteractionRunning) { return; } var index = CurrentIndex + (bool.Parse(v.ToString()) ? 1 : -1); if (index < 0 || index >= Items.Count) { return; } CurrentIndex = index; }); RemoveCurrentItemCommand = new Command(() => { if (!Items.Any()) { return; } Items.RemoveAt(CurrentIndex.ToCyclingIndex(Items.Count)); }); GoToLastCommand = new Command(() => { CurrentIndex = Items.Count - 1; }); }
public CardsSampleViewModel() { Items = new ObservableCollection <object> { new { Source = CreateSource(), Ind = _imageCount++, Color = Color.Red, Title = "First" }, new { Source = CreateSource(), Ind = _imageCount++, Color = Color.Green, Title = "Second" }, new { Source = CreateSource(), Ind = _imageCount++, Color = Color.Gold, Title = "Long Title" }, new { Source = CreateSource(), Ind = _imageCount++, Color = Color.Silver, Title = "4" }, new { Source = CreateSource(), Ind = _imageCount++, Color = Color.Blue, Title = "5th" } }; PanPositionChangedCommand = new Command(v => { if (IsAutoAnimationRunning || IsUserInteractionRunning) { return; } var index = CurrentIndex + (bool.Parse(v.ToString()) ? 1 : -1); if (index < 0 || index >= Items.Count) { return; } CurrentIndex = index; }); RemoveCurrentItemCommand = new Command(() => { if (!Items.Any()) { return; } Items.RemoveAt(CurrentIndex.ToCyclicalIndex(Items.Count)); }); GoToLastCommand = new Command(() => { Items.Add(new { Source = CreateSource(), Ind = _imageCount++, Color = Color.Red, Title = "Other" }); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Items))); }); }
public CardsSampleViewModel() { Items = new ObservableCollection <object> { new { Description = "Texto de descripción", Date = DateTime.Now.ToShortDateString(), Color = Color.Red }, new { Description = "Texto de descripción en varias líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas", Date = DateTime.Now.ToShortDateString(), Color = Color.Green }, new { Description = "Otro texto de descripción diferente", Date = DateTime.Now.ToShortDateString(), Color = Color.Gold }, new { Description = "Texto de descripción 4324", Date = DateTime.Now.ToShortDateString(), Color = Color.Silver }, new { Description = "Texto de descripción 454554", Date = DateTime.Now.ToShortDateString(), Color = Color.Blue } }; SubItems = new ObservableCollection <string>() { "Texto 1", "Texto 2", "Texto 3", "Texto 4", "Texto 5", "Texto 6", "Texto 7", "Texto 8" }; PanPositionChangedCommand = new Command(v => { var val = (bool)v; if (val) { CurrentIndex += 1; return; } CurrentIndex -= 1; }); RemoveCurrentItemCommand = new Command(() => { if (!Items.Any()) { return; } Items.RemoveAt(CurrentIndex.ToCyclingIndex(Items.Count)); }); }
public void UpdateUI() { if (CurrentIndex.IsIndexBeOpend()) { IndexOpen open = CurrentIndex.GetCurrentOpendIndex(); GeneralBind bind = new GeneralBind(open); GeneralBind.ViewData data = bind.Execute(); IndexPath_Lab.Text += data.IndexPath; FieldNum_Ctl.Text += data.FieldNum; DocumentNum_Ctl.Text += data.DocumentNum; IndexOP_Ctl.Text += data.IsOptimized ? "已经优化" : "没有优化"; IndexVer_Ctl.Text += data.Version.ToString(); UpdateTime_Ctl.Text += data.UpdateTime.ToString(); listBox1.Items.Clear(); FieldTermsRelation rela = FieldTermsRelation.getInstance(); for (int i = 0; i < rela.Fields.Length; i++) { listBox1.Items.Add(rela.Fields[i]); } listBox1.Items.Insert(0, "所有Fields"); listBox1.SelectedIndex = 0; } }
private static List <int> LocalSearch(SimParams par, Population pop, int territory, HashSet <int> unavaliable, int needed = 1) { //Get birds that are accaptable and local to a given territory List <int> CurrentIndex; for (int i = 0; i < pop.Local.Length; i++) { CurrentIndex = pop.Local[i][territory].ToList(); //Remove unacceptable birds for (int j = CurrentIndex.Count - 1; j >= 0; j--) { if (unavaliable.Contains(CurrentIndex[j])) { CurrentIndex.RemoveAt(j); } } if (CurrentIndex.Count >= needed) { return(CurrentIndex); } } throw new ArgumentOutOfRangeException("All males are dead or songless; Game Over."); }
private void ShowDocument(int docId) { listView1.Clear(); listView1.Columns.Add("Field", 120); listView1.Columns.Add("Norm", 120); listView1.Columns.Add("Text", 400); IOpen open = CurrentIndex.GetCurrentOpendIndex(); if (docId >= open.Reader.NumDocs()) { MessageHelper.ShowErrorMessage("当前Id超出文档最大Id。"); return; } Document doc = open.Reader.Document(docId); IList list = doc.GetFields(); for (int i = 0; i < list.Count; i++) { Field f = list[i] as Field; listView1.Items.Add(new ListViewItem(new string[] { f.Name(), TermDocumentsRelation.GetNorm(CurrentIndex.GetCurrentOpendIndex().Reader, f.Name(), docId).ToString(), f.StringValue() })); } }
private void button2_Click(object sender, EventArgs e) { IndexOpen open = new IndexOpen(this.comboBox1.Text, false); Console.WriteLine(110); if (open.IndexExists()) { bool isOpend = open.Open(); if (isOpend) { CurrentIndex.SetCurrentOpendIndex(open); this.Close(); this.DialogResult = DialogResult.OK; } else { MessageHelper.ShowErrorMessage("打开索引文件失败,有可能是索引文件损坏引起。"); } } else { MessageHelper.ShowErrorMessage("索引文件不存在!"); } }
internal void LoadCopy(XmlNode node, string localpath) { this._oCurrentIndex = new CurrentIndex(node, localpath); }
private void DoRender(HtmlTextWriter writer) { if (Page != null) { Page.VerifyRenderingInServerForm(this); } //base.RenderBeginTag(writer); if (this.PageCount > this.SmartShortCutThreshold) { if (EnableSmartShortCuts) { CalculateSmartShortcutAndFillList(); } } if (containerElement.Length > 0) { writer.Write("<" + containerElement); if (containerElementCssClass.Length > 0) { writer.Write(" class='" + containerElementCssClass + "'"); } writer.Write(">"); } if (renderNavElement) { writer.Write("<nav role='navigation'>"); } if (_RenderAsTable) { writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "3"); writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "1"); writer.AddAttribute(HtmlTextWriterAttribute.Border, "0"); writer.AddAttribute(HtmlTextWriterAttribute.Class, "PagerContainerTable"); if (RTL) { writer.AddAttribute(HtmlTextWriterAttribute.Dir, "rtl"); } writer.RenderBeginTag(HtmlTextWriterTag.Table); writer.RenderBeginTag(HtmlTextWriterTag.Tr); writer.AddAttribute(HtmlTextWriterAttribute.Class, "PagerInfoCell"); writer.RenderBeginTag(HtmlTextWriterTag.Td); } else if (renderAsList) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "pagination"); writer.RenderBeginTag(HtmlTextWriterTag.Ul); } if (renderAsList) { writer.AddAttribute(HtmlTextWriterAttribute.Class, _PageInfoCssClass); writer.RenderBeginTag(HtmlTextWriterTag.Li); } if (CurrentIndex > -1) { // begin page info if (!leaveOutSpans) { writer.AddAttribute(HtmlTextWriterAttribute.Class, _PageInfoCssClass); writer.RenderBeginTag(HtmlTextWriterTag.Span); } if (wrapPageInfoInAnchor) { writer.Write("<a name='pageinfo'>"); } writer.Write(PageClause + " " + CurrentIndex.ToString() + " " + OfClause + " " + PageCount.ToString()); if (wrapPageInfoInAnchor) { writer.Write("</a>"); } if (!leaveOutSpans) { writer.RenderEndTag(); //span } writer.Write(" "); // end pageinfo } //start view all link if (viewAllUrl.Length > 0) { if (!leaveOutSpans) { if (CurrentIndex == -1) { writer.AddAttribute(HtmlTextWriterAttribute.Class, _CurrentPageCssClass + " viewall"); writer.RenderBeginTag(HtmlTextWriterTag.Span); } else { writer.AddAttribute(HtmlTextWriterAttribute.Class, _PageInfoCssClass + " viewall"); writer.RenderBeginTag(HtmlTextWriterTag.Span); } } writer.Write("<a class='pagerall' href='" + viewAllUrl + "'>"); writer.Write(viewAllText); writer.Write("</a>"); if (!leaveOutSpans) { writer.RenderEndTag(); //span } writer.Write(" "); } //end view all link if (renderAsList) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "unavailable"); writer.RenderEndTag(); //li } if (_RenderAsTable) { writer.RenderEndTag(); } if (CurrentIndex > -1) { if (ShowFirstLast && CurrentIndex != 1) { writer.Write(RenderFirst()); } if (CurrentIndex != 1) { writer.Write(RenderBack()); } } if (CurrentIndex < CompactedPageCount) { if (CompactedPageCount > PageCount) { CompactedPageCount = PageCount; } for (int i = 1; i < CompactedPageCount + 1; i++) { if (i == CurrentIndex) { writer.Write(RenderCurrent()); } else { writer.Write(RenderOther(i)); } } RenderSmartShortCutByCriteria(CompactedPageCount, true, writer); } else if (CurrentIndex >= CompactedPageCount && CurrentIndex < NotCompactedPageCount) { if (NotCompactedPageCount > PageCount) { NotCompactedPageCount = PageCount; } for (int i = 1; i < NotCompactedPageCount + 1; i++) { if (i == CurrentIndex) { writer.Write(RenderCurrent()); } else { writer.Write(RenderOther(i)); } } RenderSmartShortCutByCriteria(NotCompactedPageCount, true, writer); } else if (CurrentIndex >= NotCompactedPageCount) { int gapValue = NotCompactedPageCount / 2; int leftBand = CurrentIndex - gapValue; int rightBand = CurrentIndex + gapValue; RenderSmartShortCutByCriteria(leftBand, false, writer); for (int i = leftBand; (i < rightBand + 1) && i < PageCount + 1; i++) { if (i == CurrentIndex) { writer.Write(RenderCurrent()); } else { writer.Write(RenderOther(i)); } } if (rightBand < this.PageCount) { RenderSmartShortCutByCriteria(rightBand, true, writer); } } if (CurrentIndex != PageCount) { writer.Write(RenderNext()); } if (ShowFirstLast && CurrentIndex != PageCount) { writer.Write(RenderLast()); } if (_RenderAsTable) { writer.RenderEndTag(); writer.RenderEndTag(); } else if (renderAsList) { writer.RenderEndTag(); //ul } if (renderNavElement) { writer.Write("</nav>"); } if (containerElement.Length > 0) { writer.Write("</" + containerElement + ">"); } base.Render(writer); //base.RenderEndTag(writer); }