Comtel2000 Keyboard FX with HTMLEditor - javafx

Hi I have been using the Comtel2000 Keyboard FX https://github.com/comtel2000/fx-experience within my application for some time now with no issues. In fact I have found it to be an excellent capability in touch applications.
My Issue:
I have introduced an email function in which I am utilising the Javafx HTMLEditor. The keyBoardPopup.addGlobalFocusListener() does not appear to identify the HTMLEditor albeit TextFields are responding. I have tried htmlEditor.getProperties().put(VK_STATE, VK_STATE_ENABLED) to see if I can maybe enable the keyboard without success. Any suggestions welcome.
KeyboardPane kb = new KeyboardPane();
kb.setLayer(DefaultLayer.NUMBLOCK);
try {
kb.load();
} catch (Exception e) {
}
keyBoardPopup = new KeyBoardPopup(kb);
keyBoardPopup.addGlobalFocusListener();
keyBoardPopup.addGlobalDoubleClickEventFilter();

Related

Xamarin Forms Prism DialogService takes some seconds to show up

My Dialog is a simple Frame with an Image, a label to display a question and two more labels (Yes / No) with TapCommand.
I've set up the container with the DialogPage.xaml and DialogPageViewModel and injected in the ViewModel I want to open the dialog.
Here is the code I'm using to call the Dialog:
public void ShowDialog()
{
_dialogService.ShowDialog("DiscardPopup", CloseDialogCallback);
}
void CloseDialogCallback(IDialogResult dialogResult)
{
var goBack = dialogResult.Parameters.GetValue<bool>("GoBack");
if (goBack)
NavigationService.GoBackAsync();
}
If the user taps over the "Yes label", I execute this command:
YesCommand = new DelegateCommand(() => YesTapped());
private void YesTapped()
{
IDialogParameters pa = new DialogParameters();
pa.Add("GoBack", true);
RequestClose(pa);
}
If the user taps over the "No label", I simply call:
NoCommand = new DelegateCommand(() => RequestClose(null));
The "problem" is when the ShowDialog is fired, the DiscardPopup is taking up to 3 seconds to show up.
Is there a way to make it faster?
The same happens with the TapCommands, 2 - 3 seconds when the RequestClose is invoked.
Without actual code telling you exactly what the issue is, is going to be best guess. Based on your feedback to my comments above I would suggest the following:
Try displaying the dialog on a test page that doesn't have a complex layout. My guess is that you won't see such a long load time. If that's the case this would point to your layout being overly complex and that the lag time is due to the device struggling to re-render the View
Try using Prism.Plugin.Popups. You'll need to initialize Rg.Plugins.Popup and register the DialogService. You can see docs on that at http://popups.prismplugins.com

How to Mute volume on Button Clicked in MediaManager Plugin xamarin forms

