本文整理汇总了C#中DelegateCommand类的典型用法代码示例。如果您正苦于以下问题:C# DelegateCommand类的具体用法?C# DelegateCommand怎么用?C# DelegateCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DelegateCommand类属于命名空间,在下文中一共展示了DelegateCommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LoggedInUserViewModel
public LoggedInUserViewModel()
{
EventServiceFactory.EventService.GetEvent<GenericEvent<User>>().Subscribe(x =>
{
if (x.Topic == EventTopicNames.UserLoggedIn) UserLoggedIn(x.Value);
if (x.Topic == EventTopicNames.UserLoggedOut) UserLoggedOut(x.Value);
});
LoggedInUser = AppServices.CurrentLoggedInUser;
LogoutUserCommand = new DelegateCommand<User>(x =>
{
if (AppServices.CanNavigate())
{
if (AppServices.IsUserPermittedFor(PermissionNames.OpenNavigation))
{
EventServiceFactory.EventService.PublishEvent(EventTopicNames.ActivateNavigation);
}
else
{
AppServices.CurrentLoggedInUser.PublishEvent(EventTopicNames.UserLoggedOut);
AppServices.LogoutUser();
}
}
});
}
开发者ID:basio,项目名称:veropos,代码行数:25,代码来源:LoggedInUserViewModel.cs
示例2: CalendarViewModel
public CalendarViewModel(ICalendarService calendarService, IRegionManager regionManager)
{
this.synchronizationContext = SynchronizationContext.Current ?? new SynchronizationContext();
this.openMeetingEmailCommand = new DelegateCommand<Meeting>(this.OpenMeetingEmail);
this.meetings = new ObservableCollection<Meeting>();
this.calendarService = calendarService;
this.regionManager = regionManager;
this.calendarService.BeginGetMeetings(
r =>
{
var meetings = this.calendarService.EndGetMeetings(r);
this.synchronizationContext.Post(
s =>
{
foreach (var meeting in meetings)
{
this.Meetings.Add(meeting);
}
},
null);
},
null);
}
开发者ID:eslahi,项目名称:prism,代码行数:28,代码来源:CalendarViewModel.cs
示例3: MainViewModel
public MainViewModel()
{
SearchItemCommand = new DelegateCommand(SearchItem);
UpdateHire1Command = new DelegateCommand(UpdateHire1);
UpdateHire2Command = new DelegateCommand(UpdateHire2);
}
开发者ID:Yaguar666,项目名称:ffxivapp-plugin-itemdb,代码行数:7,代码来源:MainViewModel.cs
示例4: RenameAccountDialogViewModel
public RenameAccountDialogViewModel(ShellViewModel shell, Account account, string currentName)
: base(shell)
{
_account = account;
_rename = new DelegateCommand(RenameAction);
CurrentAccountName = currentName;
}
开发者ID:btcsuite,项目名称:Paymetheus,代码行数:7,代码来源:RenameAccountDialogViewModel.cs
示例5: InfoLinkDecal
public InfoLinkDecal()
{
MetaData = new InfoLinkMetaData() { Source = "http://" };
Stretch = System.Windows.Media.Stretch.Uniform;
Size = 1;
CanResize = false;
Stretch = System.Windows.Media.Stretch.None;
Center = new System.Windows.Point(1, 1);
PinPoint = new System.Windows.Point(1, 1);
CanMove = false;
OpenUrl = new DelegateCommand(() =>
{
if (!MetaData.Source.StartsWith("http://"))
{
MetaData.Source = "http://" + MetaData.Source;
}
#if WINDOWS_PHONE
Microsoft.Phone.Controls.PhoneApplicationFrame frame = Application.Current.RootVisual as Microsoft.Phone.Controls.PhoneApplicationFrame;
frame.Navigate(new Uri(MetaData.Source));
#elif SILVERLIGHT
HtmlPage.Window.Navigate(new Uri(MetaData.Source), "_blank");
#else
Process.Start(MetaData.Source);
#endif
}, CanOpenUrl);
}
开发者ID:luiseduardohdbackup,项目名称:dotnet-1,代码行数:28,代码来源:InfoLinkDecal.cs
示例6: ConfigService
public ConfigService()
{
LoadAdminInfo();
LoadConfig();
SaveAdminInfoCommand = new DelegateCommand(SaveAdminInfo);
SaveConfigCommand = new DelegateCommand(SaveConfig);
}
开发者ID:hazelor,项目名称:Applications.ComMonitor,代码行数:7,代码来源:ConfigService.cs
示例7: GeoRegionMaintenanceViewModel
public GeoRegionMaintenanceViewModel(IModuleController moduleController, IDataRepository repository, IEventAggregator eventAggregator)
{
_moduleController = moduleController;
_repository = repository;
_eventAggregator = eventAggregator;
ShowView = _moduleController.ShowViewCommand;
NavigationDetails = _moduleController.NavigationDetails;
ChangeMetaPanel = new DelegateCommand<bool?>(ChangeMetaViewPanel);
ChangeGeoPanel = new DelegateCommand<bool?>(ChangeGeoViewPanel);
DeleteMetaRegionCommand = new DelegateCommand(DeleteMetaRegion);
EditMetaRegionCommand = new DelegateCommand(EditMetaRegion);
AddNewMetaRegionCommand = new DelegateCommand(AddNewMetaRegion);
DeleteMetaRegionMappingCommand = new DelegateCommand(DeleteMetaRegionMapping);
AddMetaRegionMappingCommand = new DelegateCommand(AddMetaRegionMapping);
DeleteGeoRegionCommand = new DelegateCommand(DeleteGeoRegion);
EditGeoRegionCommand = new DelegateCommand(EditGeoRegion);
CreateNewGeoRegionCommand = new DelegateCommand(CreateNewGeoRegion);
_metaRegions = new ObservableCollection<t033_meta_region>();
_metaRegionMappings = new ObservableCollection<t031_geo_code>();
_geoRegions = new ObservableCollection<GeoRegionViewModel>();
_moduleController.SwitchPanel(MaintenanceRegionNames.MetaRegionRegion, MaintenanceViewNames.MetaRegionView);
_moduleController.SwitchPanel(MaintenanceRegionNames.GeoRegionRegion, MaintenanceViewNames.GeoRegionView);
_moduleController.SwitchPanel(MaintenanceRegionNames.MetaRegionMappingRegion, MaintenanceViewNames.MetaRegionMappingView);
_eventAggregator.GetEvent<RefreshRegionsEvent>().Subscribe(InitializeData);
}
开发者ID:nzjamesk,项目名称:Nephila,代码行数:31,代码来源:GeoRegionMaintenanceViewModel.cs
示例8: NodeMasterViewModel
public NodeMasterViewModel(NodeConfig config)
{
m_Config = config;
Name = m_Config.Name;
ConnectCommand = new DelegateCommand(ExecuteConnectCommand);
ThreadPool.QueueUserWorkItem((c) => InitializeWebSocket((NodeConfig)c), config);
}
开发者ID:huamanhtuyen,项目名称:TagLo2,代码行数:7,代码来源:NodeMasterViewModel.cs
示例9: MechanicalNavigationViewModel
public MechanicalNavigationViewModel(SearchFilterControl searchFilterControl)
{
CompositionInitializer.SatisfyImports(this);
mSearchFilterControl = searchFilterControl;
mGridRefreshTimer.Interval = TimeSpan.FromMilliseconds(500);
mGridRefreshTimer.Tick += (sender, eventArgs) => { mGridRefreshTimer.Stop(); ProcessSearchFilter(); };
ImportNewMechanicalsCommand = new DelegateCommand<object>(ImportNewMechanicalsHandler, CanImport);
ImportNewMechanicalComponentsCommand = new DelegateCommand<object>(ImportNewMechanicalComponentsHandler, CanImport);
ImportNewRelatedDocumentsCommand = new DelegateCommand<object>(ImportNewRelatedDocumentsHandler, CanImport);
ImportExistingMechanicalsCommand = new DelegateCommand<object>(ImportExistingMechanicalsHandler, CanImport);
ImportExistingMechanicalComponentsCommand = new DelegateCommand<object>(ImportExistingMechanicalComponentsHanlder, CanImport);
CreateAttachmentsCommand = new DelegateCommand<object>(CreateAttachmentsHandler, CanImport);
PreferredEquipmentCommand = new DelegateCommand<object>(PreferredEquipmentHandler, x => (CMS.EffectivePrivileges.AdminTab.CanView || CMS.EffectivePrivileges.MechanicalTab.CanView));
ClearFilterCommand = new DelegateCommand<object>(x => { ClearControls(); ProcessSearchFilter(); searchFilterControl.SetFilterIsOn(false); }, x => true);
SearchCommand = new DelegateCommand<object>(x => ProcessSearchFilter(), x => true);
KeywordKeyCommand = new DelegateCommand<object>(x => ProcessSearchFilter(), x => true);
MaintSysIdKeyCommand = new DelegateCommand<object>(x => ProcessSearchFilter(), x => true);
LoadData();
}
开发者ID:barrett2474,项目名称:CMS2,代码行数:26,代码来源:MechanicalNavigationViewModel.cs
示例10: LoginViewModel
public LoginViewModel(IEventAggregator messageBus)
{
_messageBus = messageBus;
LoginCommand = new DelegateCommand<object>(Login);
_serviceFacade = ((ServiceLocator)App.Current.Resources["ServiceLocator"]).ServiceFacade;
_serviceFacade.LoginCompletedEvent += new EventHandler<HsrOrderApp.UI.Silverlight.AuthenticationService.LoginCompletedEventArgs>(LoginViewModel_LoginCompletedEvent);
}
开发者ID:ikelos555,项目名称:HSROrderApp,代码行数:7,代码来源:LoginViewModel.cs
示例11: ActionTriggerViewModel
public ActionTriggerViewModel(BindableNetworkValueBag<string> networkValueCollection)
{
_networkValueCollection = networkValueCollection;
PullItemsAgainCommand = new DelegateCommand(ExecutePullItemsAgain, CanExecutePullItemsAgain);
ClearCommand = new DelegateCommand(ExecuteClear, CanExecuteClear);
}
开发者ID:JPVenson,项目名称:WPFCommon,代码行数:7,代码来源:ActionTriggerViewModel.cs
示例12: MyDayViewModel
public MyDayViewModel(
[Import] IEventAggregator aggregator,
[Import] ITasksService tasksService,
[Import] IProjectsService projectsService,
[Import] ITeamService teamService,
[Import] IBackgroundExecutor executor,
[Import] IAuthorizationService authorizator)
: base(aggregator, tasksService, projectsService, teamService, executor, authorizator)
{
aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged, OnSignedMemberChanged);
aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskAdded, t => { UpdateTasks(); });
aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskAssigneeChanged, t => { UpdateTasks(); });
aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskChanged, t => { UpdateTasks(); });
aggregator.Subscribe<ICollection<ProjectInfo>>(ScrumFactoryEvent.RecentProjectChanged, prjs => {
List<ProjectInfo> prjs2 = new List<ProjectInfo>(prjs);
if (MemberEngagedProjects != null)
prjs2.RemoveAll(p => MemberEngagedProjects.Any(ep => ep.ProjectUId == p.ProjectUId));
RecentProjects = prjs2.Take(8).ToList();
OnPropertyChanged("RecentProjects");
});
OnLoadCommand = new DelegateCommand(OnLoad);
RefreshCommand = new DelegateCommand(Load);
ShowMemberDetailCommand = new DelegateCommand<MemberProfile>(ShowMemberDetail);
CreateNewProjectCommand = new DelegateCommand(CreateNewProject);
eventsViewSource = new System.Windows.Data.CollectionViewSource();
}
开发者ID:klot-git,项目名称:scrum-factory,代码行数:30,代码来源:MyDayViewModel.cs
示例13: ProcessingDialogViewModel
public ProcessingDialogViewModel()
{
LoadParameters = new DelegateCommand<MassSpecStudio.Core.Domain.Algorithm>(OnLoadParameters);
_algorithms = ServiceLocator.Current.GetAllInstances<IAlgorithm>().ToList();
_selectedAlgorithm = _algorithms.FirstOrDefault();
_recentAlgorithmsUsed = RecentAlgorithms.Read();
}
开发者ID:pol,项目名称:MassSpecStudio,代码行数:7,代码来源:ProcessingDialogViewModel.cs
示例14: dynNodeViewModel
public dynNodeViewModel(dynNodeModel logic)
{
nodeLogic = logic;
//respond to collection changed events to sadd
//and remove port model views
logic.InPorts.CollectionChanged += inports_collectionChanged;
logic.OutPorts.CollectionChanged += outports_collectionChanged;
logic.PropertyChanged += logic_PropertyChanged;
dynSettings.Controller.DynamoViewModel.Model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(Model_PropertyChanged);
DeleteCommand = new DelegateCommand(DeleteNodeAndItsConnectors, CanDeleteNode);
SetLacingTypeCommand = new DelegateCommand<string>(new Action<string>(SetLacingType), CanSetLacingType);
SetStateCommand = new DelegateCommand<object>(SetState, CanSetState);
SelectCommand = new DelegateCommand(Select, CanSelect);
ViewCustomNodeWorkspaceCommand = new DelegateCommand(ViewCustomNodeWorkspace, CanViewCustomNodeWorkspace);
SetLayoutCommand = new DelegateCommand<object>(SetLayout, CanSetLayout);
SetupCustomUIElementsCommand = new DelegateCommand<dynNodeView>(SetupCustomUIElements, CanSetupCustomUIElements);
ValidateConnectionsCommand = new DelegateCommand(ValidateConnections, CanValidateConnections);
//Do a one time setup of the initial ports on the node
//we can not do this automatically because this constructor
//is called after the node's constructor where the ports
//are initially registered
SetupInitialPortViewModels();
dynSettings.Controller.RequestNodeSelect += new NodeEventHandler(Controller_RequestNodeSelect);
}
开发者ID:romeo08437,项目名称:Dynamo,代码行数:29,代码来源:dynNodeViewModel.cs
示例15: RiskAnalyserViewModel
public RiskAnalyserViewModel(ICustomerService customerService)
{
_customerService = customerService;
try
{
_customerService.Init();
cutSettledBets = new ObservableCollection<CustomerBet>(_customerService.CustomerSettledBets);
cutUnSettledBets = new ObservableCollection<CustomerBet>(_customerService.CustomerUnSettledBets);
}
catch (Exception e)
{
Header = e.Message;
}
SettleBets = new ObservableCollection<Bet>(cutSettledBets.SelectMany(d => d.Bet).ToList());
UnSettleBets = new ObservableCollection<Bet>(cutUnSettledBets.SelectMany(d => d.Bet).ToList());
ShowSettled = new DelegateCommand(VisibleSettled);
ShowUnSettled = new DelegateCommand(VisibleUnSettled);
ShowUnusalWinning = new DelegateCommand(UnsualWinning);
ShowUnusalStake = new DelegateCommand(UnusalStake);
ShowHighlyUnusalStake = new DelegateCommand(HighlyUnusalStake);
ShowBigWin = new DelegateCommand(BigWin);
Header = "Settled Bets";
}
开发者ID:Dipendran,项目名称:WHA,代码行数:32,代码来源:RiskAnalyserViewModel.cs
示例16: SongsPageViewModel
public SongsPageViewModel(
ILibraryCollectionService libraryCollectionService,
ILibraryService libraryService,
ISettingsUtility settingsUtility,
IPlayerService playerService)
{
_libraryCollectionService = libraryCollectionService;
_settingsUtility = settingsUtility;
_playerService = playerService;
LibraryService = libraryService;
SortItems =
Enum.GetValues(typeof (TrackSort))
.Cast<TrackSort>()
.Select(sort => new ListBoxItem { Content = sort.GetEnumText(), Tag = sort })
.ToList();
SortChangedCommand = new DelegateCommand<ListBoxItem>(SortChangedExecute);
ShuffleAllCommand = new DelegateCommand(ShuffleAllExecute);
var defaultSort = _settingsUtility.Read(ApplicationSettingsConstants.SongSort,
TrackSort.DateAdded,
SettingsStrategy.Roam);
DefaultSort = SortItems.IndexOf(SortItems.FirstOrDefault(p => (TrackSort)p.Tag == defaultSort));
ChangeSort(defaultSort);
}
开发者ID:haroldma,项目名称:Audiotica,代码行数:25,代码来源:SongsPageViewModel.cs
示例17: CustomizeablePropertyViewModel
public CustomizeablePropertyViewModel(EditablePropertyViewModel PropertyViewModel)
{
this.PropertyViewModel = PropertyViewModel;
Name = this.PropertyViewModel.Name;
Value = this.PropertyViewModel.Value.ToString();
Customize = new DelegateCommand(CustomizeAction);
}
开发者ID:NpoSaut,项目名称:LocoBase,代码行数:7,代码来源:CustomizeablePropertyViewModel.cs
示例18: TypeViewModel
public TypeViewModel(TypeInfo typeInfo)
{
_isExpanded = true;
_typeInfo = typeInfo;
if (_typeInfo.BaseType != null)
{
BaseType = new TypeViewModel(_typeInfo.BaseType);
}
_fields = _typeInfo.Fields
.OrderBy(f => f.Name)
.Select(f => new FieldViewModel(f))
.OfType<MemberViewModel>()
.ToArray();
_properties = _typeInfo.Properties
.OrderBy(p => p.Name)
.Select(p => new PropertyViewModel(p))
.OfType<MemberViewModel>()
.ToArray();
_events = _typeInfo.Events
.OrderBy(e => e.Name)
.Select(e => new EventViewModel(e))
.OfType<MemberViewModel>()
.ToArray();
_methods = _typeInfo.Methods
.OrderBy(m => m.Name)
.Select(m => new MethodViewModel(m))
.OfType<MemberViewModel>()
.ToArray();
NavigateCommand = new DelegateCommand(NavigateCommandHandler);
BrowseInteractionsCommand = new DelegateCommand(BrowseInteractionsCommandHandler);
}
开发者ID:GREYFOXRGR,项目名称:AssemblyVisualizer,代码行数:33,代码来源:TypeViewModel.cs
示例19: DebugWindowViewModel
public DebugWindowViewModel(IEventAggregator eventAggregator) {
_eventAggregator = eventAggregator;
DebugStrings = new ObservableCollection<string>();
_eventAggregator.GetEvent<SetDebugMessageEvent>().Subscribe(SetMessage);
SendCloseMessageCommand = new DelegateCommand(SendCloseMessage);
ExportListCommand = new DelegateCommand(ExportList);
}
开发者ID:Rushman1,项目名称:PictureViewer,代码行数:7,代码来源:DebugWindowViewModel.cs
示例20: AddEditIssueMilestoneDelayTypeModel
public AddEditIssueMilestoneDelayTypeModel()
{
mIssueMilestoneDelayType = new IssueMilestoneDelayType();
OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler);
CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, CanExecuteOkButtonHandler);
}
开发者ID:barrett2474,项目名称:CMS2,代码行数:7,代码来源:AddEditIssueMilestoneDelayTypeModel.cs
注:本文中的DelegateCommand类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论