| | | StrataFrame Novice
       
Group: Forum Members Last Login: 04/11/2007 8:30:06 AM Posts: 99, Visits: 253 |
| | Hello, I am creating an application base that will be used for all of our WinForm executables. Attached is the project that illustrates the following three issues: 1. When applying themes to the application, the User Panel's label controls do not update with the chosen "theme" until I run the mouse cursor over the control. Is there a way to force a refresh? Should I have to? 2. Create a new security user and save the new record. Next Edit the same record and try to change the Permissions: Default Action and Restrictions. Notice there should not be any permission records available. The framework throws a Null Reference Exception: NullReferenceException Object reference not set to an instance of an object. Source : MicroFour StrataFrame Security Stack Trace: at MicroFour.StrataFrame.Security.UserEditor.SaveData(TreeNode Node, SetDataPiece SetPiece) at MicroFour.StrataFrame.Security.UserEditor.cboAction_SelectedIndexChanged(Object sender, EventArgs e) at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e) at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m) at System.Windows.Forms.ComboBox.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m) at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Should these controls be available if there are no Permission records? Is there a way to more gracefully trap this error? 3. Restart the application. Use the new user created in step 2 to sign on. A SQL exception will occur: System.Data.SqlClient.SqlException was unhandled by user code Class=16 ErrorCode=-2146232060 LineNumber=1 Message="Invalid object name 'dbo.SFSUserRolePermissionInfo'." Number=208 Procedure="" Server="DEVSVR2" Source=".Net SqlClient Data Provider" State=1 StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) at MicroFour.StrataFrame.Data.DbDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack) at MicroFour.StrataFrame.Data.SqlDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack) at MicroFour.StrataFrame.Data.DataLayer.GetDataTable(DbCommand Command, Boolean RegisterNotification) at MicroFour.StrataFrame.Business.BusinessLayer.FillDataTable(DbCommand CommandToExecute) at MicroFour.StrataFrame.Security.BusinessObjects.SFSUserRolePermissionInfoBO.FillByUser(Int32 UserPK) at MicroFour.StrataFrame.Security.LoggedInUser.CreatePermissionsListRolesOnly(Int32 UserPK) at MicroFour.StrataFrame.Security.LoggedInUser.CreateNew(SFSUsersBO UserInfo) at MicroFour.StrataFrame.Security.Login.AttemptLogin(Object sender, EventArgs e) at ApplicationBase.ETILogin.OnAttemptLogin() in C:\ETIDev\ApplicationBase\ETILogin.vb:line 30 at ApplicationBase.ETILogin.cmdOk_Click(Object sender, EventArgs e) in C:\ETIDev\ApplicationBase\ETILogin.vb:line 282 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.PerformClick() at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData) at System.Windows.Forms.ContainerControl.ProcessDialogKey(Keys keyData) at System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData) at System.Windows.Forms.Control.PreProcessMessage(Message& msg) at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg) at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
I am unsure about this issue. I do not see any tables, even in your samples that have this name. Could this be caused by the fact I do not have any securable forms created as of yet in this project? Any ideas would be greatly appreciated! Ben Kim
|
| | | | StrataFrame Novice
       
Group: Forum Members Last Login: 04/11/2007 8:30:06 AM Posts: 99, Visits: 253 |
| | Figured out #3. There are two views that I missed and that are not included in the "SecurityTables.SQL" script. Ben |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Today @ 9:05:01 AM Posts: 2,666, Visits: 1,878 |
| | 1. I will check the labels and see if an Invalidate() needs to be called when the ApplicationThemeChanged event is raised. Thanks for the notice. 2. I will have to reproduce this on our end and see what the problem is. 3. I'll make sure that the view's are added to the .sql script that is contained within the help documentation.
www.bungie.net |
| | | | StrataFrame Novice
       
Group: Forum Members Last Login: 04/11/2007 8:30:06 AM Posts: 99, Visits: 253 |
| | Thank you. Regarding the ApplicationThemeChanged event, where can I find documentation on how to use this feature? I need it for a third party control that will always be displayed (ie. user can change theme and I want to repaint the control's background with the appropriate theme colors). I have the following code currently on this form: Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)If ApplicationTheme.Theme <> ApplicationThemeName.NoTheme ThenTreeGX1.BackgroundStyle.BackColor = ApplicationTheme.ThemeProperties.ThemeFormBodyGradientBegin TreeGX1.BackgroundStyle.BackColor2 = ApplicationTheme.ThemeProperties.ThemeFormBodyGradientEnd ElseTreeGX1.BackgroundStyle.BackColor = NothingTreeGX1.BackgroundStyle.BackColor2 = NothingMyBase.OnPaint(e)End IfEnd Sub--- Which appears to work "most" of the time. Does the OnPaint event sometimes not get called when the theme is changing? To reproduce: 1. Use the application sample I sent you earlier 2. Add a new form - set the Window State to Maximize 3. Add code to Launch the form from the toolbar 4. Add a third party control (in my case I used TreeGX from DevComponents) 5. Add code similar to the above code snippet 6. Run the application 7. Launch the new form 8. Change the theme - Notice the form reacts correctly 9. "Restore" the new form window (form resizes) 10. Try to change the theme again (OR download and run the new sample attached to this message - you can download an eval of TreeGX from www.devcomponents.com if you do not have this control already) At this point the connection between the theming and the form are broken. You can minimize the application and maximize it so it redraws the correct them. Ideas on this one? Ben
|
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Today @ 9:05:01 AM Posts: 2,666, Visits: 1,878 |
| | You can handle the MicroFour.StrataFrame.UI.Windows.Forms.ApplicationTheme.ApplicationThemeChanged event. It's a shared event, so you can just type in: MicroFour.StrataFrame.UI.Windows.Forms.ApplicationTheme.ApplicationThemeChanged += new EventHandler(methodname); Then, just reset the properties on your control to the new theme colors.
www.bungie.net |
| | | | StrataFrame Novice
       
Group: Forum Members Last Login: 04/11/2007 8:30:06 AM Posts: 99, Visits: 253 |
| | Thanks Ben C. I am using VB.NET - here is the code for those that might be interested: In the InitForm method after Initializecomponent() AddHandler MicroFour.StrataFrame.UI.Windows.Forms.ApplicationTheme.ApplicationThemeChanged, AddressOf ThemeChangedPrivate Sub ThemeChanged(ByVal sender As Object, ByVal e As System.EventArgs) If ApplicationTheme.Theme <> ApplicationThemeName.NoTheme Then TreeGX1.BackgroundStyle.BackColor = ApplicationTheme.ThemeProperties.ThemeFormBodyGradientBegin TreeGX1.BackgroundStyle.BackColor2 = ApplicationTheme.ThemeProperties.ThemeFormBodyGradientEnd Else TreeGX1.BackgroundStyle.BackColor = Nothing TreeGX1.BackgroundStyle.BackColor2 = Nothing End If End SubIt works just fine now with the exception of the ThemedContainer and pnlSide in the sample I sent you. Thanks again! Ben |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Today @ 9:05:01 AM Posts: 2,666, Visits: 1,878 |
| I'm glad you got it working. It might be that we need to call invalidate when we handle that event.
www.bungie.net |
| | | | StrataFrame Novice
       
Group: Forum Members Last Login: 04/11/2007 8:30:06 AM Posts: 99, Visits: 253 |
| | Ben, In my MainFrame form, as a temporary workaround, I am capturing the ApplicationThemeChanged event and calling Me.Invalidate(True) to repaint the panel and themed container controls. Thank you for all of your help. I hope you find those pesky little bugs!  Just FYI, Ben |
| | | |
|