How to Mute volume on Button Clicked in MediaManager Plugin xamarin forms
Below is my function
private void MuteClicked(object sender, EventArgs e)
{
if (CrossMediaManager.Current.VolumeManager.Mute)
{
CrossMediaManager.Current.VolumeManager.Mute = false;
muteBtn.Text = "Mute";
}
else
{
CrossMediaManager.Current.VolumeManager.Mute = true;
muteBtn.Text = "Unmute";
}
}
Button name is Changing but not affecting Volume
The current version (0.4.5) available via Nuget only contains placeholders for the volume controls.
Either your download the last version from the GIT repository ( https://github.com/martijn00/XamarinMediaManager ) or you wait for the next release.
I know it's an old thread but since there were no new release for the MediaPlayer and this is still the top result for this problem, you can use the unofficial nuget (https://www.nuget.org/packages/MediaManager.Unofficial/) witch is just a fork of the version 0.4.5 with some adjustments.
I just tried it and the Mute (which is now Muted) works, like the volume too.
Regards

How to Handle Two Jobs in MVC at same time

Hi my current project is calendar schedule. If i move time slot box in calendar, then called DayPilotCalendarWeek_EventMove and Time slate is moved successfully without Email functionality. But If i called Email Process it take some mints for mail. How to handle this Jobs???. I refer threading concept But I cannot Understand.Click Here for Screen shot
Requirement is
Job 1 : DayPilotCalendarWeek.Update(); // must done before sending Email.
After Update calender, Email functionality must work.
MY Code is :
Same Function two action
1.DayPilotCalendarWeek.Update();
2.SendEmail();
protected void DayPilotCalendarWeek_EventMove(object sender, DayPilot.Web.Ui.Events.EventMoveEventArgs e)
{
try
{
CommonCls com = new CommonCls();
//**Job 1:**
DayPilotCalendarWeek.DataSource = Moving(e.Id, e.OldStart.ToString(), e.NewStart.ToString());
DayPilotCalendarWeek.DataBind();
DayPilotCalendarWeek.Update();
//**Job 2**
SendEmail();
}
catch (Exception ex)
{
logger.Error(ex.ToString());
}
}
I dont know ASP.NET very well but i found this:
Response.AddHeader("REFRESH","10;URL=test.aspx");.
This should refresh the code after 10 secons. Maybe that will work.

How can I reliably wait for JavaScript alerts using Selenium2 / WebDriver?

I am currently assisting in a proof of concept using Selenium 2 / WebDriver with C# against an ASP.NET MVC application using the InternetExplorerDriver.
The application uses a standard pattern for notifying users that a record has saved. This works by settings TempData to include "Record saved successefully", and if TempData is present in the View, the view will alert the message.
Whilst working on Selenium tests for this functionality, we are receiving inconstitant behaviour from the below C# / Selenium test code:
_driver.Navigate().GoToUrl(_baseUrl + "/Amraam/List");
_driver.FindElement(By.LinkText("Create New")).Click();
_driver.FindElement(By.Id("txtAmraamSerialNumber")).SendKeys("CC12345");
var selectElement = new SelectElement(_driver.FindElement(By.Id("LocationId")));
selectElement.SelectByText("Tamworth");
_driver.FindElement(By.Id("btnSave")).Click();
var wait = new WebDriverWait(_driver, defaultTimeout);
IAlert alert = wait.Until(drv => drv.SwitchTo().Alert());
_alertText = alert.Text;
alert.Accept();
Assert.That(_alertText, Is.EqualTo("Record successfully saved"));
Approximately 50% of the time, Selinium will fail with a
OpenQA.Selenium.NoAlertPresentException : No alert is active
I struggle to find an exact way to replicate the issue, and worry regarding the inconsistency aspect. If it failed consistently, then we could debug and track the problem down.
The handling of alerts and prompts within Selenium 2 is pretty new and is still under active development.
Your failures are probably due to timing, so I would suggest writing a wrapper method around the call to SwitchTo().Alert() so that you catch the OpenQA.Selenium.NoAlertPresentException and ignore it until the timeout expires.
Something as simple as this should work:
private IAlert AlertIsPresent(IWebDriver drv)
{
try
{
// Attempt to switch to an alert
return drv.SwitchTo().Alert();
}
catch (OpenQA.Selenium.NoAlertPresentException)
{
// We ignore this execption, as it means there is no alert present...yet.
return null;
}
// Other exceptions will be ignored and up the stack
}
This line
IAlert alert = wait.Until(drv => drv.SwitchTo().Alert());
would then become
IAlert alert = wait.Until(drv => AlertIsPresent(drv));
Hope this will be helpful for waiting and click
WebDriverWait(driver,4).until(EC.alert_is_present())
driver.switch_to.alert.accept()

How do I detect whether a window is hidden (cmd-h) vs closed (cmd-w) - Mac

I'm developing an AIR application which uses multiple windows. I'm running into an issue where I want to open new windows (toaster notifications for example) when the primary application window is not visible, but the behavior is different depending on how the window is closed.
When a user hides all application windows with CMD-H, opening a new window causes all application windows to come back to the foreground (instead of just that new window, like I would expect). If the user closed a window with CMD-W, however, that window does not become visible when I open a new window.
Is there a way to either 1) tell when the user uses cmd-h to hide all windows OR 2) tell whether a window is hidden using cmd-h vs. closed cmd-w?
Thanks
I actually just figured out a good answer to this problem. Apparently, the reason cmd-H and cmd-W don't trigger keyDown events are because they are capturee and stopped by the native application menu.
By default, several "normal" mac OS menu options are put into AIR applications by the framework - these include cmd-w to close the window, cmd-h to hide and shortcuts around copy/cut/paste. In order to avoid the default behavior, I either removed these menu options or changed their key equivalents (the shortcut combination that triggers them).
The code to add a preferences shortcut (cmd-,), override cmd-w, change cmd-w to cmd-shift-w, and override the cmd-h functionality looks like this:
if (NativeApplication.supportsMenu) {
var prefItem:NativeMenuItem = new NativeMenuItem("Preferences...");
prefItem.addEventListener(Event.SELECT, handlePreferencesMenuSelect);
prefItem.keyEquivalent = ",";
var closeItem:NativeMenuItem = new NativeMenuItem("Close Tab");
closeItem.addEventListener(Event.SELECT, handleCloseTabMenuSelect);
closeItem.keyEquivalent = "w";
// Add the preferences option under the first menu
// Also add a spacer line (like most other applications)
// Also change the hide command to our own handler
var baseMenu:NativeMenuItem = NativeMenuItem(NativeApplication.nativeApplication.menu.items[0]);
baseMenu.submenu.addItemAt(new NativeMenuItem("", true), 1);
baseMenu.submenu.addItemAt(prefItem, 2);
for (var idx:String in baseMenu.submenu.items) {
var menuItem:NativeMenuItem = baseMenu.submenu.items[idx];
if (menuItem && menuItem.keyEquivalent == 'h' && menuItem.keyEquivalentModifiers.length == 1) {
baseMenu.submenu.removeItemAt(int(idx));
var hideItem:NativeMenuItem = new NativeMenuItem("Hide Application");
hideItem.addEventListener(Event.SELECT, handleHideWindowSelect);
hideItem.keyEquivalent = "h";
baseMenu.submenu.addItemAt(hideItem, int(idx));
}
}
// Set the close window shortcut to cmd+shift+w, instead of cmd+w
var fileMenu:NativeMenuItem = NativeMenuItem(NativeApplication.nativeApplication.menu.items[1]);
NativeMenuItem(fileMenu.submenu.getItemAt(0)).keyEquivalent = 'W';
fileMenu.submenu.addItem(closeItem);
}
Thanks for the help figuring it out.

Resources