|
Works fine in my program. Where exactly is this code being executed?
|
|
|
|
|
Use the debugger: put a breakpoint on the first line of that code and step it through.
At a guess, I'd say it probably isn't being executed at all for some reason and the debugger will never hit the breakpoint as a result. If that happens, put another breakpoint at the start of the method containing that code and try again.
When you hit a breakpoint the debugger will stop and let you take control, stepping lines of code and looking at variables to see what is going on.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
If it is a winform try adding a line Application.DoEvents after you alter the value.
|
|
|
|
|
Generally speaking, if you need DoEvents then there is something very wrong with your application design!
In this case it won't help anyway: the Text property is just a string, if you look at ethe reference source:
[
Editor("System.ComponentModel.Design.MultilineStringEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor)),
SettingsBindable(true)
]
public override string Text {
get {
return base.Text;
}
set {
base.Text = value;
}
}
And the base class implementation (Control):
[
SRCategory(SR.CatAppearance),
Localizable(true),
Bindable(true),
DispId(NativeMethods.ActiveX.DISPID_TEXT),
SRDescription(SR.ControlTextDescr)
]
public virtual string Text {
get {
if (CacheTextInternal) {
return(text == null) ? "" : text;
}
else {
return WindowText;
}
}
set {
if (value == null) {
value = "";
}
if (value == Text) {
return;
}
if (CacheTextInternal) {
text = value;
}
WindowText = value;
OnTextChanged(EventArgs.Empty);
if( this.IsMnemonicsListenerAxSourced ){
for( Control ctl = this; ctl != null; ctl = ctl.ParentInternal ) {
ActiveXImpl activeXImpl = (ActiveXImpl)ctl.Properties.GetObject(PropActiveXImpl);
if( activeXImpl != null ) {
activeXImpl.UpdateAccelTable();
break;
}
}
}
}
} Doesn't do anything exotic with it either, certainly nothing that DoEvents would affect.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Of course, however if DoEvents shows an improvement and the label updates then you know there's an issue somewhere else.
|
|
|
|
|
OriginalGriff wrote: nothing that DoEvents would affect
Are you sure about that?
Have a look at the WindowText property setter[^]:
if (value == null) value = "";
if (!WindowText.Equals(value)) {
if (IsHandleCreated) {
UnsafeNativeMethods.SetWindowText(new HandleRef(window, Handle), value);
}
else {
if (value.Length == 0) {
text = null;
}
else {
text = value;
}
}
}
That call to UnsafeNativeMethods.SetWindowText will require the message loop to pump events before the control is updated.
Which is exactly what DoEvents was intended for.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes, but the text and / or the WindowText are already set by that point, and they are what the getter uses to provide the data. So the display may not be up-to-date yet, but the property return value will be.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
DoEvents doesn't run the message pump or even start a new one. It's what I will call a kludge that grabs messages out of the queue and processes them itself, bypassing the pump.
The problem comes in when a message causes another event to be triggered, possibly executing event code out of order of what is expected. For example, you're adding items to a control when the user clicks the application close button. If not written properly, your code will suddenly throw an unhandled IndexOutOfRangeException because the controls will no longer exist and your code is still adding items to it.
While it may be the "easy fix" for the short term, it's a long term pain in the ass when you get to testing the code in UAT.
|
|
|
|
|
|
I'm trying to overlying a 3d model on a skeleton using kinect v2 and I faced a lot of problem with that specially that I'm totally fresh in this field ,please can you help me in that as soon as possible
|
|
|
|
|
Are you student? Ask your instructor.
Are you self-paced? Get a book, there are multiple articles on CodeProject that can help you get started on this subject — top right corner.
You can also Google for errors, to see if your model had a problem.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
actually yes I'm a student but my instructor doesn't have a lot of information about kinect v2 even on google there is a leak information all the resources is about kinect v1 so if you have something useful for me tell me
|
|
|
|
|
Member 12890172 wrote: in that as soon as possible We're volunteers, and your question is as important as any other.
If you have a specific question on the subject, then yes, we may be able to help. That would still mean that you'd be writing the code though.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
what I'm did until now is drowing a skeleton and making a 2d image moving with the skeleton what I'm really need is making the 3d model moving with it. I can add the model but I don't know how to connect it with the skeleton all the source code that I found is on kinect v1
|
|
|
|
|
The term is "skinning a model"; usually a "wire-frame" (instead of a "skeleton"); unless it really was a "skeleton", in which case I think you would still be skinning (except with thicker "wires") ... so that is what I would research.
|
|
|
|
|
Hi All,
I am using the following code to display a text file when the application first runs but have a slight issue.
private static void CheckFirstRun()
{
if (Settings.Default.FirstRun)
{
Process.Start("notepad.exe", "release-notes.txt");
Settings.Default.FirstRun = false;
Settings.Default.Save();
}
}
The setting default is set to True. It worked fine the first time I deployed it using ClickOnce and I was expecting FirstRun to default back to True on the next deployment but it's storing the setting as False.
All my google searches point to persisting the setting between deployments but in this instance I want the opposite to happen. I need the setting to default back to True so I can show the release notes.
Can anyone advise on what I am missing?
|
|
|
|
|
The user settings are designed for the user to save their preferences for an application. Therefore, an update does not, and should not, overwrite these values.
Your best option for doing this type of thing is to save a version number in the setting file. On startup, check the current version against the setting version, and if different, show your release notes and save the new version.
Cheers,
Mick
------------------------------------------------
It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
|
|
|
|
|
Not sure if this'll help as I have no ClickOnce experience (WiX# <3) but if you can set certain routines to run on an install you could try to overwrite that setting during the install. Another option might be to set that setting in its own ConfigurationSection and simply do a full overwrite of that section during any installation. If you have any questions on how to do that I might be able to help since I have experience using ConfigurationManager and the various other classes to manually handle settings programmatically, but I don't know much about ClickOnce and what it allows unfortunately.
EDIT: Looking over ClickOnce, it appears you can only update files that have changed (unlike Windows Installer). This would necessitate overwriting any user settings if updating the base settings file. A solution might be to save this particular setting in its own programmatically accessed file which you can overwrite at will since the user will have no settings in it.
string filePath = "/Example/Program.exe.config";
ExeConfigurationFileMap configFile = new ExeConfigurationFileMap() {ExeConfigFilename = filePath;}
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFile, ConfigurationUserLevel.None, false);
config.AppSettings.Settings.Add("FirstRun", "true");
config.AppSettings.Settings["FirstRun"].Value = "false";
bool firstRun = Convert.ToBoolean(config.AppSettings.Settings["FirstRun"].Value);
config.Save(ConfigurationSaveMode.Modified);
This technique allows you to have a settings file that has a manual location and is manually loaded separate from the default (and automatically handled) settings file. Change ConfigurationUserLevel enumeration and other parameters as needed 
modified 6-Dec-16 1:17am.
|
|
|
|
|
Thanks Guys. The solution in the end was this one:
if (ApplicationDeployment.IsNetworkDeployed)
{
ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment;
if (deployment.IsFirstRun)
{
try
{
Process.Start("notepad.exe", "release-notes.txt");
}
catch (InvalidOperationException ioe)
{
return;
}
}
}
|
|
|
|
|
Suppose I have my own web server and I have a web app that allows logged in users to publish their web pages to my web server simply by clicking the Publish button. Is it possible to create such a button using C#?
Basically when the Publish button is clicked, it will create and setup a web folder on the web server if one doesn't already exist, set folder permissions, add other files needed to host a web site, and ftp the web pages to the created web folder.
Please point me to an article or perhaps a video tutorial if you know of any that will help, thanks.
modified 5-Dec-16 16:55pm.
|
|
|
|
|
You don't want to muck with folders and permissions.
You want a "database" / data store (for storing "content"), and a web server / app that can serve up "dynamic" content.
Maybe a "Content Management System" (CMS).
I hear "Magento" (Community Edition?) is all the rage.
|
|
|
|
|
Hi Gerry, Thanks for replying. I am in the process of learning how to host web pages on my own server. Also I would like to alleviate the burden of having to manually setup all the necessities using code.
Basically I want to create a web app where users can login, upload their pages to a temporary folder, and finally publish their pages (in the temporary folder) by simply clicking the Publish button.
What this means is that the code in the Publish button would have to check to see if the user already has a web folder on the web server.
If not, the web folder along with all the necessary files will be created on the web server by the code in the Publish button.
This is the part I'm interested in learning how to do.
modified 6-Dec-16 7:50am.
|
|
|
|
|
I already said I thought your "folders" idea was a bad idea and will be an administrative nightmare.
Just recently I had someone contact me to help setup their "Windows Server" (that they had contracted) so they could "share documents".
For $5 a month, I suggested they get a SharePoint Online account instead, and add new users (staff) as the business grew. (With SharePoint, anybody can create as many "sites" as they want).
He's completely satisfied with the "solution".
Don't run before you can crawl.
|
|
|
|
|
You might find this[^] a useful starting point.
This space for rent
|
|
|
|
|
c9eeaebf088072fe46dc27281bea8c977 , cb45493361fe37014ba5d8644bd76c21a
please try help me out read these codes
|
|
|
|