Long tapped implementation in windows store app - winrt-xaml

is there any practice how to implement long tapped on windows store application, or just with PointerPressed and PointerReleased events ??? Thanks

Are you referring to the Holding event?
Grid grid = new Grid();
grid.Holding += OnElementHolding;

Related

Monotouch change existing UIButtonBarItem's image

I would like to use the same UIBarButtonItem but change the Icon to another UIBarButtonSystemItem within the same instance. Is there a way to do this? Also is there a way to detect
which UIBarButtonSystemItem is being used?
var btn = UIBarButtonItem(UIBarButtonSystemItem.Play, null)
btn.?? = UIBarButtonSystemItem.Pause
choper pointed to me to a question that explained that I could not alter the image instance.
I basically followed the advice of that post and I toggle between two buttons(play and pause)

Is there a way to pause the qooxdoo layout managers while a bulk of content is added to a container?

I am dynamically creating content in a qooxdoo desktop application based on ajax calls. Some of the content I am creating has a lot of widgets in it (on the order of 200+).
I did some profiling with google chrome and it looks like most of the processing time is taken up by the layout manager since I am calling add() on the container for every widget I create.
Is there a way to pause the layout manager while I add all the widgets and then have it run once at the very end?
Is there a better approach altogether for dynamically adding lots of widgets to containers?
Here is an example of what I am doing:
var container = new qx.ui.container.Composite(new qx.ui.layout.Flow());
var groupbox = new qx.ui.groupbox.GroupBox();
groupbox.setLayout(new qx.ui.layout.Grid(10, 10));
container.add(groupbox);
// loop through data received from AJAX call and add it to the group box
var row = 0;
data.each(function(pair) {
var label = new qx.ui.basic.Label(pair.key);
var field = new qx.ui.form.TextField(pair.value);
groupbox.add(label, {row: row, column: 0});
groupbox.add(field, {row: row, column: 1});
++row;
});
You can probably
first add all the widgets into a "unattached" container, i.e. a container which has not been added anywhere yet or its ascendants are not part of the layout
then add the "unattached" container to the layout, triggering the widget layouting
When you add a widget, it is added to a queue to be executed after you thread ends, if you add many widgets on the same thread, the layout reflow will be executed once.
So if there is no asynchrony between one .add() and the next one they are on the same thread and they do only one reflow.
The time you see on the profile is the normal time the layout manager takes to render, it has to access to the dom to know the size of some elements and this operation takes a lot, the last profile I did the more expensive operation was "el.innerWidth".
I think there is nothing to do there if you want to use Qooxdoo.

Is it possible to restrict the user to take snapshot of screen in C#

I have an application developed in C#. I need a mechanism to restrict the user to take screen shot when the application window on top.
Is it possible to restrict the user to take screenshot??
I have already listen the PrtScr Button to restrict the built in mechanism of windows to take screenshot.
But if user uses some capturing application to capture the skin.. I think there might be some windows event or such like thing, which is triggered when a a screenshot is taken. I need to know about it. Any help will be appreciated...
Already discussed/answered on SO: How do I prevent print screen
try searching a bit before asking! ;-)
In windows form application, Use this code in form keyup event,
if (e.KeyCode == Keys.PrintScreen)
{
Clipboard.Clear();
}
form keypreview should be true.

Monotouch - programming for Swipe Gesture

I am developing a control for an IPAD application (My first time doing Apple development). Its a simple control that mimics a grid - consists of a collection of UIViews (each of which represents a cell) all added to a parent UIView (in a grid like fashion).
One of the requirements is to implement a swipe gesture - the users swipe across the grid to activate/inactivate the cell - this corresponds to a 1/0 in the database.
I create a UISwipeGesture and added it to each of my UIView which represents a cell. That appears to be an incorrect approach as it fires the event for the UIView in which the swipe originated but not across all the UIViews.
My understanding would be that i need to implement the SwipeGesture across the parent UIView which contains all these children UIView. However if i do that how will i know which child UIView has been swiped over? Or any other approach which would make sense?
I know this thread is fairly old, but I created a Swipe extension method that might have helped.
View.Swipe(UISwipeGestureRecognizerDirection.Right).Event += Swipe_Event;
void Swipe_Event(ViewExtensions.SwipeClass sender, UISwipeGestureRecognizer recognizer)
{
View view = sender.View; // do something with view that was swiped.
}
This may not answer your question, but I can speak to the approach I've taken here with a similar use case:
1) I would abandon UIScrollView and use UITableView. You'll notice that UITableView inherits from UIScrollView and has all the performance benefits of virtualization and cell / view re-use. Which you'll find terribly useful as you work towards optimizing your app for performance on device.
2) Utilize the UITableViewCell's ContentView to create custom "Grid" cells. Or better yet, utilize MonoTouch.Dialog if you're not required to create Grid rows ad-hoc.
3) Use this awesome class (props to #praeclarum) to setup gestures in MonoTouch. You essentially provide a UIGestureRecognizer as a generic argument. You can then utilize the LocationInView method to grab the point in the UITableView where the gesture occurred
public void HandleSwipe(UISwipeGestureRecognizer recognizer)
{
if(recognizer.State == UIGestureRecognizerState.Ended) {
var point = recognizer.LocationInView(myTableView);
var indexPath = myTableView.IndexPathForRowAtPoint(point);
// do associated calculations here
}
}
I think you're correct that the gesture recognizer has to be attached to the parent view. In the action method associated with the gesture recognizer I think you can use the Monotouch equivalent of CGRectContainsPoint() to determine whether the swipe occurred in a particular subview. I imagine you would have to iterate through the subviews until you found the one in which the swipe occurred. I'm not aware of a method that would immediately identify the swiped subview.

How to get a native keypad in game.?

i have a game developed using LWUIT.now i am implementing full touch in game.it is a multi player game so there are some options like chat and login. when we press on chat we need to enter the characters in the field. my question is
is it possible to invoke the native keypad when we press on the chat button .?
thanks in advance
kris
No. MIDP doesn't include such an API. You can use LWUIT's virtual keyboard (which isn't native) and define any character set you want as explained here:
http://lwuit.blogspot.com/2010/06/pimp-virtualkeyboard-by-chen-fishbein.html
You can show it using the display class.
On Symbian devices if you do not define some jad properties, a touch keypad will be always visible and you won't be able to hide it for more details look here:
http://lwuit.blogspot.com/2009/11/optimized-for-touch.html
Looking at the question again I'm thinking the VKB is probably an overkill for an always on keypad replacement. Just place your content in the center of a BorderLayout and stick a container in the south something like this:
addComponent(BorderLayout.CENTER, myUI);
Container keypad = new Container(new GridLayout(2, 2));
addComponent(BorderLayout.SOUTH, keypad);
Button up = new Button("Up");
Button down = new Button("Down");
Button left = new Button("Left");
Button right = new Button("Right");
up.setFocusable(false);
down.setFocusable(false);
left.setFocusable(false);
right.setFocusable(false);
keypad.addComponent(up);
keypad.addComponent(down);
keypad.addComponent(left);
keypad.addComponent(right);
up.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
int up = Display.getInstance().getKeyCode(Display.GAME_UP);
Display.getInstance().getCurrentForm().keyPressed(up);
Display.getInstance().getCurrentForm().keyReleased(up);
}
});
The rest and fire are pretty trivial to add (same thing) notice that getKeyCode is deprecated but should work for now since we have no alternative to that API.

Resources