private void dataListView1_BeforeCreatingGroups(object sender, BrightIdeasSoftware.CreateGroupsEventArgs e) { /* * int groupNumber = 0; * foreach(BrightIdeasSoftware.OLVGroup group in e.Groups) * { * foreach(OLVListItem item in group.Items) * { * rowObject = item.RowObject as DataListView; * groupNumber += rowObject. * } * } */ // e.Canceled = true; dataListView1.AutoResizeColumns(); dataListView1.Refresh(); dataListView1.Update(); dataListView1.AllColumns[6].CellEditUseWholeCell = true; dataListView1.AllColumns[0].IsEditable = false; dataListView1.AllColumns[1].IsEditable = false; dataListView1.AllColumns[2].IsEditable = false; dataListView1.AllColumns[3].IsEditable = false; dataListView1.AllColumns[4].IsEditable = false; dataListView1.AllColumns[5].IsEditable = false; dataListView1.AllColumns[6].IsEditable = false; }
private void fastGroups_AboutToCreateGroups(object sender, BrightIdeasSoftware.CreateGroupsEventArgs e) { if (e.Groups != null && e.Groups.Count > 0) { foreach (OLVGroup olvGroup in e.Groups) { olvGroup.TitleImage = sender.Equals(this.fastUserControlIndexes) ? "UserGroupN" : (sender.Equals(this.fastUserGroupDetails) ? "Assembly-32" : "group-of-users-silhouette"); olvGroup.Subtitle = olvGroup.Contents.Count.ToString() + (sender.Equals(this.fastUserControlIndexes) ? " User" : (sender.Equals(this.fastUserGroupDetails) ? " Group" : " Salesperson")) + (olvGroup.Contents.Count > 1 ? "s" : ""); } } }
private void fastNMVNTasks_AboutToCreateGroups(object sender, BrightIdeasSoftware.CreateGroupsEventArgs e) { if (e.Groups != null && e.Groups.Count > 0) { foreach (OLVGroup olvGroup in e.Groups) { olvGroup.TitleImage = "Assembly-32"; olvGroup.Subtitle = "Count: " + olvGroup.Contents.Count.ToString() + " Task" + (olvGroup.Contents.Count > 1 ? "s" : ""); } } }
private void fastAvailableItems_AboutToCreateGroups(object sender, BrightIdeasSoftware.CreateGroupsEventArgs e) { if (e.Groups != null && e.Groups.Count > 0) { foreach (OLVGroup olvGroup in e.Groups) { olvGroup.TitleImage = sender.Equals(this.fastAvailablePallets) ? "Pallet-32-O" : "Carton-32"; olvGroup.Subtitle = "List count: " + olvGroup.Contents.Count.ToString(); } } }
private void fastGroups_AboutToCreateGroups(object sender, BrightIdeasSoftware.CreateGroupsEventArgs e) { if (e.Groups != null && e.Groups.Count > 0) { foreach (OLVGroup olvGroup in e.Groups) { olvGroup.TitleImage = sender.Equals(this.fastUserGroups) ? "Assembly-32" : "UserGroupN"; olvGroup.Subtitle = olvGroup.Contents.Count.ToString() + (sender.Equals(this.fastUserGroups) ? " Group" : " User") + (olvGroup.Contents.Count > 1 ? "s" : ""); } } }
private void fastAvailableItems_AboutToCreateGroups(object sender, BrightIdeasSoftware.CreateGroupsEventArgs e) { if (e.Groups != null && e.Groups.Count > 0) { foreach (OLVGroup olvGroup in e.Groups) { olvGroup.TitleImage = sender.Equals(this.fastWholePendingSalesOrderDetails) ? "Sign_Order_32" : (sender.Equals(this.fastWholePendingDeliveryAdviceDetails) ? "Schedule-32" : "filetransfer32"); olvGroup.Subtitle = "List count: " + olvGroup.Contents.Count.ToString(); } } }
/// <summary> /// Organise the view items into groups, based on the given columns /// </summary> /// <param name="groupByColumn">What column will be used for grouping</param> /// <param name="groupByOrder">What ordering will be used for groups</param> /// <param name="column">The column whose values should be used for sorting. Cannot be null</param> /// <param name="order">The order in which the values from column will be sorted</param> /// <param name="secondaryColumn">When the values from 'column' are equal, use the values provided by this column</param> /// <param name="secondaryOrder">How will the secondary values be sorted</param> /// <remarks>This method does not trigger sorting events. Use BuildGroups() to do that</remarks> public virtual void BuildGroups(OLVColumn groupByColumn, SortOrder groupByOrder, OLVColumn column, SortOrder order, OLVColumn secondaryColumn, SortOrder secondaryOrder) { // Sanity checks if (groupByColumn == null) return; // Getting the Count forces any internal cache of the ListView to be flushed. Without // this, iterating over the Items will not work correctly if the ListView handle // has not yet been created. int dummy = this.Items.Count; // Collect all the information that governs the creation of groups GroupingParameters parms = this.CollectGroupingParameters(groupByColumn, groupByOrder, column, order, secondaryColumn, secondaryOrder); // Trigger an event to let the world create groups if they want CreateGroupsEventArgs args = new CreateGroupsEventArgs(parms); if (parms.GroupByColumn != null) args.Canceled = !parms.GroupByColumn.Groupable; this.OnBeforeCreatingGroups(args); if (args.Canceled) return; // If the event didn't create them for us, use our default strategy if (args.Groups == null) args.Groups = this.MakeGroups(parms); // Give the world a chance to munge the groups before they are created this.OnAboutToCreateGroups(args); if (args.Canceled) return; // Create the groups now this.OLVGroups = args.Groups; this.CreateGroups(args.Groups); // Tell the world that new groups have been created this.OnAfterCreatingGroups(args); }
/// <summary> /// /// </summary> /// <param name="e"></param> protected virtual void OnAfterCreatingGroups(CreateGroupsEventArgs e) { if (this.AfterCreatingGroups != null) this.AfterCreatingGroups(this, e); }
/// <summary> /// /// </summary> /// <param name="e"></param> protected virtual void OnBeforeCreatingGroups(CreateGroupsEventArgs e) { if (this.BeforeCreatingGroups != null) this.BeforeCreatingGroups(this, e); }
//----------------------------------------------------------------------------------- #region OnEvents /// <summary> /// /// </summary> /// <param name="e"></param> protected virtual void OnAboutToCreateGroups(CreateGroupsEventArgs e) { if (this.AboutToCreateGroups != null) this.AboutToCreateGroups(this, e); }
private void dataListView2_BeforeCreatingGroups(object sender, BrightIdeasSoftware.CreateGroupsEventArgs e) { //e.Canceled = true; }
void listView_AboutToCreateGroups(object sender, CreateGroupsEventArgs e) { foreach (var group in e.Groups) { Int64 insertedCharacters = 0; Int64 keystrokesSaved = 0; var efficiencies = new List<double>(); foreach (var item in group.Items) { var trackInfoView = (TrackInfoView) item.RowObject; insertedCharacters += trackInfoView.InsertedCharacters; keystrokesSaved += trackInfoView.KeystrokesSaved; efficiencies.Add(trackInfoView.Efficiency); } var efficiency = efficiencies.Average(x => Math.Round(x, 0)); group.Header = string.Format("{0} {1:n0} (inserted characters) - {2}% (efficiency) - {3:n0} (keystrokes saved)", group.Header, insertedCharacters, efficiency, keystrokesSaved); } }
private void fastUserControlAvailableSalespersons_AboutToCreateGroups(object sender, BrightIdeasSoftware.CreateGroupsEventArgs e) { if (e.Groups != null && e.Groups.Count > 0) { foreach (OLVGroup olvGroup in e.Groups) { olvGroup.TitleImage = "group-of-users"; olvGroup.Subtitle = "Available " + olvGroup.Contents.Count.ToString() + " Salesperson" + (olvGroup.Contents.Count > 1 ? "s" : ""); } } }
private void olv_BeforeCreatingGroups(object sender, CreateGroupsEventArgs e) { e.Parameters.GroupByColumn = new OLVColumn("Group", "GroupOrder") { AspectToStringConverter = AspectToStringConverter }; }
private void fastUserGroupAvailableMembers_AboutToCreateGroups(object sender, BrightIdeasSoftware.CreateGroupsEventArgs e) { if (e.Groups != null && e.Groups.Count > 0) { foreach (OLVGroup olvGroup in e.Groups) { olvGroup.TitleImage = "UserGroupR"; olvGroup.Subtitle = "Available " + olvGroup.Contents.Count.ToString() + " User" + (olvGroup.Contents.Count > 1 ? "s" : ""); } } }