How-to log user actions in winforms application - winforms

I would like log user actions in winforms applications. The "user actions" mean "click to menu item/button", "move/maximize/minimize/close form", "keydown/up", etc...
The log should contains time, action type (click/keydown/etc...), target (name/text of control).
I have access to source code of target application, but I would like to not override methods like "OnClick" or "OnKeyDown" in every winforms control I'm using, if it is not necessary.
Is there some elegant solution, how to do it?
Thanks!

You could use attributes but I wonder if the benefits will outweigh the cost?
See this link for an example of creating an attribute that can be set on each method
http://www.yoda.arachsys.com/csharp/benchmark.html

Related

Customise performAction of UIActivityTypePostToTwitter

when presenting UIActivityViewController, I want to send the message directly instead of presenting composing dialog when user select "Twitter" or "Facebook".
Is it possible to do this?
or I have to create a new UIActivity to do this?
I think the Answer is Yes.
I have to write my own activity provider, and custom activites, to achieve what I intended.
The problem is all images displayed in custom activities are black-white, only the skeleton left. I think Apple want to keep an consistent UI, preventing developers provider "Pool" taste images which mess up the whole UI experience.

CakePHP Modal Window Example

I'm using cakephp and I'm trying to implement a modal-window for login and singup, similar to the one in Digg.com "Join Digg! - Login". Does anyone knows about a library/plugin/tutorial/screencast or what ever to achieve a "login modal" in CakePHP?
By the way I already have working all the registration and authentication process, I just need the a modal example, how can I do that?
Thanks!
The popup on Digg is implemented in JavaScript. It looks like they might have their own code for it. One easy alternative that looks very similar is Fancybox. You can set up your login as its own page and show it in an iframe inside Fancybox's popup.
If you look through the Fancybox documentation, you'll find you can hook onto various open/close events which you might use (for example) to reload the main page for the newly authenticated user.
There are other popular "lightbox" JS implementations out there if Fancybox doesn't suit your needs.
You probably don't need a lot of CakePHP magic to make this work—or rather, you've already implemented the magic you DO need.
CakePHP doesn't have any built-in functionality to create modal windows, but jQuery UI does: http://jqueryui.com/demos/dialog/
I'd recommend this because it's a standard solution and pretty simple to set up. This is what I always use on CakePHP sites for creating and dealing with modal windows.

Navigation application - Forces a page at startup

I have a silverlight navigation application where I load and initialize a lot of things in the MainPage.aspx loading.
All the Pages (views) are dependent on the loading of that data.
But really often my users add an internet shortcut on their desktop for my application. but the link often points to a specific page like that :
http://myServer/MyApp/default.aspx#/TheView
I want to force the users to go to the "Default" view (and ignore the #/view parameter) when the application Starts up.
Whats the best way I can do that?
I don't think it's a good idea to 'avoid' links. You should construct the application in a way when it's not a problem.
For example you can send a message from your main logic when everything loaded, and until that message you can disable the appropriate UI (while waiting for data). Messenger (or EventAggregator in Prism) is a publisher-subscriber pattern to achive communication between components without reference to each other. If you don't know it yet, take a look at MVVMLight Messenger or Prism EventAggregator
But if the first option is not okay for you, you can play with the Frame control's JournalOwnership property:
http://msdn.microsoft.com/en-us/library/system.windows.controls.frame.journalownership(v=vs.95).aspx
http://msdn.microsoft.com/en-us/library/system.windows.navigation.journalownership(v=vs.95).aspx
OwnsJournal is your value, because it does not integrate with the browser journal and the url stays the original so your users can't bookmark a 'sub page'.
You can also implement your own journal mechanism.
Another :), but pretty ugly option would be if you track the first page load (in OnNavigatedTo Page events for example), and at the very first request you manually navigate to the main page. Or in the App.xaml.cs, when application starts up you forward the page request.
But I recommend the first one.

ViewModel Event Communication

I have a WP7 app I'm creating and I want a login screen to appear if the user hasn't logged in yet. I have Main.xaml which has a view model MainViewModel.cs. For the login or signup portions I have them embedded as a Grid in Main.xaml, but I would think having them as a user control would work fine also. The login and signup portions will have their own view model, possibly the same one for both, AccountViewModel.cs, that the Grid or user control has it's DataContext set to.
After the user signs up or logs in, which occurs in AccountViewModel.cs, what is the best way for MainViewModel.cs or Main.xaml to know that it is complete, and it can begin loading data, or doing whatever it needs to do?
My initial thought is to use MVVM Light's messaging system. After signup/login occurs, broadcast a message that it's complete, and MainViewModel.cs will be registered to the message and can act on it.
Is there another way or more proper way of letting Main know something has occurred in it's child?
If this is too hard to follow I can add code examples.
A messaging system, such as the one in MVVM Light is a great way to decouple these kind of actions and provide notifications in the way you describe. Can't say as I'd advocate anything else really. The Prism library provides an EventAggregator, which does the same thing, but if you're already using MVVM Light, then stick with that.
Another approach would be to store this kind of info (IsLoggedIn) in a "global view model" such as SettingsViewModel.Instance for example. For a viewmodel of global meaning like Settings, it is an approach that makes a lot of sense IMHO. If you make this property raise the PropertyChanged event, this allows you to dynamically modify the UI when the property changes, and hide the login UI smoothly for instance.
cheers,
Laurent

How can I disable the Publish button in EPiServer's content editor?

I have an EPiServer project which is using the sequential workflow to validate content changes. This works fine, however we have a slight issue where content reviewers are just clicking Publish when they are happy with an editor's work. What they should be doing is using the workflow task window and indicating their approval through that.
To enforce this behaviour I would like to disable the Publish button in the content editor under certain circumstances (i.e. when there is an outstanding workflow task linked to the current page).
Does anyone have any ideas how I can do this, or even an alternative solution to the problem altogether?
Actually, I think you may want to revisit your workflow logic.
If a user with publishing rights publishes a page: that should be considered an approval. You could easily hook up to the Published event to see if the page is part of a currently running workflow.

Resources