本文整理汇总了C#中RelayCommand类的典型用法代码示例。如果您正苦于以下问题:C# RelayCommand类的具体用法?C# RelayCommand怎么用?C# RelayCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RelayCommand类属于命名空间,在下文中一共展示了RelayCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewModelCrew
public ViewModelCrew()
{
if (Client.State == CommunicationState.Closed)
{
Client.Open();
}
crew = new Crew();
AddEntityCommand = new RelayCommand(AddEntityCommand_Execute, AddEntityCommand_CanExecute);
RemoveEntityCommand = new RelayCommand(RemoveEntityCommand_Execute, RemoveEntityCommand_CanExecute);
AddToCrewCommand = new RelayCommand(AddToCrewCommand_Execute, AddToCrewCommand_CanExecute);
RemoveFromCrewCommand = new RelayCommand(RemoveFromCrewCommand_Execute, RemoveFromCrewCommand_CanExecute);
AddAllCommand = new RelayCommand(AddAllCommand_Execute, AddAllCommand_CanExecute);
RemoveAllCommand = new RelayCommand(RemoveAllCommand_Execute, RemoveAllCommand_CanExecute);
Crews = new ObservableCollection<Crew>(Client.GetEntityByType(EntityType.Crew).Cast<Crew>());
AllMembers = new ObservableCollection<CrewMember>(Client.GetEntityByType(EntityType.CrewMember).Cast<CrewMember>().Where(member => string.IsNullOrEmpty(member.Crew)));
CrewMembers = new ObservableCollection<CrewMember>();
SelectedMembers = new ObservableCollection<CrewMember>();
SelectedMembersToRemove = new ObservableCollection<CrewMember>();
MakeProxy(this);
try
{
proxy.Subscribe(EntityType.Crew.ToString());
proxy.Subscribe(EntityType.CrewMember.ToString());
}
catch (Exception ex)
{
CrFSMLogger.CrFSMLogger.Instance.WriteToLog(ex);
}
}
示例2: MainViewModel
/// <summary>
/// Default constructor. We set the initial view-model to 'FirstViewModel'.
/// We also associate the commands with their execution actions.
/// </summary>
public MainViewModel()
{
CurrentViewModel = MainViewModel._firstViewModel;
ViewRSSFeedCommand = new RelayCommand(param => ExecuteViewRSSFeedCommand());
SettingViewCommand = new RelayCommand(param => ExecuteSettingViewCommand());
SearchRSSViewCommand = new RelayCommand(param => ExecuteSearchRSSViewCommand());
}
示例3: MainWindowViewModel
public MainWindowViewModel(IDialogService dialogService)
{
this.dialogService = dialogService;
ImplicitShowDialogCommand = new RelayCommand(ImplicitShowDialog);
ExplicitShowDialogCommand = new RelayCommand(ExplicitShowDialog);
}
示例4: PlayersViewModel
public PlayersViewModel()
{
Players = new ObservableCollection<Player>();
#region RCON Events
App.ArkRcon.PlayersUpdated += async (s, args) =>
{
Players.Clear();
foreach (Ark.Models.Player player in args.Players)
{
Players.Add(new Models.Player(player));
}
await UpdateSteamPlayerInfo();
};
#endregion
#region Buttons and Events
OpenSteamProfileCommand = new RelayCommand(OpenSteamProfile);
CopySteamIDCommand = new RelayCommand(CopySteamID);
CopyPlayerNameCommand = new RelayCommand(CopyPlayerName);
KickSelectedCommand = new RelayCommand(KickSelectedPlayer);
BanSelectedCommand = new RelayCommand(BanSelectedPlayer);
WhitelistSelectedCommand = new RelayCommand(WhitelistSelectedPlayer);
UnWhitelistSelectedCommand = new RelayCommand(UnWhitelistSelectedPlayer);
PMSelectedPlayerCommand = new RelayCommand(PMSelectedPlayer);
RefreshPlayersCommand = new RelayCommand(RefreshPlayers);
#endregion
PrivateMessage = string.Empty;
}
示例5: CustomerListViewModel
public CustomerListViewModel()
{
if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) return;
//Customers = new ObservableCollection<Customer>(_customersRepo.GetCustomersAsync().Result);
DeleteCommand = new RelayCommand(OnDelete, CanDelete);
}
示例6: BaseViewModel
//Constructor
public BaseViewModel() {
CloseWindowCommand = new RelayCommand<Window>(CloseWindow);
UndoCommand = new RelayCommand(undoRedoController.Undo, undoRedoController.CanUndo);
RedoCommand = new RelayCommand(undoRedoController.Redo, undoRedoController.CanRedo);
CutCommand = new RelayCommand(Cut, LampsAreSelected);
CopyCommand = new RelayCommand(Copy, LampsAreSelected);
PasteCommand = new RelayCommand(Paste);
AddLampCommand = new RelayCommand<IList>(AddNewLamp);
RemoveLampCommand = new RelayCommand(RemoveLamp, LampsAreSelected);
dialogWindow = new DialogViews();
NewDrawingCommand = new RelayCommand(NewDrawing);
LoadDrawingCommand = new RelayCommand(LoadDrawing);
SaveDrawingCommand = new RelayCommand(SaveDrawing);
SaveAsDrawingCommand = new RelayCommand(SaveAsDrawing);
LightSwitchCommand = new RelayCommand(LightSwitch);
SwitchLampLightCommand = new RelayCommand(singleLampLightSwitch, LampsAreSelected);
toggleSnappingCommand = new RelayCommand(toggleSnapping);
toggleGridVisibilityCommand = new RelayCommand(toggleVisibility);
}
示例7: TranslationAdornment
public TranslationAdornment(SnapshotSpan span, TranslationRequest request, Size viewportSize)
{
Span = span.Snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeExclusive);
Request = request;
Request.TranslationComplete += request_TranslationComplete;
InitializeComponent();
DataContext = this;
SetMaxSize(viewportSize);
_menu = spListBox.ContextMenu;
_menu.KeyUp += (sender, args) =>
{
if (args.Key == Key.Left || args.Key == Key.Escape)
{
CloseMenu();
}
};
_menu.Opened += (sender, args) => { _closeMenuRequested = false; };
_menu.Closed += (sender, args) => { _ignoreItemCommand = !_closeMenuRequested; };
ItemCommand = new RelayCommand<ItemCommandParameter>(ItemCommandExecute);
ItemOptionsCommand = new RelayCommand<ItemCommandParameter>(ItemOptionsCommandExecute);
MenuCommand = new RelayCommand<MenuItem>(MenuCommandExecute);
}
示例8: SearchViewModel
public SearchViewModel(ISearchService searchService)
{
this.searchService = searchService;
Search = new RelayCommand(SearchExecuted);
ShowDetails = new RelayCommand<SearchResult>(ShowDetailsExecuted);
Results = new List<SearchResult>();
}
示例9: IntroductionViewModel
public IntroductionViewModel(GenericDataAccess<string> dataAccess)
{
this.dataAccess = dataAccess;
introduction = dataAccess.TryLoad();
SaveCommand = new RelayCommand<object>(_ => Save());
}
示例10: TerminalWindowViewModel
public TerminalWindowViewModel()
: base()
{
HomeCommand = new RelayCommand(Home);
SearchServiceCommand = new RelayCommand(SearchService);
UnloadedCommand = new RelayCommand(Dispose);
}
示例11: ViewModel_MainWindow
public ViewModel_MainWindow()
{
if (!DesignerProperties.GetIsInDesignMode(Application.Current.MainWindow))
{
this.TrackDetails.Title = "Initializing Spotify ...";
if (Wrapper_Spotify.Init())
{
Wrapper_Skype.Init();
Updater.I.Start();
StatusEffects.I.Start();
NameEffect.I.Start();
NameEffect.I.UpdateEffect(2);
NameEffect.I.UpdateTrackDetails("Jayson Ragasa ");
Wrapper_Spotify.TrackChanged += Wrapper_Spotify_TrackChanged;
Command_Update = new RelayCommand(Commnad_Update_Click);
this.Pattern = Properties.Settings.Default.Pattern;
this.SelectedEffect = Properties.Settings.Default.SelectedEffect;
}
else
{
this.TrackDetails.Title = "Make sure you're running Spotify. Please restart this app";
Process.GetCurrentProcess().Kill();
}
}
}
示例12: RegisterCommands
/// <summary>
/// Register commands
/// </summary>
private void RegisterCommands()
{
StopPlayingMediaCommand = new RelayCommand(() =>
{
Messenger.Default.Send(new StopPlayingMovieMessage());
});
}
示例13: AllSongsViewModel
public AllSongsViewModel()
{
GoBackCommand = new RelayCommand(GoBack);
AddToQueueCommand = new RelayCommand(AddToQueue);
PlayCommand = new RelayCommand(Play);
SongHits = (List<Song>)NavigationService.GetInstance().Content;
}
示例14: UserPageViewModel
public UserPageViewModel()
{
Title = "Пользователи";
Users = new ObservableCollection<CheckedItemViewModel<User>>(ClientManager.SecurityConfiguration.Users.Select(item => new CheckedItemViewModel<User>(item)));
SelectAllCommand = new RelayCommand(() => Users.ForEach(item => item.IsChecked = true));
SelectNoneCommand = new RelayCommand(() => Users.ForEach(item => item.IsChecked = false));
}
示例15: PlanSchematicViewModel
public PlanSchematicViewModel(RoadwayModel_TabVM parentVM)
: base()
{
parentVM_ = parentVM;
if (parentVM_ == null) return;
isPortWindowMoving = false;
startMovingPoint.X = startMovingPoint.Y = 0.0;
currentCorridor_ = parentVM_.CurrentCorridor;
ViewScaleFeetPerInch = 100.0;
currentCorridor_ = parentVM_.CurrentCorridor;
AdvanceDistance = 20.0;
AdvanceStationAheadCmd = new RelayCommand(advanceStationAhead, () => canAdvanceAhead);
canAdvanceAhead = true;
AdvanceStationBackCmd = new RelayCommand(advanceStationBack, () => canAdvanceBack);
canAdvanceBack = true;
WindowCenterY = 2000.0;
PlanStation = "";
PlanOffset = "";
PlanElevation = "";
PlanCrossSlope = "";
}