private void OnDoubleClick(object sender, ButtonPressEventArgs e) { try { if (e.Event.Type == Gdk.EventType.TwoButtonPress && e.Event.Button == 1 && DoubleClicked != null) { DoubleClicked.Invoke(sender, e); } if (e.Event.Button == 3) { TreePath path = Listview.GetPathAtPos((int)e.Event.X, (int)e.Event.Y); if (path != null) { Listview.SelectPath(path); if (popup.Children.Count() > 0) { popup.Popup(); } } e.RetVal = true; } } catch (Exception err) { ShowError(err); } }
static Listview LoadListView(Stream fs) { var obj = new Listview(ReadString(fs), ReadFont(fs), ReadFont(fs), ReadInt(fs), ReadInt(fs), ReadInt(fs), ReadInt(fs)) { Enabled = ReadBool(fs), Visible = ReadBool(fs), HeaderColor = ReadColor(fs), ItemColor = ReadColor(fs), SelectionColor = ReadColor(fs), SelectedTextColor = ReadColor(fs) }; int i; var c = ReadInt(fs); for (i = 0; i < c; i++) { obj.AddColumn(new ListviewColumn("col" + i, ReadString(fs), ReadInt(fs))); } c = ReadInt(fs); for (i = 0; i < c; i++) { var s = new string[ReadInt(fs)]; for (var j = 0; j < s.Length; j++) { s[j] = ReadString(fs); } obj.AddLine(new ListviewItem(s)); } return(obj); }
private void btnProximo_Click(object Sender, EventArgs e) { long click = 0; click = DateTime.Now.Ticks; //Dim limparlista As Long //limparlista = DateTime.Now.Ticks //Debug.WriteLine("<<limparlista>> before " + limparlista.ToString()) bool successfulClearSelection = true; if (Listview.SelectedItems.Count > 0) { successfulClearSelection = Listview.clearItemSelection(Listview.SelectedItems[0]); } //Debug.WriteLine("<<limparlista>> after " + DateTime.Now.Ticks.ToString()) //Debug.WriteLine("<<limparlista>> total " + New TimeSpan(DateTime.Now.Ticks - limparlista).ToString()) if (! successfulClearSelection) { return; } CurrentPageNr += 1; long carregar = 0; carregar = DateTime.Now.Ticks; // repopulate the listView Listview.Items.Clear(); LoadListData(); Debug.WriteLine("<<repopulate the listView>>: " + new TimeSpan(DateTime.Now.Ticks - carregar).ToString()); //Dim seleccionar As Long //seleccionar = DateTime.Now.Ticks //Debug.WriteLine("<<seleccionar>> before " + seleccionar.ToString()) //If Listview.Items.Count > 0 Then // Listview.selectItem(Listview.Items(0)) //End If //update buttons state and label text //refreshNavigationState() //Debug.WriteLine("<<seleccionar>> after " + DateTime.Now.Ticks.ToString()) //Debug.WriteLine("<<seleccionar>> total " + New TimeSpan(DateTime.Now.Ticks - seleccionar).ToString()) Debug.WriteLine("<<Button Next>> total " + new TimeSpan(DateTime.Now.Ticks - click).ToString()); }
private void Awake() { plateConfig = gameObject.AddComponent <PlateConfig>(); //new PlateConfig(); listview = gameObject.AddComponent <Listview>(); searchConfig = gameObject.AddComponent <SearchConfig>(); changeScene = gameObject.AddComponent <ChangeScene>(); selectedFood = SelectedFood.getInstance(); searchConfig.setListview(listview, searchConfig, this); plateConfig.PlateButtonListener(searchConfig, this); }
//Private Sub resetPagesStack() // stackLastTexts.Clear() // stackLastTexts.Push(String.Empty) //End Sub public void resetList() { CurrentPageNr = 1; //resetPagesStack() // limpa explicitamente a selecção de modo a lançar um selectedindexchanged if (Listview.SelectedItems.Count > 0) { Listview.clearItemSelection(Listview.SelectedItems[0]); } Listview.Items.Clear(); }
public static void DeserializeColumns(Listview.ColumnHeaderCollection headers, string ApplicationName, string ListviewName) { try { string filespec = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ApplicationName + "." + ListviewName + ".xml"); StreamReader stream = new StreamReader(@filespec); XmlSerializer serializer = new XmlSerializer(typeof(List<ColumnEntry>)); List<ColumnEntry> cols = (List<ColumnEntry>)serializer.Deserialize(stream); stream.Close(); foreach (ColumnEntry col in cols) {headers[col.headerIndex].Width = col.width;} } catch (Exception) { //TEMP: just swallow the exception for now } }
public static void SerializeColumns(Listview.ColumnHeaderCollection headers, string ApplicationName, string ListviewName) { List<ColumnEntry> cols = new List<Serialization.ColumnEntry>(); foreach (System.Windows.Forms.ColumnHeader header in headers) { cols.Add(new ColumnEntry(header.Width, header.Index)); } string filespec = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ApplicationName + "." + ListviewName + ".xml"); StreamWriter stream = new StreamWriter(filespec); XmlSerializer serializer = new XmlSerializer(typeof(List<ColumnEntry>)); serializer.Serialize(stream, (cols)); stream.Close(); }
private void TxtNroPagina_BeforeNewSelection(object sender, GoToPageEventArgs e) { if (e.pageNr == 0 || e.pageNr > TotalPaginasCount || e.pageNr == CurrentPageNr) { e.success = false; return; } long click = 0; click = DateTime.Now.Ticks; bool successfulClearSelection = true; // esta operação tem como objectibo permitir que haja a possibilidade de cancelar a mudança de página if (Listview.SelectedItems.Count > 0) { successfulClearSelection = Listview.clearItemSelection(Listview.SelectedItems[0]); } if (! successfulClearSelection) { return; } CurrentPageNr = e.pageNr; // repopulate the listView Listview.Items.Clear(); LoadListData(); //If Listview.Items.Count > 0 Then // Listview.selectItem(Listview.Items(0)) //End If if (Listview.Items.Count == 1) { Listview.selectItem(Listview.Items[0]); } else if (Listview.Items.Count > 0) { Listview.selectItem(null); } //update buttons state and label text //refreshNavigationState() Debug.WriteLine("<<Go to page>> total " + new TimeSpan(DateTime.Now.Ticks - click).ToString()); }
public Listview GetListview(List <ISource <PackageEntry> > sources) { var listview = new Listview(); foreach (ISource <PackageEntry> source in sources) { var sink = new SinkHelper(listview, string.Empty); sink.Initialize(Installer.CreatePreviewContext()); new EntrySorter(source).Populate(sink); if (sink.Count == 0) { sink.AddItem(Translate.Text("There are no entries that match search criteria or the source is empty.")); } } return(listview); }
public static Listview SetPublishingIListview(Listview publishListview, List <PublishedItemEntity> publishedItemsInfo) { if (publishedItemsInfo != null) { foreach (var publishedItem in publishedItemsInfo) { var listSubItem = new ListviewItem(); publishListview.Controls.Add(listSubItem); listSubItem.ID = Control.GetUniqueID("I"); listSubItem.ColumnValues["itemName"] = publishedItem.ItemName; listSubItem.ColumnValues["itemPath"] = publishedItem.ItemPath; } } return(publishListview); }
//Private Sub Listview_SelectedIndexChanging(ByVal sender As Object, _ // ByVal e As ItemChangingEventArgs) _ // 'Handles mListview.SelectedIndexChanged // RaiseEvent ListSelectionChanged(sender, e) //End Sub private void btnAnterior_Click(object Sender, EventArgs e) { long click = 0; click = DateTime.Now.Ticks; bool successfulClearSelection = true; // esta operação tem como objectibo permitir que haja a possibilidade de cancelar a mudança de página if (Listview.SelectedItems.Count > 0) { successfulClearSelection = Listview.clearItemSelection(Listview.SelectedItems[0]); } if (! successfulClearSelection) { return; } CurrentPageNr -= 1; // repopulate the listView Listview.Items.Clear(); LoadListData(); //If Listview.Items.Count > 0 Then // Listview.selectItem(Listview.Items(0)) //End If if (Listview.Items.Count == 1) { Listview.selectItem(Listview.Items[0]); } else if (Listview.Items.Count > 0) { Listview.selectItem(null); } //update buttons state and label text //refreshNavigationState() Debug.WriteLine("<<Button Previous>> total " + new TimeSpan(DateTime.Now.Ticks - click).ToString()); }
/// <summary> /// Initializes a new instance of the <see cref="AddChildElement"/> class. /// </summary> public AddChildElement() { this.TemplateList = new Listview(); ElementName = new Edit(); }
private static Listview RefreshLinks(System.Web.UI.Control parent) { Assert.ArgumentNotNull(parent, "parent"); DesktopLinkCollection desktopLinkCollection = new DesktopLinkCollection(Registry.GetString("/Current_User/Desktop/Links")); Listview listview = new Listview(); Context.ClientPage.AddControl(parent, listview); listview.ID = "DesktopLinks"; listview.Height = new System.Web.UI.WebControls.Unit(100.0, System.Web.UI.WebControls.UnitType.Percentage); int num = 0; string name = Client.ContentDatabase.Name; string name2 = Client.CoreDatabase.Name; foreach (DesktopLink current in desktopLinkCollection) { num++; string databaseName = current.DatabaseName; bool flag = true; string header = Shell.GetLinkHeader(current, out flag); bool flag2 = UIUtil.IsControlUri(current.Path); if (!(databaseName != name) || !(databaseName != "-") || !(databaseName != name2) || flag2) { if (!flag2 && databaseName != "-") { Database database = Factory.GetDatabase(databaseName); Item item = database.Items[current.Path]; if (item == null) { continue; } if (string.Compare(item.TemplateName, "Application Shortcut", System.StringComparison.InvariantCultureIgnoreCase) == 0) { Item applicationFromShortcut = UIUtil.GetApplicationFromShortcut(item); if (applicationFromShortcut == null) { continue; } } if (!flag) { header = item.DisplayName; } } ListviewItem listviewItem = new ListviewItem(); Context.ClientPage.AddControl(listview, listviewItem); listviewItem.ID = Sitecore.Web.UI.HtmlControls.Control.GetUniqueID("L"); listviewItem.Header = header; listviewItem.Icon = current.Icon; listviewItem.ServerProperties["Link"] = current.ToString(); listviewItem.ServerProperties["Index"] = num - 1; listviewItem.ClassPrefix = "scDesktop"; } } return listview; }
//INSTANT C# NOTE: C# does not support optional parameters. Overloaded method(s) are created above. //ORIGINAL LINE: Public Sub LoadListData(Optional ByVal selectedItemTag As Object = null, Optional ByVal selectFirstItem As Boolean = true) public void LoadListData(object selectedItemTag, bool selectFirstItem) { long loadListDataTime = DateTime.Now.Ticks; Cursor oldCursor = null; try { oldCursor = Listview.Cursor; Listview.Parent.TopLevelControl.Cursor = Cursors.WaitCursor; try { GisaDataSetHelper.ManageDatasetConstraints(false); Listview.BeginUpdate(); PaginatedLVGetItems returnedRows = null; bool deadlockOccurred = true; while (deadlockOccurred) { GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { long calculate = DateTime.Now.Ticks; if (CalculateOrderedItems != null) CalculateOrderedItems(ho.Connection); Debug.WriteLine("<<CalculateOrderedItems>> total " + new TimeSpan(DateTime.Now.Ticks - calculate).ToString()); // selectedItemTag virá preenchido se se pretender seleccionar // um item específico após a população do lista if (selectedItemTag != null) { int pageNr = 0; // no caso deste evento não ser tratado por ninguém // consideramos simplesmente que não é suportada a // selecção de um item específico if (GetPageForItemTag != null) GetPageForItemTag(selectedItemTag, ref pageNr, ho.Connection); CurrentPageNr = pageNr; } long count = DateTime.Now.Ticks; TotalPaginasCount = countPages(ho.Connection, ItemsCountLimit); //RemainingItemsCount = countItems(ho.Connection, LastBottomID) - ItemsCountLimit Debug.WriteLine("<<countItems>> total " + new TimeSpan(DateTime.Now.Ticks - count).ToString()); long obterElementos = 0; obterElementos = DateTime.Now.Ticks; if (GetItems != null) GetItems(CurrentPageNr, ItemsCountLimit, ref returnedRows, ho.Connection); Debug.WriteLine("<<obterElementos>> total " + new TimeSpan(DateTime.Now.Ticks - obterElementos).ToString()); //limpar long delete = DateTime.Now.Ticks; if (DeleteTemporaryResults != null) DeleteTemporaryResults(ho.Connection); Debug.WriteLine("<<DeleteTemporaryResults>> total " + new TimeSpan(DateTime.Now.Ticks - delete).ToString()); deadlockOccurred = false; } catch (Exception ex) { Trace.WriteLine(ex); if (DBAbstractDataLayer.DataAccessRules.ExceptionHelper.isDeadlockException(ex)) { returnedRows = null; deadlockOccurred = true; } else throw; } finally { ho.Dispose(); } } long adicionarElementosLista = DateTime.Now.Ticks; if (AddItemsToList != null) AddItemsToList(returnedRows); Debug.WriteLine("<<adicionarElementosLista>> total " + new TimeSpan(DateTime.Now.Ticks - adicionarElementosLista).ToString()); } catch (Exception ex) { Trace.WriteLine(ex); throw; } finally { Listview.EndUpdate(); try { GisaDataSetHelper.ManageDatasetConstraints(true); } catch (ConstraintException ex) { IDbConnection conn = GisaDataSetHelper.GetTempConnection(); conn.Open(); Trace.WriteLine("<EnforceContraints>"); Trace.WriteLine(ex.ToString()); GisaDataSetHelper.FixDataSet(GisaDataSetHelper.GetInstance(), conn); conn.Close(); #if DEBUG throw; #endif } catch (Exception ex) { Trace.WriteLine(ex); throw; } } } finally { Listview.Parent.TopLevelControl.Cursor = oldCursor; } refreshNavigationState(); if (Listview.Items.Count == 1) { if (selectedItemTag != null) { // Se, por alguma razão, acontecer o item procurado não // chegar a ser encontrado também não será seleccionado // nenhum item Listview.selectItem(GUIHelper.GUIHelper.findListViewItemByTag(selectedItemTag, Listview)); } else if (selectFirstItem) { //Listview.Focus() Listview.selectItem(Listview.Items[0]); } } else if (Listview.Items.Count > 0) { Listview.selectItem(null); } Debug.WriteLine("<<LoadListData>> total " + new TimeSpan(DateTime.Now.Ticks - loadListDataTime).ToString()); }
public SinkHelper(Listview view, string filter) { _view = view; _filter = filter; }
public void setListview(Listview l, SearchConfig s, TaskManager t) { listview = l; listview.setParent(s); parent = t; }