本文整理汇总了C#中DelegateCommand类的典型用法代码示例。如果您正苦于以下问题:C# DelegateCommand类的具体用法?C# DelegateCommand怎么用?C# DelegateCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DelegateCommand类属于命名空间,在下文中一共展示了DelegateCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
});
}
示例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);
}
示例3: MainViewModel
public MainViewModel()
{
SearchItemCommand = new DelegateCommand(SearchItem);
UpdateHire1Command = new DelegateCommand(UpdateHire1);
UpdateHire2Command = new DelegateCommand(UpdateHire2);
}
示例4: RenameAccountDialogViewModel
public RenameAccountDialogViewModel(ShellViewModel shell, Account account, string currentName)
: base(shell)
{
_account = account;
_rename = new DelegateCommand(RenameAction);
CurrentAccountName = currentName;
}
示例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);
}
示例6: ConfigService
public ConfigService()
{
LoadAdminInfo();
LoadConfig();
SaveAdminInfoCommand = new DelegateCommand(SaveAdminInfo);
SaveConfigCommand = new DelegateCommand(SaveConfig);
}
示例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);
}
示例8: NodeMasterViewModel
public NodeMasterViewModel(NodeConfig config)
{
m_Config = config;
Name = m_Config.Name;
ConnectCommand = new DelegateCommand(ExecuteConnectCommand);
ThreadPool.QueueUserWorkItem((c) => InitializeWebSocket((NodeConfig)c), config);
}
示例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();
}
示例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);
}
示例11: ActionTriggerViewModel
public ActionTriggerViewModel(BindableNetworkValueBag<string> networkValueCollection)
{
_networkValueCollection = networkValueCollection;
PullItemsAgainCommand = new DelegateCommand(ExecutePullItemsAgain, CanExecutePullItemsAgain);
ClearCommand = new DelegateCommand(ExecuteClear, CanExecuteClear);
}
示例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();
}
示例13: ProcessingDialogViewModel
public ProcessingDialogViewModel()
{
LoadParameters = new DelegateCommand<MassSpecStudio.Core.Domain.Algorithm>(OnLoadParameters);
_algorithms = ServiceLocator.Current.GetAllInstances<IAlgorithm>().ToList();
_selectedAlgorithm = _algorithms.FirstOrDefault();
_recentAlgorithmsUsed = RecentAlgorithms.Read();
}
示例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);
}
示例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";
}