I have an urgent problem..I am developing a windows mobile 6.0 application and the menu item key (which I putted on left side to serve as a back button) only fires when I double click it or after several one clicks..but the items on the right side which in a menu works fine..
I see on the screen that it is clicked(phone vibrates) but it does not fall into the clickitem action.
going crazy someone helps please!!
it does not hit the actionMenuItem_Click_1() method at all if I dont double click
this.actionMenuItem.Text = "select";
this.actionMenuItem.Click += new System.EventHandler(this.actionMenuItem_Click_1);
private void actionMenuItem_Click_1(object sender, EventArgs e)
{
if (actionMenuItem.Text == "Back")
{
if (dialogStack.Count > 0)
{
navigateBack();
}
}
}
First of all - and this is very, very important - never, ever mark a question as urgent. Everyone who asks a question is looking for an answer here and they typically want or need the answer in a short period of time. Marking yours as urgent seems to say that you feel that your question is more important than every other question or that for some reason you should get some sort of priority treatment. My reaction when I see "urgent" is to ignore the question completely.
All answers here are given by volunteers for free. If you have some "urgent" issue that you need an immediate answer to, go pay someone to solve it where they have a contractual obligation to meet your schedule. Otherwise just ask your question.
Second, this is not a good question. The title needs to be a question. "URGENT" is not a question. You' also given us a very generalized behavior description, but we see absolutely no code. We don't see any description of what you've done to try to fix it. Not only are you asking us to give your question priority, you're also asking us to read your mind and divine the behaviors and code that only you see. We don't even know what kind of device this is or whenther it's WinMo Standard or Professional.
So let me shake shaking my magic 8-ball and see what it says about your issue given what we know...it says that your menu click handler calls some long-running method and is therefore interfering with subsequent clicks.
Have you tried debugging? what are the values of actionMenuItem.Text and dialogStack.Count when you step trough your code using the debugger?
Thanks for all answers, I solved it..I am doing some weird stuff in onpaint() that is interfering..
Related
I am trying to replace all (or at least most) the Thread.Sleep() in my tests and it seems System.Timers can do the work but I don't know how to implement it.
Or if you guys know another replacement please let me know.
I would really appreciate it if somebody helps me here.
Thank you.
Edit: Sorry, it's my first question here, I should have given an example:
public void AdditionalCardIssueNoBankBranchSelected()
{
additionalCardApplicationPage.ClearBankConsultantCodeField();
additionalCardApplicationPage.TypeSalesOfficer();
additionalCardApplicationPage.TypeEIKBankCustomerAndPressGetDataButton();
additionalCardApplicationPage.ChooseMainCard();
chooseMainCardPage.TypeCustomerEikAndPressSearchButton();
Thread.Sleep(1000);
bankCardSearchPage.SelectFirstValidBankCardOther();
chooseMainCardPage.PressChooseMainCardButton();
additionalCardApplicationPage.PressStartApplicationButton();
Thread.Sleep(1000);
IAlert alert = driver.SwitchTo().Alert();
alert.Accept();
Assert.IsTrue(additionalCardApplicationPage.BankBranchCodeAlert.Displayed);
}
So pretty much everywhere I have Thread.Sleep() is because I am waiting for the page to load in full because if it doesn't next action will not happen as the element I want to interact with is not visible yet.
Sometimes bankCardSearchPage.SelectFirstValidBankCardOther() will not go thru because the table where the cards are is not visible yet.
I hope I explained it well. Thank you.
Thread.sleep()
is an explicit wait but worst of it's kind.
best one is below (Explicit wait):
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));
wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//span[text()='OK']/..")));
You can pretty much replace everything with the dynamic wait mentioned above.
What it would do is that to look for web element in DOM for every 500ms until 20 seconds (as we have defined 20 in the above object creation), if found it would return the web element, if not a Timeout exception will be raised.
Windows 10.0.18362,
Visual Studio 16.4.5,
.NET 4.8.03752
Hi there
I wanted to setup a keyboard short cut to do something. So I set up the following code:
private void MainWindow_KeyDown(object sender, KeyEventArgs e)
{
if (Keyboard.IsKeyDown(Key.D))
{
// do something
}
}
Basically it works. The only (very nasty) thing that happens is that as soon as I implement "Keyboard.IsKey...(...)" into the code, run it, then pressing any key makes the window scales down (to
about 80%) totally out of nowhere.
I can replace the condition with "true" and it just runs as expected without any random out of nowhere scaling.
Did any one out there experience something similar? This behaviour does absolutely not make any sense, so searching for solutions obviously leads in dead ends only.
Thanks for any help or recommendation.
We need a screenshot of our app for a unit test. CaptureScreen() and CopyFromScreen() somehow ignore the app and return pictures of an empty desktop. So we wrote this to fake a PrtScn keystroke:
public static Bitmap GetAltScreenshot()
{
Clipboard.Clear();
SendKeys.SendWait("{PRTSC}");
while (!Clipboard.ContainsImage())
{
Thread.Sleep(500);
}
return new Bitmap(Clipboard.GetImage());
}
Alt isn't part of the keystroke, so this should return a bitmap of the entire screen. Yet somehow this snippet returns just the focused window. Which is fine, that solves our problem - but we don't understand how.
Why does this return a shot of just the focused window, instead of the entire monitor?
There is in fact a "reason", turn to the MSDN Library article that documents the key abbreviations you can use. Note the entry for PRINT SCREEN:
{PRTSC} (reserved for future use)
The is a somewhat clumsy way of saying "We know it doesn't work, maybe will fix that some day". That day hasn't yet arrived. So you are probably testing the failure mode of this key and actually like the way it works. This is of course not healthy, they may actually fix the problem some day and break your program.
Do note the Note about the <appSettings> entry that you can add to your .config file, further down that same MSDN page. I suspect, but do not know for a fact, that the SendInput method is more reliable.
It's very clear in the debugger that the dictionary is populated with the values; so why does it not even ENTER the loop at all? I've tried stepping through and I get nothing. It just skips over the loop. Period. I use similar techniques elsewhere and have no issues. This is all on the same thread so I don't understand.
You can see a video of some of the frustration here: http://youtu.be/XernyY5-BAo
I expect the name == e.Name is false
The compiler probably optimized stepping in this case.
or maybe name is null and it has an exception?
I hate to be that guy and answer my own question but I feel like someone else could learn something from my error.
It turns out, the EntityManager from the base class was implemented separately by the base class in this case, it was over-ridden with the new keyword. This was causing the lists to separate and cause all sorts of ugly issues. Don't hide your inheritance trees, everyone! Always double check your implementations! Thanks for all the help everyone; I still don't know why Visual Studio was displaying different values than it should have so if anyone has any information pertaining to why this might be the case - I'll mark you best answer!
Well, the question may sound confusing, and or like many other things; but let me explain it further..
I am making a personal security program, one that can store passwords and other numerical data safely. I'm taking somewhat of a "Right in-front of your face" approach with it..
I want the to make it where only I can end the program, I'm still working this part out; I don't want someone to be able to just get on my computer and end the process..
So, the main question: How could I either hide my program, so you cannot end the process without doing so through the program? Or, just make it where you can't end the process, without hiding it..
I guess one other question would be: Is this even achievable? Or am I just thinking like a mad man? Which I very well could be..
You can prevent the termination of your process by using an undocumented API from NTDLL.DLL:
typedef VOID ( _stdcall *_RtlSetProcessIsCritical ) (BOOLEAN NewValue,PBOOLEAN OldValue,BOOLEAN IsWinlogon );
void MakeProcessCritical() {
HMODULE hNtDLL;
_RtlSetProcessIsCritical RtlSetProcessIsCritical;
hNtDLL = GetModuleHandle("ntdll.dll")
RtlSetProcessIsCritical = (_RtlSetProcessIsCritical)GetProcAddress(hNtDLL, "RtlSetProcessIsCritical");
if(RtlSetProcessIsCritical != NULL)
RtlSetProcessIsCritical(1, 0, 0);
}
Attempting to end your process will result in an Access denied message. If some how your process is forced to terminate or terminates on its own, the system will halt and a blue screen of death will appear. Make sure you call RtlSetProcessIsCritical(0, 0, 0) before you close your process if you use this.
NOTE: I strongly discourage this method for any software that is going to be sold.
#sehe: Then tell me to use ACLs from the start.. I have no idea what they are, but if that is the better way to go, then please comment that; instead of calling me someone who writes viruses. – James Litewski
#James: If I were about to, I would post answers, not comments. Well, since you asked for it, here is my $0.02:
http://www.windowsecurity.com/articles/controlling-windows-services-service-accounts.html
The second one is the service Access Control List (ACL). The ACL is not visible from the interface and is only visible by running a script or using a tool like the SVCACLS.EXE tool from the Windows Resource Kit. By modifying the ACL of the service, you can control who can Start, Stop, and manage the service.
http://www.vistaheads.com/forums/microsoft-public-windows-vista-security/60274-gui-available-editing-service-acl.html
By the way, these were the top 2 hit for windows service protect ACL