|
what is static in a base (or abstract) class, is shared by all its instances, both direct and inherited instances.
what is static in a derived class, is shared by instances of that class only, hence:
- move your dictionary to each of the derived classes;
- pass it on as a parameter to the methods that need it (RegisterComponent in the base class).
|
|
|
|
|
Do you really need to be able to inherit from the base class? If not you can make it non-abstract and generic. That way any instance of the class with the same type will share same dictionary and every other type will have its own dictionary.
|
|
|
|
|
The key is "nameAttribute.Name" which "is unique to each propertyType". Change it that it is unique to each combination of class and propertytype.
|
|
|
|
|
Hey guys, i have an Animated GIF as a background i just use a picture box so that the animation plays, but when i put a label with text over top of it were the animation goes behind that label makes the GIF's animation freeze in place were the label sits, is there anyway to get it so that the labels transparency doesn't freeze the animation that would be going behind the label?
|
|
|
|
|
I'm afraid not.
The label transparency isn't really transparent, just a snapshot of what is behind at the time the background paint event is raised.
The only way to get it to work would be to invoke the Background Paint on the label from a timer, and hope the refresh synchrinises with the animation behind.
Probably easier in the long run to just edit the gif and add your text, or use a series of single images that you animate yourself from a timer, painting the text on top at runtime.
|
|
|
|
|
Okay, Ill just not use an animated Gif as the background I can just make one image then slice it up to put on my project, thanks for the help.
|
|
|
|
|
I have the following xml file and I tried the ReadXML() but it's populating everything.. I need to populate the <Contacts> element with three columns into the DataGrid
Description
Number
GUID or if't not possible then GUID as tag for the row.
<?xml version="1.0" encoding="utf-8"?><br />
<Resume><br />
<Education /><br />
<Contacts><br />
<Contact ID="c4411c02-4556-4809-861b-60b68f9820de"><br />
<Decsription>Mobile</Decsription><br />
<Number>1111</Number><br />
</Contact><br />
<Contact ID="cea724c3-e81a-494c-bcf6-e9a67e85d2e6"><br />
<Decsription>Residence</Decsription><br />
<Number>22222</Number><br />
</Contact><br />
<Contact ID="73298407-06fa-462a-be30-254a5318176c"><br />
<Decsription>Mobile</Decsription><br />
<Number>7878888</Number><br />
</Contact><br />
</Contacts><br />
<Detail ID="ae61a549-ca27-4f93-9d5a-8b89bebc4bf9"><br />
<Title>RESUME</Title><br />
<Objectives>testtt</Objectives><br />
<Created>2010-03-20T13:59:28.028866+03:00</Created><br />
<Updated>2010-03-20T13:59:28.028866+03:00</Updated><br />
<PersonalInfoTitle>Personal Info</PersonalInfoTitle><br />
<FullName>Yahoo</FullName><br />
<Nationality>CL</Nationality><br />
<DateOfBirth>1973-03-20T00:00:00</DateOfBirth><br />
<DateOfBirthFormat>dd/MM/yyyy</DateOfBirthFormat><br />
<Gender>F</Gender><br />
<MaritalStatus>Married</MaritalStatus><br />
<MailingAddress>mailing adr</MailingAddress><br />
<City>manama</City><br />
<Country>AW</Country><br />
<Email>jrahm@bbbb.com</Email><br />
<ContactsTitle>Contacts</ContactsTitle><br />
</Detail><br />
</Resume>
-- Modified Saturday, March 20, 2010 10:35 AM
|
|
|
|
|
As I have been asking you below, format the xml so it is readable and fits on the screen
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
i did already
I can see it fit here
|
|
|
|
|
This is more readable
<?xml version="1.0" encoding="utf-8" ?>
<Resume>
<Education />
<Contacts>
<Contact ID="c4411c02-4556-4809-861b-60b68f9820de">
<Decsription>Mobile</Decsription>
<Number>1111</Number>
</Contact>
<Contact ID="cea724c3-e81a-494c-bcf6-e9a67e85d2e6">
<Decsription>Residence</Decsription>
<Number>22222</Number>
</Contact>
<Contact ID="73298407-06fa-462a-be30-254a5318176c">
<Decsription>Mobile</Decsription>
<Number>7878888</Number>
</Contact>
</Contacts>
<Detail ID="ae61a549-ca27-4f93-9d5a-8b89bebc4bf9">
<Title>RESUME</Title>
<Objectives>testtt</Objectives>
<Created>2010-03-20T13:59:28.028866+03:00</Created>
<Updated>2010-03-20T13:59:28.028866+03:00</Updated>
<PersonalInfoTitle>Personal Info</PersonalInfoTitle>
<FullName>Yahoo</FullName>
<Nationality>CL</Nationality>
<DateOfBirth>1973-03-20T00:00:00</DateOfBirth>
<DateOfBirthFormat>dd/MM/yyyy</DateOfBirthFormat>
<Gender>F</Gender>
<MaritalStatus>Married</MaritalStatus>
<MailingAddress>mailing adr</MailingAddress>
<City>manama</City>
<Country>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tEC3OiAAAAGAOgooormNQooooA5zWLdYLsMgAWQZwPWs+tnX+tv/wL+lY1dEHdGb3CgdaKB1qhB3oo70UAFaGjf8hBf901n1r6CwEsy9yoP5f/AK6mWw1ublFFFc5oFFFFAGHr3+th/wB01kVva6wFtGvcv/SsGt4fCZy3CgdaKB1qxB3oo70UAFWtOuDb3iMOjHac+hqrRSauB2dFVrG5+1WiSfxDhvrVmuZqxqFFFRzSrBC8rdFGaAMLWbgy3flcbY/5ms2nyyGWVnbqxzTK6UrKxkwoHWigdaYB3oo70UAFFFOjRpZFRRlmOBQBv6IuLEn1c1pU2ONYkCIAAPSnVzN3dzRBVXUl3afMP9nNWqCAQQRkHqKFoxnGUVYvofIvJE24XOVx0xVeuhGQUDrRQOtMAPWpIoZZm2xIzH2FbNroqJ81wd7f3R0rUSNI0CooVR2ArN1F0KUTFt9Dc8zuFH91eTWtBaQWy4ijAPr3P41NRWbk2UkkFFFFSMKKKKAI5oIp12yxq49+1ZVxoeSWt5Mf7L/41s0U1JrYTSZyU9rNbnEsZX37VCOtdkQGBBAIPY1n3OjwTfNF+6f26flWqqdyXE0aKKKxLCiiigAooooAKKKKACiiigAooooA/9k=</Photo>
<ContactsTitle>Contacts</ContactsTitle>
</Detail>
</Resume>
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
I am using this code to read one the childs using its attribule but it's always reading the first child though the selected GUID is the last child? what's the problem:
xml_documen.SelectSingleNode("/Resume/Contacts/Contact[@ID='73298407-06fa-462a-be30-254a5318176c']");
txtContactNumber.Text = xml_documen.GetElementsByTagName("Number")[0].InnerText;
|
|
|
|
|
You'll need to clarify a little. The problem is with the first line? how is the second line involved?
I don't see any problem with the first line, unless you have more than one contact node with the same attribute value.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
what ever GUID i use it will just display the first only!!
|
|
|
|
|
this is my XML:
<?xml version="1.0" encoding="utf-8"?><br />
<Resume><br />
<Education /><br />
<Contacts><br />
<Contact ID="c4411c02-4556-4809-861b-60b68f9820de"><br />
<Decsription>Mobile</Decsription><br />
<Number>1111</Number><br />
</Contact><br />
<Contact ID="cea724c3-e81a-494c-bcf6-e9a67e85d2e6"><br />
<Decsription>Residence</Decsription><br />
<Number>22222</Number><br />
</Contact><br />
<Contact ID="73298407-06fa-462a-be30-254a5318176c"><br />
<Decsription>Mobile</Decsription><br />
<Number>7878888</Number><br />
</Contact><br />
</Contacts><br />
<Detail ID="ae61a549-ca27-4f93-9d5a-8b89bebc4bf9"><br />
<Title>RESUME</Title><br />
<Objectives>testtt</Objectives><br />
<Created>2010-03-20T13:59:28.028866+03:00</Created><br />
<Updated>2010-03-20T13:59:28.028866+03:00</Updated><br />
<PersonalInfoTitle>Personal Info</PersonalInfoTitle><br />
<FullName>Yahoo</FullName><br />
<Nationality>CL</Nationality><br />
<DateOfBirth>1973-03-20T00:00:00</DateOfBirth><br />
<DateOfBirthFormat>dd/MM/yyyy</DateOfBirthFormat><br />
<Gender>F</Gender><br />
<MaritalStatus>Married</MaritalStatus><br />
<MailingAddress>mailing adr</MailingAddress><br />
<City>manama</City><br />
<Country>AW</Country><br />
<Email>jrahm@bbbb.com</Email><br />
<Photo>/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCABlAGADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTl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y4ijAPr3P41NRWbk2UkkFFFFSMKKKKAI5oIp12yxq49+1ZVxoeSWt5Mf7L/41s0U1JrYTSZyU9rNbnEsZX37VCOtdkQGBBAIPY1n3OjwTfNF+6f26flWqqdyXE0aKKKxLCiiigAooooAKKKKACiiigAooooA/9k=</Photo><br />
<ContactsTitle>Contacts</ContactsTitle><br />
</Detail><br />
</Resume>
|
|
|
|
|
Reformat this appropriately so it fits on the screen.
You also did not answer my question
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
no.. every one has a different GUID as shown in my xml
|
|
|
|
|
You still DID NOT answer the question. What does the second line have to do with it? The first line works fine and returns the correct node.
You also did not correct the xml post.
If you want assistance, please read, follow the directions, and answer the questions.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
i am sorry.. i didn't read the question
Actually I need to read a specific node by referring to it's attribute// that's why in this example:
xml_documen.SelectSingleNode("/Resume/Contacts/Contact[@ID='73298407-06fa-462a-be30-254a5318176c']");
I am trying to read that specific node but it's giving the result of the first node
|
|
|
|
|
I've tried your example and it returns the the 3rd contact node as expected.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
jrahma wrote: txtContactNumber.Text = xml_documen.GetElementsByTagName("Number")[0].InnerText;
This line will always return the first node.
I think what you are after is;
XmlNode selectedNode = xml_documen.SelectSingleNode("/Resume/Contacts/Contact[@ID='73298407-06fa-462a-be30-254a5318176c']");
txtContactNumber.Text = selectedNode.SelectSingleNode("Number").InnerText;
|
|
|
|
|
I have some function, which makes HttpWebRequest and returns response (string).
Everything works fine except cases when it gets 502 status - Bad Gateway.
In this case try-catch block:
try
{
m_Rresponse = (HttpWebResponse)m_HttpWebRequest.GetResponse();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
if (m_Rresponse.StatusCode == HttpStatusCode.BadGateway || m_Rresponse.StatusCode == HttpStatusCode.GatewayTimeout ||
m_Rresponse.StatusCode == HttpStatusCode.InternalServerError || m_Rresponse.StatusCode == HttpStatusCode.ServiceUnavailable)
{
Console.WriteLine("Sleeping 10 seconds...");
Thread.Sleep(10000);
}
}
The question is why In case of BadGatway "Sleeping 10 seconds..." never printed?
Thanks
|
|
|
|
|
Since I don't have any way of generating a 502 error, I have to assume that is does not set m_Rresponse when it throws an exception - which makes sense, since the throw instruction will terminate processing and transfer control to the catch block immediately. The documentation[^] says "If a WebException is thrown, use the Response and Status properties of the exception to determine the response from the server." which makes more sense to me than relying on an exception completing the instruction that detected the problem.
I am surprised it works for any error, not just 502!
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
OriginalGriff wrote: I am surprised it works for any error
That makes a lot of sense.
|
|
|
|
|
what the meaning of this code?
class MouseInvoker
{
#region Declaration
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
private const int MOUSEEVENTF_LEFTDOWN = 0x02;
private const int MOUSEEVENTF_LEFTUP = 0x04;
private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
private const int MOUSEEVENTF_RIGHTUP = 0x10;
#endregion
#region Move Cursor
public static void move(int X, int Y)
{
Cursor.Position = new Point(X, Y);
}
#endregion
#region Left Click
public static void leftClick(int X, int Y, int count)
{
for (int c = 0; c < count; c++)
{
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, X, Y, 0, 0);
System.Threading.Thread.Sleep(100);
}
}
#endregion
#region Right Click
public static void rightClick(int X, int Y, int count)
{
for (int c = 0; c < count; c++)
{
mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, X, Y, 0, 0);
System.Threading.Thread.Sleep(100);
}
}
#endregion
}
|
|
|
|