Is it possible to bind a command directly to an app bar button? - windows-phone-8

I'm creating an MVVM style application for windows phone. With a regular button, you can bind anything that inherits from ICommand to the Command property on a xaml button, like so:
The command property does not seem to exist for buttons in the phones app bar ("shell:ApplicationBarIconButton"). Has anyone figured out how to bind their click event to a Command yet?

It's not possible from the SDK directly, but the AppBarUtils library ( http://nuget.org/packages/AppBarUtils or http://appbarutils.codeplex.com/ ) works nicely.
The codeplex site has example code for different scenarios such as reusing or switching the app bar in a page.

I didn't understand how to use the chosen solution so I went for another one. You just add the library via nuget. It's BindableApplicationBar
Then you just add the following instead of your normal application bar.
<bindableApplicationBar:Bindable.ApplicationBar>
<bindableApplicationBar:BindableApplicationBar >
<bindableApplicationBar:BindableApplicationBarButton
Text="Refresh"
IconUri="/Images/refresh.png"
Command="{Binding RefreshCommand}" />
</bindableApplicationBar:BindableApplicationBar>
It's just a shame that intellisense doesn't reconize the tags. Otherwise, it works like a charm.

Related

How to move the "re-frame-10x" window back to the browser tab after being popping out into a new window?

I have been using Clojure, ClojureScript, lein, shadow-cljs, re-frame, reagent, Emacs, and CIDER to work on a Clojure/ClojureScript dynamic web app project.
Usually, I build the project by executing the command cider-jack-in-cljs in Emacs, choosing shadow-cljs, then shadow for REPL type, and, finally, app for the building option.
The application loads in localhost:3005 with a debugging dashboard. Apparently, this UI is called "re-frame-10x":
After clicking on the up-right arrow icon on the top-right:
I managed to pop out the debugging dashboard into a new window in Google Chrome. It was injecting some CSS and hiding a button on the webpage. Hence, I decided to "remove it" by popping-it out.
But, I would like to move it back to the browser tab that has localhost on the address. How to do it?
As suggested by #eugene-pakhomov, it was just closing that window. I must highlight that I had tried that before, the only problem was that there were multiple windows of that type. And all of them need to be closed for the process to work!
Not sure why the program opens multiple windows...

Catching back and home keys

After I set up my new project with libGDX v1.3.1 i am stuck with something that should be easy. In my main class which extends game I have:
Gdx.input.setCatchBackKey(true);
but I cannot get any response from this (in render method):
if(Gdx.input.isButtonPressed(Keys.BACK)){
this.dispose();
}
It like nothing was pressed, although I can see that the button was pressed in logCat console.
I need to mention that I was using the exact same code until libGDX version 1.0.0 (or the first one with gradle).
Note: i have also tried implementing InputProcessor and then setting the input processor. Result was the same.
And for the home button: using Gdx.input.setCatchMenuKey(true); is not working.
Use isKeyPressed instead of isButtonPressed. Buttons only refers to the three mouse buttons on a desktop game. Everything on Android is a Key (or Peripheral).
You mentioned "home button" but the code you posted is for the menu button. There is no way to catch the home button unless you make your manifest declare your app as a launcher replacement, in which case, the home button will always open your app, even when it's closed, and the user will have no easy way to get to the home screen. And libgdx doesn't have that functionality built in, since that would be weird. You would have to implement it yourself in your manifest and main Activity.
Also, disposing of this, whatever this is, sounds dangerous to do from the input handler. You could be about to render stuff and cause a crash. But I'm not sure where you're trying to use it from. Maybe it's OK.

Remove widgets from p:dashboard via dragging out

I'd like to add support to removing the widgets from p:dashboard via dragging the panel out of dashboard, such as in WordPress admin panel.
I've found out the examples of dragging the widgets between 2 dashboards, but in my case I need to have callback when the element is dragged out of dashboard, no matter where. The widget would be than removed. However, I couldn't find any example for such behaviour.
What components/tools to use to implement such functionality? I'm using PrimeFaces 3.4.
Use draggable component with dashboard keyword;
<p:draggable for="widget" dashboard=":dbForm:dashboard"/>
And check this solutions on forum page of primefaces: Dashboard Drag and Drop
Hope it'll help you.
Good Luck!

setFocus in Flex

I'm Using following code in flex4 mxml That works fine.
<mx:Button label="Set focus to Username"
click="focusManager.setFocus(username);" />
How to use the same in Action script I mean creation complete event of an application without using button.
That is I have login panel in application While page loads the
username field should focused having cursor in it.
Can any one help me?
The issue is that within your application the TextInput has focus, but within the HTML page your Flex application does not. So basically the only extra step you need is to give the Flex app focus. There's only one way to achieve this: through JavaScript. And you should do it after the application was loaded.
The guys at Farrata wrote a very good example on how to do this, so I'm just going to point you there: http://flexblog.faratasystems.com/2011/12/15/setting-focus-in-flex-components

IntelliJ navigation

I'm using IntelliJ to do Java Development for an application where we use JSF in a few places. In the .jsp file I have defined my backing class and the code runs properly.
My question is: How do I set up my environment so that when I center click on the method names, which use EL format, IntelliJ navigates to the proper method in the proper class.
Having taken a quick look at my IntelliJ install, if you go to File->Settings, there should be a keymap section under the IDE Settings header. Make a new keymap profile other than default. You can probably just copy the default and give it a new name. In the actions window, open Main Menu->Go To and there should be an action called "Implementation(s)". The description of this action seems to match what you are looking for. Click Add Mouse Shortcut, and center click in the click pad area to set it. I didn't want to actually change my settings, so I didn't finish the steps myself, but this should do what you are wanting to do. It may warn you that you are overwriting a shortcut to another action, so be aware of that.
Hope this helps.
This is using IntelliJ Version 9 beta.
in JSP I am using something like this
<%--#elvariable id="owner" type="com.mysite.data.Owner"--%>
This is a comment specific for intellij I guess. In this way when the owner variable is used anywhere like:
${owner.name}
is known to intellij that is of a Owner type. Intellij then automatically go to the class definition by pressing CTRL+B or middle mouse button.
This is working with intellij idea 9 beta and I remember that this feature was broken in 8.1.1. Prob it is working again in 8.1.x
Probably the same approch will also work for JSF.