• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Command.RelayCommand类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中GalaSoft.MvvmLight.Command.RelayCommand的典型用法代码示例。如果您正苦于以下问题:C# RelayCommand类的具体用法?C# RelayCommand怎么用?C# RelayCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RelayCommand类属于GalaSoft.MvvmLight.Command命名空间,在下文中一共展示了RelayCommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
        }
开发者ID:koenmetsu,项目名称:WP7.TapDance,代码行数:33,代码来源:MainViewModel.cs


示例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());
     }
 }
开发者ID:atosorigin,项目名称:Kinect,代码行数:31,代码来源:WorkshopViewModelBase.cs


示例3: PostcardViewModel

        public PostcardViewModel(string name, IEnumerable<XElement> xmlRectangles)
        {
            Name = name;
            PictureFrames = xmlRectangles.Select(r => new PictureFrameViewModel(r)).ToList();

            SelectToggleCommand = new RelayCommand(() => Selected = !Selected);
        }
开发者ID:peerio,项目名称:ZonerPostcardManager,代码行数:7,代码来源:PostcardViewModel.cs


示例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;
                }

            });
        }
开发者ID:yeenfei,项目名称:samples,代码行数:34,代码来源:ViewViewModel.cs


示例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";
        }
开发者ID:Bart-Mutsaers,项目名称:Prog6_uitwerkingen,代码行数:28,代码来源:MainViewModel.cs


示例6: AddOrganizationViewModel

 public AddOrganizationViewModel()
 {
     DoneCommand = new RelayCommand(() =>
     {
         AddEntry();
     });
 }
开发者ID:maskaravivek,项目名称:FoodMenu,代码行数:7,代码来源:AddOrganizationViewModel.cs


示例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("&gt;", ">").Replace("&lt;", "<");
            }

			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);
        }
开发者ID:Synergex,项目名称:Baconography,代码行数:31,代码来源:ReplyViewModel.cs


示例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();
        }
开发者ID:BruceMellows,项目名称:TeamPilgrim,代码行数:29,代码来源:UnshelveDetailsServiceModel.cs


示例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();
 }
开发者ID:Aadeelyoo,项目名称:MyMSDNSamples,代码行数:7,代码来源:ClickToChangePictureViewModel.cs


示例10: CheckInPageViewModel

 public CheckInPageViewModel()
 {
     CheckInCommand = new RelayCommand<int>(CheckIn);
     BackCommand = new RelayCommand(NavBack);
     //GetUsersName();
     Rooms = GetRooms();
 }
开发者ID:vtesin,项目名称:Levi9-GeoTagging,代码行数:7,代码来源:CheckInPageViewModel.cs


示例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;
            }
        }
开发者ID:jayharry28,项目名称:Audiotica,代码行数:28,代码来源:PlayerViewModel.cs


示例12: ViewStockistPurchaseOrderViewModel

 public ViewStockistPurchaseOrderViewModel()
 {
     EditOrderCommand = new RelayCommand(EditOrder);
     ApproveOrderCommand = new RelayCommand(ApproveOrder);
     ViewOrderPageLoadedCommand = new RelayCommand(LoadOrder);
     CancelCommand = new RelayCommand(Cancel);
 }
开发者ID:asanyaga,项目名称:BuildTest,代码行数:7,代码来源:ViewStockistPurchaseOrderViewModel.cs


示例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);
        }
开发者ID:nagysa1313,项目名称:PandocGUI,代码行数:26,代码来源:PandocTaskViewModel.cs


示例14: StockistPurchaseOrderListingViewModel

 public StockistPurchaseOrderListingViewModel()
 {
     ViewSelectedOrderCommand = new RelayCommand<OrderItemSummary>(ViewSelectedOrder);
     CreateOrderCommand = new RelayCommand(CreateOrder);
     ViewPrintableOrderCommand = new RelayCommand<OrderItemSummary>(ViewPrintableOrder);
     ProcessOrderCommand = new RelayCommand<OrderItemSummary>(ProcessOrder);
 }
开发者ID:asanyaga,项目名称:BuildTest,代码行数:7,代码来源:StockistPurchaseOrderListingViewModel.cs


示例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();
        }
开发者ID:zhanghongzhitou,项目名称:Telepathology,代码行数:29,代码来源:SupplementaryReportViewModel.cs


示例16: LogonViewModel

        /// <summary>
        /// Constructor
        /// </summary>
        public LogonViewModel()
        {
            LogonCommand = new RelayCommand(LogonCommandCF, CanLogonCommand);

            // Registe MVVM Message Sytem
            Messenger.Default.Register<String>(this, MVVMMessageFunction);
        }
开发者ID:uhwgmxorg,项目名称:MyWPFPageApp,代码行数:10,代码来源:LogonViewModel.cs


