|
Hi Guys,
the code I was using for one of my previous application worked perfectly.
But not any more - using visual studio 2008 and .Net 2.0.
I read a couple of articles .... I also came accross this sample:
http://www.codeproject.com/KB/cs/prettygoodsplashscreen.aspx
Well, after downloading and running this sample I got the same error again.
when puttin this in the Stat-thread-method:
CheckForIllegalCrossThreadCalls = false;
it works fine, but this is not the right solution in my opinion.
I appreciate any suggestions for a clean solution, how to show a splascreen before starting the application / showing the main form. (couldnt find anything useful on the internet)
thanks
best regards
tom
ps- my startupform code:
public partial class StartUpForm : Telerik.WinControls.UI.ShapedForm
{
private static Thread _splashLauncher;
private static StartUpForm _splashScreen;
private static event Error _RaiseException = null;
public StartUpForm()
{
InitializeComponent();
radWaitingBar1.StartWaiting();
label2.Text = "Initalising Software.....please wait...";
}
~StartUpForm()
{
radWaitingBar1.EndWaiting();
}
private static void RaiseException(string ErrorMessage, Exception ex)
{
if (_RaiseException != null)
_RaiseException.Invoke(ErrorMessage, ex);
}
public static void ShowSplash()
{
try
{
_splashLauncher = new Thread(new ThreadStart(LaunchSplash));
_splashLauncher.IsBackground = true;
_splashLauncher.Start();
}
catch (ArgumentNullException ex)
{
RaiseException("The start parameter is a null reference", ex);
}
catch (ThreadStateException ex)
{
RaiseException("The thread has already been started.", ex);
}
catch (SecurityException ex)
{
RaiseException("The caller does not have the appropriate SecurityPermission.", ex);
}
catch (OutOfMemoryException ex)
{
RaiseException("There is not enough memory available to start this thread.", ex);
}
}
private static void LaunchSplash()
{
_splashScreen = new StartUpForm();
try
{
Application.Run(_splashScreen);
}
catch (Exception ex)
{
RaiseException("A main message loop is already running on the current thread", ex);
}
}
private static void CloseSplashDown()
{
Application.ExitThread();
}
public static void CloseSplash()
{
MethodInvoker mi = new MethodInvoker(CloseSplashDown);
_splashScreen.BeginInvoke(mi);
}
}
code for application entry point:
static class Program
{
///
/// Der Haupteinstiegspunkt für die Anwendung.
///
[STAThread]
static void Main()
{
try
{
//CheckForIllegalCrossThreadCalls = false;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
StartUpForm.ShowSplash();
Application.Run(new Form1());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.InnerException + ex.StackTrace + " " +
Thread.CurrentThread.ManagedThreadId);
}
}
}
|
|
|
|
|
Can you post the exception stack trace? The code looks ok to me.
|
|
|
|
|
Hi Senthil,
the code breaks every time on a different position. the 1st and 2nd stacktrace are from the main-form, where the exception occured. the last exception happened at the application-entry point [StatThread]
thanks for your help mate!
cheers
Tom
1.
" bei System.Drawing.Drawing2D.Matrix.get_Elements()\r\n bei Telerik.WinControls.TelerikHelper.GetBoundingRect(RectangleF rect, Matrix matrix)\r\n bei Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.Measure(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.MeasureOverride(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.Measure(SizeF availableSize)\r\n bei Telerik.WinControls.UI.ComboBoxEditorLayoutPanel.MeasureOverride(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.Measure(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.MeasureOverride(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.Measure(SizeF availableSize)\r\n bei Telerik.WinControls.RootRadElement.MeasureOverride(SizeF availableSize)\r\n bei Telerik.WinControls.RootRadElement.MeasureCore(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.Measure(SizeF availableSize)\r\n bei Telerik.WinControls.ComponentLayoutElementTree.PerformInnerLayout(Boolean performMeasure, Int32 x, Int32 y, Int32 width, Int32 height)\r\n bei Telerik.WinControls.ComponentLayoutElementTree.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)\r\n bei Telerik.WinControls.RadControl.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)\r\n bei System.Windows.Forms.Control.SetBounds(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)\r\n bei System.Windows.Forms.Control.set_Size(Size value)\r\n bei AngebotsControlDLL.ctrlRatenEinlage.InitializeComponent() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\AngebotsControlDLL\\ctrlRatenEinlage.Designer.cs:Zeile 113.\r\n bei AngebotsControlDLL.ctrlRatenEinlage..ctor() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\AngebotsControlDLL\\ctrlRatenEinlage.cs:Zeile 16.\r\n bei AngebotsControlDLL.ctrlAngebot.InitializeComponent() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\AngebotsControlDLL\\ctrlAngebot.Designer.cs:Zeile 57.\r\n bei AngebotsControlDLL.ctrlAngebot.Init() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\AngebotsControlDLL\\ctrlAngebot.cs:Zeile 59.\r\n bei AngebotsControlDLL.ctrlAngebot..ctor() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\AngebotsControlDLL\\ctrlAngebot.cs:Zeile 41.\r\n bei GUIAngebotsSoftware.Angebotssoftware.InitializeComponent() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\GUIAngebotsSoftware\\Angebotssoftware.Designer.cs:Zeile 213.\r\n bei GUIAngebotsSoftware.Angebotssoftware..ctor() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\GUIAngebotsSoftware\\Angebotssoftware.cs:Zeile 75."
2.
" bei System.Drawing.Drawing2D.Matrix.get_IsIdentity()\r\n bei Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.Measure(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.MeasureOverride(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.Measure(SizeF availableSize)\r\n bei Telerik.WinControls.RootRadElement.MeasureOverride(SizeF availableSize)\r\n bei Telerik.WinControls.RootRadElement.MeasureCore(SizeF availableSize)\r\n bei Telerik.WinControls.RadElement.Measure(SizeF availableSize)\r\n bei Telerik.WinControls.ComponentLayoutElementTree.PerformInnerLayout(Boolean performMeasure, Int32 x, Int32 y, Int32 width, Int32 height)\r\n bei Telerik.WinControls.ComponentLayoutElementTree.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)\r\n bei Telerik.WinControls.RadControl.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)\r\n bei System.Windows.Forms.Control.SetBounds(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)\r\n bei System.Windows.Forms.Control.set_Size(Size value)\r\n bei AngebotsControlDLL.ctrlRatenEinlage.InitializeComponent() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\AngebotsControlDLL\\ctrlRatenEinlage.Designer.cs:Zeile 136.\r\n bei AngebotsControlDLL.ctrlRatenEinlage..ctor() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\AngebotsControlDLL\\ctrlRatenEinlage.cs:Zeile 16.\r\n bei AngebotsControlDLL.ctrlAngebot.InitializeComponent() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\AngebotsControlDLL\\ctrlAngebot.Designer.cs:Zeile 57.\r\n bei AngebotsControlDLL.ctrlAngebot.Init() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\AngebotsControlDLL\\ctrlAngebot.cs:Zeile 59.\r\n bei AngebotsControlDLL.ctrlAngebot..ctor() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\AngebotsControlDLL\\ctrlAngebot.cs:Zeile 41.\r\n bei GUIAngebotsSoftware.Angebotssoftware.InitializeComponent() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\GUIAngebotsSoftware\\Angebotssoftware.Designer.cs:Zeile 213.\r\n bei GUIAngebotsSoftware.Angebotssoftware..ctor() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\GUIAngebotsSoftware\\Angebotssoftware.cs:Zeile 75."
3.
" bei System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)\r\n bei System.Windows.Forms.Control.BeginInvoke(Delegate method, Object[] args)\r\n bei System.Windows.Forms.Control.BeginInvoke(Delegate method)\r\n bei GUIAngebotsSoftware.StartUpForm.CloseSplash() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\GUIAngebotsSoftware\\StartUpForm.cs:Zeile 84.\r\n bei GUIAngebotsSoftware.Angebotssoftware..ctor() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\GUIAngebotsSoftware\\Angebotssoftware.cs:Zeile 96.\r\n bei GUIAngebotsSoftware.Program.Main() in E:\\Development\\AngebotsSoftware\\AngebotsSoftware\\GUIAngebotsSoftware\\Program.cs:Zeile 23."
|
|
|
|
|
I can't comment on the first two, as they seem to originate from designer code. Are you sure you're not accessing any properties of StartupForm from anywhere else in the code?
For the third, I'd guess that you called Close even before the form could initialize. You could try putting a IsHandleCreated check, or you could simply store that you called Close in a boolean variable and then close the form after it has completed initialization.
|
|
|
|
|
|
Hi,
i have a variable strpicture in c# code behind file and i want to pass this variable to a javascript function ShowPicture(take strpicture as parameter) how can i pass this variable to a javascript function if some one know please give me a hint.
KnightGuy
|
|
|
|
|
Hi,
i'm not really sure what you want to achieve, but if you want to pass the content of the strpicture-variable to a javascript-function during the "onLoad" you could use hiddenfields. Just put strpicture into a hiddenfield of your asp-form and access the value of this field during the "onLoad".
Should look like this (client-side):
function onload() {
value = document.getElementById("here goes the hiddenfield-name").value;
ShowPicture(value);
}
...
<body onload='javascript:onload()'>...
Hope this helps...
Regards
Sebastian
|
|
|
|
|
Or You can try this... by using RegisterStartupScript and pass the variable value from the code.
public void Page_Load(Object sender, EventArgs e)
{
// Define the name and type of the client scripts on the page.
String yourVariable = "yourVariable";
String csname1 = "PopupScript";
String csname2 = "ButtonClickScript";
Type cstype = this.GetType();
// Get a ClientScriptManager reference from the Page class.
ClientScriptManager cs = Page.ClientScript;
// Check to see if the startup script is already registered.
if (!cs.IsStartupScriptRegistered(cstype, csname1))
{
String cstext1 = "alert('Hello World');";
cs.RegisterStartupScript(cstype, csname1, cstext1, true);
}
// Check to see if the client script is already registered.
if (!cs.IsClientScriptBlockRegistered(cstype, csname2))
{
StringBuilder cstext2 = new StringBuilder();
cstext2.Append("script type=text/javascript; function DoClick(");
cstext2.Append(yourVariable);
cstext2.Append(") {");
cstext2.Append("Form1.Message.value='Text from client script.'} </");
cstext2.Append("script>");
cs.RegisterClientScriptBlock(cstype, csname2, cstext2.ToString(), false);
}
}
I hope this helps...
Cheers
vj
|
|
|
|
|
In Java the technology is/was called liveconnect. The best manner to do it now would be to write to the document stream new data or to have Javascript make continuous calls to the server.
In your case I would just write the assignment to the file.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Hello everyone,
Currently, I have a simple cache component, which outputs value by an input key. Now I want to design an asynchronous interface to provide BeginXXX and EndXXX function.
Are there any reference documents or any samples/advices of how to design asynchronous interface?
thanks in advance,
George
|
|
|
|
|
Start with the async design pattern[^]
Then use background workers, threads, or the thread pool to achieve your operations on a different thread.
Simon
|
|
|
|
|
Thanks Simon,
I have read up all the stuff you recommended below,
http://msdn.microsoft.com/en-us/library/aa719595(VS.71).aspx
Two more questions about the link,
1.
What means "containers that support waiting on objects"? Could you show me the which API/Class it means please?
2.
For the sample "Do not supply the callback delegate when beginning asynchronous operation" -- I read it but confused. The sample said "Do not supply the callback", but actually in the code callback is supplied here, any comments?
IAsyncResult asyncResult = primeFactorizer.BeginFactorize(
factorizableNum,
ref primefactor1,
ref primefactor2,
callback,
state);
3.
The document mentioned IMessage, actually I have never used it and not found quite good stuff on MSDN. Could you describe or recommend some good stuff to describe what IMessage is and how to use it?
regards,
George
|
|
|
|
|
chat sample code often use that, try to check here in code project maybe you will get lucky (luke)
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
What means "chat sample code"? Could you provide some links please?
regards,
George
|
|
|
|
|
I mean chat applications like the windows live messenger.
You can download here in codeproject sample code about it. Chat application need a lot of thread management because of the "clients" (asynchronous or synchronous connections), maybe helpfull for you.
Just type "chat" in search textbox up in this page, you will get lots of articles. I dont really know the best for you, better open all and collect the code you need for your project.
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Thanks nelsonpaixao,
Do you have any good stuff to recommended? I have found some but not interested in UI. I do not need UI. If there are some samples or documents which describe how to implement asynchronous pattern will be great!
Any recommendations?
regards,
George
|
|
|
|
|
i would like my application redirect after login.
Url: http://mySite.com/Login.aspx?ReturnUrl=http%3a%2f%2fmySite.com%2fpage.aspx%3f%26pid%3d1111%26%23Write
But don't know why the application return a error: A potentially dangerous Request.QueryString value was detected from the client (ReturnUrl="...1111&#Write").
Could anyone help?
modified on Thursday, October 9, 2008 5:12 AM
|
|
|
|
|
I think that it's the http:// part of the data that it reacts on. Try to use a relative url instead of a fully qualified url.
Otherwise you can turn of ValidateRequest in the @Page directive.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Because some idiot thought it would be fun to make ASP.Net websites crash randomly. This ill-designed "protection" is causing more harm than good in each and every website where it's not turned off.
And now it seems in ASP.Net MVC 2 it can't be turned off. I've already modified web.config and this idiotic message still appears.
Hey dude, I ain't ever gonna include that value unescaped in the HTML, shut the heck up!
|
|
|
|
|
Greetings to all!
I have a genric list of UIElements.
A Method passes me two variables:
the direction represented by an integer (+1 or -1)
and the type of the last used object in the list.
I need to find out the index of the last object and get the next one.
eg.:
List<uielements> _list = new List<uielements>(){new Dialog1(), new Dialog2(), new Dialog3()};
internal UIElement GiveNavigationItem(int p, Type lastElement)
{
var result = from o in _list
where o.GetType() == lastElement
select o;
return _list[result + p];
}</uielements></uielements>
Thank you in advance!
eza
|
|
|
|
|
Your using generics right?
You need to replace all the "<" and ">" signs in your post with "<" and ">". There's two buttons below the text box to help you. this will make your post easier to understand.
Simon
|
|
|
|
|
Unless I completely misunderstand what you want, just use this to get the last index:
int lastIndex = _list.Count - 1;
I'm not sure how you can get "the next one" if you're starting at the last index, because there is no "next one".
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Let's say I have the List with 5 Elements.
Bound is the one with the Number 4 and I receive the command "+1"/"oldType(element4)"
So I need to check which is the Index of oldType in the list (it's 4) and check if there is a 5 as well.
Yes, it is, so return the Element with the Index 5.
Now I have Number 5 bound and reveive a command "+1"/"oldType(element5)"
Check again the Index of the oldType I find out it's 5.
Now check again if there's a 6 -> no, so keep the old Control.
Otherewise -1 would work.
This lokks like this:
(-) [Container] (+)
and the Control is loaded inside the Container. + gets the next one (if available) - the previous one
Anyway I got my hint for this problem alreadyand I could solve it. Thank you for your help.
|
|
|
|
|
here you go:
static UIElement GiveNavigationItem(int p, Type lastElement)
{
var result = (from o in _list
where o.GetType() == lastElement
select _list[_list.IndexOf(o) + p]).FirstOrDefault();
return result;
}
|
|
|
|
|
Thank you! That solves my problem!
|
|
|
|
|