当前位置: 首页>>代码示例>>C#>>正文


C# RelayCommand类代码示例

本文整理汇总了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);
            }
        }
开发者ID:puppyzvezdas,项目名称:CrFSM,代码行数:34,代码来源:ViewModelCrew.cs

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

示例3: MainWindowViewModel

        public MainWindowViewModel(IDialogService dialogService)
        {
            this.dialogService = dialogService;

            ImplicitShowDialogCommand = new RelayCommand(ImplicitShowDialog);
            ExplicitShowDialogCommand = new RelayCommand(ExplicitShowDialog);
        }
开发者ID:Rivolvan,项目名称:mvvm-dialogs,代码行数:7,代码来源:MainWindowViewModel.cs

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

        }
开发者ID:Cronos79,项目名称:iNGEN-Ark-RCON-Desktop,代码行数:33,代码来源:PlayersViewModel.cs

示例5: CustomerListViewModel

        public CustomerListViewModel()
        {
            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) return;

            //Customers = new ObservableCollection<Customer>(_customersRepo.GetCustomersAsync().Result);
            DeleteCommand = new RelayCommand(OnDelete, CanDelete);
        }
开发者ID:shymibg,项目名称:WPFMVVM-StarterCode,代码行数:7,代码来源:CustomerListViewModel.cs

示例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);
        }
开发者ID:lapSy89,项目名称:Windows-Project,代码行数:27,代码来源:BaseViewModel.cs

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

示例8: SearchViewModel

 public SearchViewModel(ISearchService searchService)
 {
     this.searchService = searchService;
     Search = new RelayCommand(SearchExecuted);
     ShowDetails = new RelayCommand<SearchResult>(ShowDetailsExecuted);
     Results = new List<SearchResult>();
 }
开发者ID:p69,项目名称:magellan-framework,代码行数:7,代码来源:SearchViewModel.cs

示例9: IntroductionViewModel

        public IntroductionViewModel(GenericDataAccess<string> dataAccess)
        {
            this.dataAccess = dataAccess;
            introduction = dataAccess.TryLoad();

            SaveCommand = new RelayCommand<object>(_ => Save());
        }
开发者ID:BenjaminHamon,项目名称:MyWebsite,代码行数:7,代码来源:IntroductionViewModel.cs

示例10: TerminalWindowViewModel

 public TerminalWindowViewModel()
     : base()
 {
     HomeCommand = new RelayCommand(Home);
     SearchServiceCommand = new RelayCommand(SearchService);
     UnloadedCommand = new RelayCommand(Dispose);
 }
开发者ID:breslavsky,项目名称:queue,代码行数:7,代码来源:TerminalWindowViewModel.cs

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

示例12: RegisterCommands

 /// <summary>
 /// Register commands
 /// </summary>
 private void RegisterCommands()
 {
     StopPlayingMediaCommand = new RelayCommand(() =>
     {
         Messenger.Default.Send(new StopPlayingMovieMessage());
     });
 }
开发者ID:MozzieMD,项目名称:Popcorn,代码行数:10,代码来源:MoviePlayerViewModel.cs

示例13: AllSongsViewModel

 public AllSongsViewModel()
 {
     GoBackCommand = new RelayCommand(GoBack);
     AddToQueueCommand = new RelayCommand(AddToQueue);
     PlayCommand = new RelayCommand(Play);
     SongHits = (List<Song>)NavigationService.GetInstance().Content;   
 }
开发者ID:kbettadapur,项目名称:MusicPlayer,代码行数:7,代码来源:AllSongsViewModel.cs

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

示例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 = "";
        }
开发者ID:PaulSchrum,项目名称:RM21SourceCore,代码行数:27,代码来源:PlanSchematicViewModel.cs


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