command

Using MvxCommand With CommandParameter binding

不问归期 提交于 2019-11-30 02:53:49
问题 I'm trying using fire MvxCommand with CommandParameter, but faced with following problem: MyView.axml contains: <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button1" local:MvxBind="Click MyCommand, CommandParameter=foo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button2"

WPF: Binding to commands in code behind

两盒软妹~` 提交于 2019-11-30 02:02:55
问题 I have a WPF Microsoft Surface Application and I'm using MVVM-Pattern. I have some buttons that are created in code behind and I would like to bind commands to them, but I only know how that works in the XAML like this: <Custom:SurfaceButton Command="{Binding SaveReservationCommandBinding, Mode=OneWay}"/> But I cannot do it like this because my buttons do not exist in the XAML, only in the code behind. So how would a command binding like that works in code behind? 回答1: Assuming that you have

Pass private key password to openvpn command directly in Ubuntu 10.10 [closed]

早过忘川 提交于 2019-11-30 01:58:24
I tried the method with different parameter I have password. Here below password is mypassword 1) root$ echo mypassword || openvpn client.conf.ovpn the result was display: mypassword 2) root$ openvpn client.warriors.conf.ovpn || echo mypassword the result was display: Thu Jun 28 00:00:00 2012 us=757575 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables Enter Private Key Password: (still need to enter password manualy ) I don't want to have to enter the password manually. How can I achieve this? 3) DUDE After running the script it exit out

WPF MVVM Correct way to fire event on view from ViewModel

拈花ヽ惹草 提交于 2019-11-30 01:47:35
In my WPF application I have 2 Windows (both Windows have their own ViewModel): Application's Main Window that displays list with bunch of words (bound to MainViewModel) Dialog Window that allows users add new items to the list (bound to AddWordViewModel) MainViewModel has Articles property of List(this collection is populated by one of the service classes) bound to Main Window's ListBox AddWordViewModel has SaveWordCommand that is bound to Add Word Dialog's Save button. It's task is to take text entered by user and pass it to service class. After user clicks on on Save button I need notify

WPF - how to hide menu item if command's CanExecute is false?

最后都变了- 提交于 2019-11-30 01:44:09
By default menu items become disabled when its command cannot be executed (CanExecute = false). What is the easiest way to make the menu item visible/collapsed based on the CanExecute method? You can simply bind Visibility to IsEnabled (set to false on CanExecute == false). You still would need an IValueConverter to convert the bool to visible/collapsed. public class BooleanToCollapsedVisibilityConverter : IValueConverter { #region IValueConverter Members public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { //reverse conversion

How can I assign the 'Close on Escape-key press' behavior to all WPF windows within a project?

99封情书 提交于 2019-11-30 01:43:27
Is there any straightforward way of telling the whole WPF application to react to Escape key presses by attempting to close the currently focused widow? It is not a great bother to manually setup the command- and input bindings but I wonder if repeating this XAML in all windows is the most elegant approach? <Window.CommandBindings> <CommandBinding Command="Close" Executed="CommandBinding_Executed" /> </Window.CommandBindings> <Window.InputBindings> <KeyBinding Key="Escape" Command="Close" /> </Window.InputBindings> Any constructive suggestions welcome! All I can suggest to improve on that is

Command to zip a directory using a specific directory as the root

孤街醉人 提交于 2019-11-30 01:23:38
I'm writing a PHP script that downloads a series of generated files (using wget ) into a directory, and then zips then up, using the zip command. The downloads work perfectly, and the zipping mostly works. I run the command: zip -r /var/www/oraviewer/rgn_download/download/fcst_20100318_0319.zip /var/www/oraviewer/rgn_download/download/fcst_20100318_0319 which yields a zip file with all the downloaded files, but it contains the full /var/www/oraviewer/rgn_download/download/ directories, before reaching the fcst_20100318_0319/ directory. I'm probably just missing a flag, or something small, from

Using SC to install a windows service and then set recovery properties

馋奶兔 提交于 2019-11-30 01:18:46
I want to set the Recovery Options on a Windows Service I'm installing on a Windows Server 2003. I know this is possible to do manually, but I want to set the Recovery configuration when I install the service. I use SC script to do this: SC create MyService displayname= "MyService" binpath= "C:\Program Files\MyService\MyService.exe" start= auto SC failure MyService reset= 86400 actions= restart/1000/restart/1000/run/1000 SC failure MyService command= "C:\Program Files\Myservice\MyService.exe" The problem is when the first whitespace is hit, it cuts off the path and takes the rest of the path

Running a bash command via CMake

天大地大妈咪最大 提交于 2019-11-30 01:10:44
问题 I'm trying to have CMake either run three bash commands or a bash script. However, I can't seem to get it to work. The bash commands are: cd ${CMAKE_SOURCE_DIR}/dependencies/library make cd ${CMAKE_BINARY_DIR} Essentially, I would like CMake to build the library in that directory if it does not already exist. Here's the CMake code I tried: if(NOT "${CMAKE_SOURCE_DIR}/dependencies/library/lib.o") execute_process(COMMAND cd ${CMAKE_SOURCE_DIR}/dependencies/library) execute_process(COMMAND make)

Grey out image on button when element is disabled (simple and beautiful way)

我与影子孤独终老i 提交于 2019-11-30 00:27:51
问题 I want to grey out my images (on the buttons) when the buttons are disabled. When I have text (no images) on the button, the text is greyed out (With Images as Button Content they are not grey out). Is there any simple and beautiful way to do that? This is my xaml file: <Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <Grid