本文整理汇总了C#中GalaSoft.MvvmLight.Command.RelayCommand类的典型用法代码示例。如果您正苦于以下问题:C# RelayCommand类的具体用法?C# RelayCommand怎么用?C# RelayCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RelayCommand类属于GalaSoft.MvvmLight.Command命名空间,在下文中一共展示了RelayCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainViewModel
/// <summary>
/// Initializes a new instance of the MainViewModel class.
/// </summary>
public MainViewModel()
{
scoreStorage = new ScoreStorage();
HighScores = new ObservableCollection<Score>(scoreStorage.GetScores());
game = new Game();
game.PlayerLost += GameOnPlayerLost;
game.PlayerTooFast += GameOnPlayerTooFast;
game.PlayerWon += GameOnPlayerWon;
game.CountdownTick += GameOnCountdownTick;
game.WaitForItStarted += GameOnWaitForItStarted;
game.TapDanceStarted += GameOnTapDanceStarted;
game.ButtonsCanBeClickedChanged += GameOnButtonsCanBeClickedChanged;
patternTimer = new DispatcherTimer();
patternTimer.Tick += PatternTimerOnTick;
patternTimer.Interval = buttonLightingTime;
Button1Command = new RelayCommand(() => game.ButtonClicked(0), () => game.ButtonsCanBeClicked);
Button2Command = new RelayCommand(() => game.ButtonClicked(1), () => game.ButtonsCanBeClicked);
Button3Command = new RelayCommand(() => game.ButtonClicked(2), () => game.ButtonsCanBeClicked);
Button4Command = new RelayCommand(() => game.ButtonClicked(3), () => game.ButtonsCanBeClicked);
StartRetryCommand = new RelayCommand(() => StartNewPattern(game.GetNewPattern()), () => true);
Button1BackColor = new SolidColorBrush(Colors.Black);
Button2BackColor = new SolidColorBrush(Colors.Black);
Button3BackColor = new SolidColorBrush(Colors.Black);
Button4BackColor = new SolidColorBrush(Colors.Black);
StartRetryText = "Start";
SetNumberButtonsToDefault();
}
示例2: WorkshopViewModelBase
protected WorkshopViewModelBase()
{
if (IsInDesignModeStatic)
{
Head = "X:123, Y:456, Z:7890";
Neck = "X:123, Y:456, Z:7890";
LeftShoulder = "X:123, Y:456, Z:7890";
RightShoulder = "X:123, Y:456, Z:7890";
Torso = "X:123, Y:456, Z:7890";
LeftElbow = "X:123, Y:456, Z:7890";
RightElbow = "X:123, Y:456, Z:7890";
LeftHand = "X:123, Y:456, Z:7890";
RightHand = "X:123, Y:456, Z:7890";
LeftHand = "X:123, Y:456, Z:7890";
RightHand = "X:123, Y:456, Z:7890";
LeftHip = "X:123, Y:456, Z:7890";
RightHip = "X:123, Y:456, Z:7890";
LeftKnee = "X:123, Y:456, Z:7890";
RightKnee = "X:123, Y:456, Z:7890";
LeftFoot = "X:123, Y:456, Z:7890";
RightFoot = "X:123, Y:456, Z:7890";
}
else
{
Kinect = MyKinect.Instance;
PointerColor = new SolidColorBrush(Color.FromRgb(139, 0, 0));
Messages = new ObservableCollection<string>();
Start = new RelayCommand<RoutedEventArgs>(e => SafeStartKinect());
Stop = new RelayCommand<RoutedEventArgs>(e => SafeStopKinect());
}
}
示例3: PostcardViewModel
public PostcardViewModel(string name, IEnumerable<XElement> xmlRectangles)
{
Name = name;
PictureFrames = xmlRectangles.Select(r => new PictureFrameViewModel(r)).ToList();
SelectToggleCommand = new RelayCommand(() => Selected = !Selected);
}
示例4: ViewViewModel
public ViewViewModel()
{
chatService = ServiceLocator.Current.GetInstance<IChatService>();
parentViewModel = ServiceLocator.Current.GetInstance<PhotosViewModel>();
timer = new Timer(new TimerCallback((c) => {
DispatcherHelper.CheckBeginInvokeOnUI(() =>
{
App.RootFrame.Navigate(new Uri("/View/PhotosPage.xaml", UriKind.RelativeOrAbsolute));
});
}),
null,
Timeout.Infinite,
Timeout.Infinite);
HideCommand = new RelayCommand(async () =>
{
timer.Change(TimeSpan.FromSeconds(6), TimeSpan.FromMilliseconds(-1));
var contentList = await chatService.ReadPhotoContentAsync(
parentViewModel.SelectedPhoto.PhotoContentSecretId);
var content = contentList.FirstOrDefault();
if (content != null)
{
Uri = chatService.ReadPhotoAsUri(content.Uri);
Stream = chatService.ReadPhotoAsStream(content.Uri);
}
else
{
Uri = null;
Stream = null;
}
});
}
示例5: MainViewModel
public MainViewModel()
{
timer = new Timer();
service = new LMService.LMServiceClient();
timer.Interval = 2000;
timer.Elapsed += timer_Elapsed;
MyTeam = new TeamViewModel();
EnemyTeam = new TeamViewModel();
SendSetupCommand = new RelayCommand(SendSetup);
NewGameCommannd = new RelayCommand(NewGame);
CanSendSetup = true;
//Deze halen we later op vanuit de server
Champions = new List<string>(){
"Shaco",
"Sona",
"Vayne",
"Leblanc",
"Aatrox"
};
//Default setup
MyTeam.Top = "Aatrox";
MyTeam.Jungle = "Shaco";
MyTeam.Mid = "Leblanc";
MyTeam.Adc = "Vayne";
MyTeam.Supp = "Sona";
}
示例6: AddOrganizationViewModel
public AddOrganizationViewModel()
{
DoneCommand = new RelayCommand(() =>
{
AddEntry();
});
}
示例7: ReplyViewModel
public ReplyViewModel(IBaconProvider baconProvider, Thing replyTargetThing, RelayCommand cancel, Action<Thing> convertIntoUIReply, bool isEdit = false)
{
_convertIntoUIReply = convertIntoUIReply;
_cancel = cancel;
_baconProvider = baconProvider;
_redditService = _baconProvider.GetService<IRedditService>();
_userService = _baconProvider.GetService<IUserService>();
_markdownProcessor = _baconProvider.GetService<IMarkdownProcessor>();
_replyTargetThing = replyTargetThing;
if (isEdit)
{
Editing = true;
EditingId = ((Comment)_replyTargetThing.Data).Name;
ReplyBody = ((Comment)_replyTargetThing.Data).Body.Replace(">", ">").Replace("<", "<");
}
RefreshUserImpl();
_addBold = new RelayCommand(AddBoldImpl);
_addItalic = new RelayCommand(AddItalicImpl);
_addStrike = new RelayCommand(AddStrikeImpl);
_addSuper = new RelayCommand(AddSuperImpl);
_addLink = new RelayCommand(AddLinkImpl);
_addQuote = new RelayCommand(AddQuoteImpl);
_addCode = new RelayCommand(AddCodeImpl);
_addBullets = new RelayCommand(AddBulletsImpl);
_addNumbers = new RelayCommand(AddNumbersImpl);
_submit = new RelayCommand(SubmitImpl);
_refreshUser = new RelayCommand(RefreshUserImpl);
}
示例8: UnshelveDetailsServiceModel
public UnshelveDetailsServiceModel(ITeamPilgrimServiceModelProvider teamPilgrimServiceModelProvider, ITeamPilgrimVsService teamPilgrimVsService, ProjectCollectionServiceModel projectCollectionServiceModel, WorkspaceServiceModel workspaceServiceModel, UnshelveServiceModel unshelveServiceModel, Shelveset shelveset)
: base(teamPilgrimServiceModelProvider, teamPilgrimVsService)
{
ProjectCollectionServiceModel = projectCollectionServiceModel;
WorkspaceServiceModel = workspaceServiceModel;
UnshelveServiceModel = unshelveServiceModel;
Shelveset = shelveset;
PendingChanges = new ObservableCollection<PendingChangeModel>();
CancelCommand = new RelayCommand(Cancel, CanCancel);
UnshelveCommand = new RelayCommand(Unshelve, CanUnshelve);
SelectPendingChangesCommand = new RelayCommand<SelectPendingChangesCommandArgument>(SelectPendingChanges, CanSelectPendingChanges);
SelectWorkItemsCommand = new RelayCommand<SelectWorkItemsCommandArgument>(SelectWorkItems, CanSelectWorkItems);
PendingSet[] pendingSets;
if (teamPilgrimServiceModelProvider.TryWorkspaceQueryShelvedChanges(WorkspaceServiceModel.Workspace, out pendingSets, shelveset.Name, shelveset.OwnerName, null))
{
PendingSet = pendingSets.First();
foreach (var pendingChange in PendingSet.PendingChanges)
{
PendingChanges.Add(new PendingChangeModel(pendingChange) { IncludeChange = true });
}
}
PopulateSelectedPendingChangesSummary();
}
示例9: ClickToChangePictureViewModel
public ClickToChangePictureViewModel()
{
_myImage1 = new BitmapImage(new Uri("ms-appx:///Images/110Banana.png"));
_myImage2 = new BitmapImage(new Uri("ms-appx:///Images/110Lemon.png"));
ClickCommand = new RelayCommand(ChangeIamges);
ChangeIamges();
}
示例10: CheckInPageViewModel
public CheckInPageViewModel()
{
CheckInCommand = new RelayCommand<int>(CheckIn);
BackCommand = new RelayCommand(NavBack);
//GetUsersName();
Rooms = GetRooms();
}
示例11: PlayerViewModel
public PlayerViewModel(
AudioPlayerHelper helper,
ICollectionService service,
IAppSettingsHelper appSettingsHelper)
{
_helper = helper;
_service = service;
_appSettingsHelper = appSettingsHelper;
if (!IsInDesignMode)
{
helper.TrackChanged += HelperOnTrackChanged;
helper.PlaybackStateChanged += HelperOnPlaybackStateChanged;
helper.Shutdown += HelperOnShutdown;
_nextRelayCommand = new RelayCommand(NextSong);
_prevRelayCommand = new RelayCommand(PrevSong);
_playPauseRelayCommand = new RelayCommand(PlayPauseToggle);
_timer = new DispatcherTimer {Interval = TimeSpan.FromSeconds(1)};
_timer.Tick += TimerOnTick;
}
else
{
CurrentQueue = service.PlaybackQueue.FirstOrDefault();
PlayPauseIcon = Symbol.Play;
}
}
示例12: ViewStockistPurchaseOrderViewModel
public ViewStockistPurchaseOrderViewModel()
{
EditOrderCommand = new RelayCommand(EditOrder);
ApproveOrderCommand = new RelayCommand(ApproveOrder);
ViewOrderPageLoadedCommand = new RelayCommand(LoadOrder);
CancelCommand = new RelayCommand(Cancel);
}
示例13: PandocTaskViewModel
public PandocTaskViewModel()
{
Model = new PandocTask();
AddTargetFile = new RelayCommand(() =>
{
Model.TargetFiles.Add(new TargetFile());
});
RemoveTargetFile = new RelayCommand<TargetFile>(file =>
{
Model.TargetFiles.Remove(file);
}, file => file != null);
Do = new RelayCommand(() =>
{
IsBusy = true;
Task.Factory.StartNew(() =>
{
Result = PandocRunner.Run(this.GetLocator().Config.Model.PandocExePath, Model).Last();
}).ContinueWith(task =>
{
IsBusy = false;
});
}, () => !IsBusy);
}
示例14: StockistPurchaseOrderListingViewModel
public StockistPurchaseOrderListingViewModel()
{
ViewSelectedOrderCommand = new RelayCommand<OrderItemSummary>(ViewSelectedOrder);
CreateOrderCommand = new RelayCommand(CreateOrder);
ViewPrintableOrderCommand = new RelayCommand<OrderItemSummary>(ViewPrintableOrder);
ProcessOrderCommand = new RelayCommand<OrderItemSummary>(ProcessOrder);
}
示例15: SupplementaryReportViewModel
public SupplementaryReportViewModel(IWorkListDataSource dataSource, string siteID, string accessionNumber, string caseURN, CaseConsultationList consultationList,
bool isGlobalReadOnly = false, ReadingSiteType siteType = ReadingSiteType.interpretation)
{
this.DataSource = dataSource;
// case info
this.SiteID = siteID;
this.AccessionNumber = accessionNumber;
this.CaseURN = caseURN;
this.ConsultationList = consultationList;
this.CurrentSiteType = siteType;
this.IsEditorReadOnly = isGlobalReadOnly;
GetConsultationID();
// retrieve all the supplementary reports for the case
srModel = dataSource.GetSupplementalReports(this.CaseURN);
ClearSRCommand = new RelayCommand(ClearSR, () => this.CanClearSR);
AddNewSRCommand = new RelayCommand(AddNewSR, () => this.CanAddNewSR);
UpdateSRCommand = new RelayCommand(UpdateSR, () => this.CanUpdateSR);
VerifySRCommand = new RelayCommand(VerifySR, () => this.CanVerifySR);
CompleteConsultationCommand = new RelayCommand(CompleteConsultation, () => this.CanCompleteConsultation);
ClearSR();
// retrieve the Esignature status at the case's primary site
GetESignatureStatus();
}