Good morning,
I have a bit of code that I’ve used in the past to make a dashboard with two updatable queries, and a third blank panel to hold some text labels and a button.
In my past dashboard the two grid queries were set to refresh on load, and the dashboard was set to automatically refresh on load. In addition, I have a custom function called RefreshAll that will manually call the refresh all tool to update all the queries.
This all works great in my first dashboard. But now that I am doing it in a second dashboard, only one of my two queries will update automatically. If I click the grid that does not update, I can click refresh and get the data, but refresh all, makes that grid go blank. Very strange behavior!
Here is my customized form code that works great in my other dash. I have checked all the usings, settings, and properties for these form elements and they all match.
// **************************************************
// Custom code for MainController
// Created: 10/3/2019 10:50:55 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;
using System.Reflection;
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
private EpiDataView edvV_OpenOrderRequests_Fast_1View;
private EpiDataView edvV_OurUnmatchedOrders_faster_1View;
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
this.edvV_OpenOrderRequests_Fast_1View = ((EpiDataView)(this.oTrans.EpiDataViews["V_OpenOrderRequests_Fast_1View"]));
this.edvV_OpenOrderRequests_Fast_1View.EpiViewNotification += new EpiViewNotification(this.edvV_OpenOrderRequests_Fast_1View_EpiViewNotification);
this.edvV_OurUnmatchedOrders_faster_1View = ((EpiDataView)(this.oTrans.EpiDataViews["V_OurUnmatchedOrders_faster_1View"]));
this.edvV_OurUnmatchedOrders_faster_1View.EpiViewNotification += new EpiViewNotification(this.edvV_OurUnmatchedOrders_faster_1View_EpiViewNotification);
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
this.epiButtonC1.Click += new System.EventHandler(this.epiButtonC1_Click);
CreateRowRuleV_OpenOrderRequests_Fast_1ViewCalculated_toggleEquals_1();;
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.epiButtonC1.Click -= new System.EventHandler(this.epiButtonC1_Click);
this.edvV_OpenOrderRequests_Fast_1View.EpiViewNotification -= new EpiViewNotification(this.edvV_OpenOrderRequests_Fast_1View_EpiViewNotification);
this.edvV_OpenOrderRequests_Fast_1View = null;
this.edvV_OurUnmatchedOrders_faster_1View.EpiViewNotification -= new EpiViewNotification(this.edvV_OurUnmatchedOrders_faster_1View_EpiViewNotification);
this.edvV_OurUnmatchedOrders_faster_1View = null;
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void epiButtonC1_Click(object sender, System.EventArgs args)
{
//Call Actions
oTrans.PushStatusText("Running Custom Actions...", false);
//check to see if there are any boxes checked in OurUnmatched, if so, then execute custom action
oTrans.PushStatusText("Processing commands for our unmatched orders...", false);
//V_OurUnmatchedOrders_faster_1View
var edv = oTrans.Factory("V_OurUnmatchedOrders_faster_1View");
BAQRunCustomAction(edv, "ProcessCommands");
//check to see if there are any boxes checked in Unmatched, if so, then execute custom action
oTrans.PushStatusText("Processing commands for unmatched orders...", false);
//V_OpenOrderRequests_Fast_1View1
edv = oTrans.Factory("V_OpenOrderRequests_Fast_1View");
BAQRunCustomAction(edv, "ProcessCommands");
//Call Dash Refresh All
RefreshAllBAQs();
}
private void MainController_Load(object sender, EventArgs args)
{
// Add Event Handler Code
epiLabelC3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
epiLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
epiLabelC2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
MainController.WindowState = FormWindowState.Maximized;
}
private void CreateRowRuleV_OpenOrderRequests_Fast_1ViewCalculated_toggleEquals_1()
{
// Description: new2
// **** begin autogenerated code ****
RuleAction warningV_OpenOrderRequests_Fast_1View_RowAction = RuleAction.AddRowSettings(this.oTrans, "V_OpenOrderRequests_Fast_1View", true, SettingStyle.Warning);
RuleAction[] ruleActions = new RuleAction[] {
warningV_OpenOrderRequests_Fast_1View_RowAction};
// Create RowRule and add to the EpiDataView.
RowRule rrCreateRowRuleV_OpenOrderRequests_Fast_1ViewCalculated_toggleEquals_1 = new RowRule("V_OpenOrderRequests_Fast_1View.Calculated_toggle", RuleCondition.Equals, 1, ruleActions);
((EpiDataView)(this.oTrans.EpiDataViews["V_OpenOrderRequests_Fast_1View"])).AddRowRule(rrCreateRowRuleV_OpenOrderRequests_Fast_1ViewCalculated_toggleEquals_1);
// **** end autogenerated code ****
}
private void edvV_OpenOrderRequests_Fast_1View_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
String myRef ="724d4f74-671e-4121-a733-bc073bdb144d";
EpiUltraGrid mesGrid;
mesGrid = (EpiUltraGrid)csm.GetNativeControlReference(myRef);
mesGrid.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;
mesGrid.DisplayLayout.Appearance.FontData.SizeInPoints = 10;
mesGrid.Parent.Width = 625;
mesGrid.Width = 625;
mesGrid.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;
mesGrid.DisplayLayout.PerformAutoResizeColumns(false, PerformAutoSizeType.AllRowsInBand, true);
mesGrid.Text = mesGrid.Rows.Count + " - Open Requests to be Created or Current Release Updated";
if (mesGrid.Rows.Count >=1)
{
BoldTopLine(myRef);
}
}
private void edvV_OurUnmatchedOrders_faster_1View_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
String myRef ="64a4559a-a942-4836-98d0-eb53fb6fc5c0";
EpiUltraGrid mesGrid;
mesGrid = (EpiUltraGrid)csm.GetNativeControlReference(myRef);
mesGrid.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;
mesGrid.DisplayLayout.Appearance.FontData.SizeInPoints = 10;
mesGrid.Parent.Width = 785;
mesGrid.Width = 785;
mesGrid.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;
mesGrid.DisplayLayout.PerformAutoResizeColumns(false, PerformAutoSizeType.AllRowsInBand, true);
mesGrid.Text = mesGrid.Rows.Count + " - Our Open Releases to be Closed or Updated";
if (mesGrid.Rows.Count >=1)
{
BoldTopLine(myRef);
}
}
void RefreshAllBAQs()
{
oTrans.PushStatusText("Refreshing all views. Please be patient...", false);
MainController.AppControlPanel.HandleToolClick("RefreshAllTool", new
Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshAllTool"], null));
oTrans.PushStatusText("Done!", false);
}
void BAQRunCustomAction(EpiDataView iEdv, string iActionID)
{
BAQDataView BAQView = (BAQDataView)iEdv;
Assembly assembly = Assembly.LoadFrom("Ice.Lib.EpiClientLib.dll");
Type t = assembly.GetType("Ice.Lib.Framework.BAQUpdater");
MethodInfo mi = t.GetMethod("BAQRunCustomAction", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
mi.Invoke("Ice.Lib.Framework.BAQUpdater", new object[]{BAQView, iActionID});
}
void BoldTopLine(String myRef)
{
EpiUltraGrid mesGrid;
mesGrid = (EpiUltraGrid)csm.GetNativeControlReference(myRef);
UltraGridGroupByRow groupByRow = (UltraGridGroupByRow)mesGrid.Rows[0];
groupByRow.Appearance.FontData.Bold = DefaultableBoolean.True;
groupByRow.Appearance.FontData.SizeInPoints = 14;
}
}
Has anyone ever experienced this with the refresh all tool? If so, did you figure out a solution? I need that refresh all tool to work just like it does for my other dashboards. Debugging in VS indicates that there is a problem in the BoldTopLine function. Again, that works great in my other dashboards.
Unable to cast object of type 'Infragistics.Win.UltraWinGrid.UltraGridRow' to type 'Infragistics.Win.UltraWinGrid.UltraGridGroupByRow'.
Thanks for your time!
Nate