示例17: NewMeasurementViewModel

        /// <summary>
        /// Constructor of the class. Sets up commands and initializes variables.
        /// </summary>
        public NewMeasurementViewModel()
        {
            Database = MyGlobals.Database;

            NewSampleCommand = new RelayCommand(() => _NewSampleCommand(), () => true);

            StartMeasurementCommand = new RelayCommand(() => _StartMeasurementCommand(), () => true);
            CancelCommand = new RelayCommand(() => _CancelCommand(), () => true);

            Channels_10 = new ObservableCollection<CheckedListItem<int>> { new CheckedListItem<int>(0), new CheckedListItem<int>(1), new CheckedListItem<int>(2), new CheckedListItem<int>(3) };
            Channels_30 = new ObservableCollection<CheckedListItem<int>> { new CheckedListItem<int>(4), new CheckedListItem<int>(5) };

            Channels_10[0].IsChecked = true;
            Channels_30[0].IsChecked = true;

            Orientations = new ObservableCollection<string> { "(undefined)", "random", "aligned" };
            Chambers = new ObservableCollection<string> { "(undefined)", "-10°", "-30°" };
            StopTypes = new ObservableCollection<string> { "Manual", "Duration (min)", "Charge (µC)", "Counts", "ChopperCounts" };
            Ions = new ObservableCollection<Isotope>(Database.Elements.Where(x => x.AtomicNumber <= 3).SelectMany(y => y.Isotopes).Where(z => z.MassNumber > 0).ToList());

            Samples = new ObservableCollection<Sample>(Database.Samples.ToList());

            NewMeasurement = Database.Measurements.Where(y => y.MeasurementName != "TestMeasurement").OrderByDescending(x => x.StartTime).First();

            VariableParameters = new ObservableCollection<string> { "x", "y", "Theta", "Phi", "Energy", "Charge" };
        }
开发者ID:Emanuesson,项目名称:newRBS,代码行数:29,代码来源:NewMeasurementViewModel.cs


示例18: UpdateInstallPrompt

      public UpdateInstallPrompt(Version current, Version latest, bool isStable)
      {
         InitializeComponent();

         CurrentVersion = current;
         LatestVersion = latest;
         StableVersionNoticeVisibility = isStable ? Visibility.Visible : Visibility.Collapsed;
         PrereleaseVersionNoticeVisibility = isStable ? Visibility.Collapsed : Visibility.Visible;

         InstallOnExitCommand = new RelayCommand(() =>
         {
            Result = UpdatePromptResult.InstallOnExit;
            Close();
         });
         CloseAndInstallCommand = new RelayCommand(() =>
         {
            Result = UpdatePromptResult.ExitAndInstall;
            Close();
         });
         ManualInstallCommand = new RelayCommand(() =>
         {
            Result = UpdatePromptResult.InstallManually;
            Close();
         });
         CancelCommand = new RelayCommand(() =>
         {
            Result = UpdatePromptResult.None;
            Close();
         });

         Result = UpdatePromptResult.None;

         DataContext = this;
      }
开发者ID:sceeter89,项目名称:jira-client,代码行数:34,代码来源:UpdateInstallPrompt.xaml.cs


示例19: VoucherListViewModel

        public VoucherListViewModel()
        {
            CleanAndPostVouchersCommand = new RelayCommand(CleanVouchersStub, CanRunBackgroundCleaner);

            Messenger.Default.Register<NotificationMessage<vwPayment>>(this, message =>
            {
                if (message.Notification == Notifications.HistoryPaymentSent)
                {
                    PopulateSelectedVoucherFromOldPayment(message.Content);
                }
            });
            Messenger.Default.Register<NotificationMessage<VoucherWrappersMessage>>(this, message =>
            {
                if (message.Notification == Notifications.VouchersDataCleaned)
                {
                    VoucherImports =
                        new ObservableCollection<VoucherImportWrapper>(
                            message.Content.VoucherImports.OrderBy(x => x.OkMailingAddress)
                                .ThenBy(x => x.OkPhone)
                                .ThenBy(x => x.OkEmailAddress)
                               .ToList());
                           FilterVoucherImports();
                    ExcelFileInfo = message.Content.ExcelFileInfo;
                }
                });

            Messenger.Default.Register<NotificationMessage<DataCleanCriteria>>(this, message =>
            {
                if (message.Notification == Notifications.DataCleanCriteriaUpdated)
                {
                    _dataCleanCriteria = message.Content;
                }
            });
            
        }
开发者ID:FrankMedvedik,项目名称:coopcheck,代码行数:35,代码来源:VoucherListViewModel.cs


示例20: MainViewModel

        public MainViewModel(INavigationService navigationService)
        {
            if (navigationService == null) throw new ArgumentNullException(nameof(navigationService));
            _navigationService = navigationService;

            ShowMessageCommand = new RelayCommand(ShowMessage);
        }
开发者ID:HouseOfTheFuture,项目名称:Mobile-App,代码行数:7,代码来源:MainViewModel.cs



注:本文中的GalaSoft.MvvmLight.Command.RelayCommand类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Helpers.Binding类代码示例发布时间:2022-05-26
下一篇:
C# GUI.frmBaoCaorpt类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap