public void RecalculateDisplayTimes(double maxCharactersPerSecond, System.Windows.Forms.ListView.SelectedIndexCollection selectedIndexes) { for (int i = 0; i < _paragraphs.Count; i++) { if (selectedIndexes == null || selectedIndexes.Contains(i)) { Paragraph p = _paragraphs[i]; double duration = Utilities.GetOptimalDisplayMilliseconds(p.Text); p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + duration; while (Utilities.GetCharactersPerSecond(p) > maxCharactersPerSecond) { duration++; p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + duration; } Paragraph next = GetParagraphOrDefault(i + 1); if (next != null && p.StartTime.TotalMilliseconds + duration + Configuration.Settings.General.MininumMillisecondsBetweenLines > next.StartTime.TotalMilliseconds) { p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines; if (p.Duration.TotalMilliseconds <= 0) { p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + 1; } } } } }
public static int[] IndicesToArray(this System.Windows.Forms.ListView.SelectedIndexCollection lvsic) { int[] ReturnInt = new int[lvsic.Count]; for (int i = 0; i < lvsic.Count; i++) { ReturnInt[i] = lvsic[i]; } return(ReturnInt); }
private void toolStripMenuItemRemove_Click(object sender, EventArgs e) { System.Windows.Forms.ListView.SelectedIndexCollection lis = listViewTasks.SelectedIndices; if (listViewTasks.SelectedIndices.Count > 0) { DialogResult result = MessageBox.Show("Are you sure you want to delete the record\r\n<" + listViewTasks.SelectedItems[0].SubItems[0].Text + " / " + listViewTasks.SelectedItems[0].SubItems[1].Text + " / " + listViewTasks.SelectedItems[0].SubItems[2].Text + ">?", "Delete", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { RemoveElement(lis[0]); } } }
private CrawlerImage determineInListViewSelectedCrawlerImage() { lock (this.shownCrawlerImageList) { // CrawlerImage crawlerImage = null; // System.Windows.Forms.ListView.SelectedIndexCollection indexList = this.imageListView.SelectedIndices; if (indexList.Count > 0) { int index = indexList[0]; if (this.shownCrawlerImageList.Count > index) { crawlerImage = this.shownCrawlerImageList[index]; } } // return(crawlerImage); } }
internal void AdjustDisplayTimeUsingPercent(double percent, System.Windows.Forms.ListView.SelectedIndexCollection selectedIndexes) { for (int i = 0; i < _paragraphs.Count; i++) { if (selectedIndexes == null || selectedIndexes.Contains(i)) { double nextStartMilliseconds = _paragraphs[_paragraphs.Count - 1].EndTime.TotalMilliseconds + 100000; if (i + 1 < _paragraphs.Count) { nextStartMilliseconds = _paragraphs[i + 1].StartTime.TotalMilliseconds; } double newEndMilliseconds = _paragraphs[i].EndTime.TotalMilliseconds; newEndMilliseconds = _paragraphs[i].StartTime.TotalMilliseconds + (((newEndMilliseconds - _paragraphs[i].StartTime.TotalMilliseconds) * percent) / 100); if (newEndMilliseconds > nextStartMilliseconds) { newEndMilliseconds = nextStartMilliseconds - 1; } _paragraphs[i].EndTime.TotalMilliseconds = newEndMilliseconds; } } }
internal void AdjustDisplayTimeUsingSeconds(double seconds, System.Windows.Forms.ListView.SelectedIndexCollection selectedIndexes) { for (int i = 0; i < _paragraphs.Count; i++) { if (selectedIndexes == null || selectedIndexes.Contains(i)) { double nextStartMilliseconds = _paragraphs[_paragraphs.Count - 1].EndTime.TotalMilliseconds + 100000; if (i + 1 < _paragraphs.Count) { nextStartMilliseconds = _paragraphs[i + 1].StartTime.TotalMilliseconds; } double newEndMilliseconds = _paragraphs[i].EndTime.TotalMilliseconds + (seconds * 1000.0); if (newEndMilliseconds > nextStartMilliseconds) { newEndMilliseconds = nextStartMilliseconds - 1; } if (seconds < 0) { if (_paragraphs[i].StartTime.TotalMilliseconds + 100 > newEndMilliseconds) { _paragraphs[i].EndTime.TotalMilliseconds = _paragraphs[i].StartTime.TotalMilliseconds + 100; } else { _paragraphs[i].EndTime.TotalMilliseconds = newEndMilliseconds; } } else { _paragraphs[i].EndTime.TotalMilliseconds = newEndMilliseconds; } } } }
/* ----------------------------------------------------------------- */ /// /// Descend /// /// <summary> /// 降順にソートします。 /// </summary> /// /* ----------------------------------------------------------------- */ public static IEnumerable <int> Descend( this System.Windows.Forms.ListView.SelectedIndexCollection indices) => indices.Cast <int>().OrderByDescending(x => x);
private void listView1_SelectedIndexChanged(object sender, EventArgs e) { ((mainForm)this.DockPanel.Parent).timeSlider1_Scroll(sender, e); //doc.Models.ResetPermanentMaterials(modelSelection); modelSelection.Clear(); listView1.HideSelection = false; SavedItemCollection si = doc.SelectionSets.Value; System.Windows.Forms.ListView.SelectedIndexCollection indicies = listView1.SelectedIndices; for (int i = 0; i < indicies.Count; i++) { SelectionSource ss = doc.SelectionSets.CreateSelectionSource(si[indicies[i]]); Search s = new Search(); s.Selection.SelectionSources.Add(ss); modelSelection.AddRange(s.Selection.GetSelectedItems(doc)); } msTreeView1.CollapseAll(); if (modelSelection.Count > 0) { System.Drawing.Color c = System.Drawing.Color.Blue; doc.Models.OverridePermanentColor(modelSelection, new Autodesk.Navisworks.Api.Color(c.R / 255, c.G / 255, c.B / 255)); List <MSTreeView.MSTreeNode> selectedNodes = new List <MSTreeView.MSTreeNode>(); int j = 0; foreach (ModelItem m in doc.Models.RootItems) { if (modelSelection.IsSelected(m)) { selectedNodes.Add((MSTreeView.MSTreeNode)msTreeView1.Nodes[j]); } else { if (treeSelect(m.Children, msTreeView1.Nodes[j], selectedNodes)) { msTreeView1.Nodes[j].Expand(); } } j++; } msTreeView1.SelectedNodes = selectedNodes; } else { msTreeView1.SelectedNodes = new List <MSTreeView.MSTreeNode>(); } if (modelSelection.Count == 1) { prop.displayProperties(modelSelection[0].PropertyCategories); } else { prop.displayLabel(modelSelection.Count + " items selected"); } }
public static IEnumerable <int> AsEnumerable(this System.Windows.Forms.ListView.SelectedIndexCollection source) { TypeCheckEnumerable(source, (s) => s.AsEnumerable(), (s) => s[0]); return(source.Cast <int>()); }