本文整理汇总了C#中SubscriptionToken类的典型用法代码示例。如果您正苦于以下问题:C# SubscriptionToken类的具体用法?C# SubscriptionToken怎么用?C# SubscriptionToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SubscriptionToken类属于命名空间,在下文中一共展示了SubscriptionToken类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Contains
/// <summary>
/// Returns <see langword="true"/> if there is a subscriber matching <see cref="SubscriptionToken"/>.
/// </summary>
/// <param name="token">The <see cref="SubscriptionToken"/> returned by <see cref="EventBase"/> while subscribing to the event.</param>
/// <returns><see langword="true"/> if there is a <see cref="SubscriptionToken"/> that matches; otherwise <see langword="false"/>.</returns>
public virtual bool Contains(SubscriptionToken token)
{
lock (Subscriptions) {
IEventSubscription subscription = Subscriptions.FirstOrDefault(evt => evt.SubscriptionToken == token);
return subscription != null;
}
}
开发者ID:michaelnero,项目名称:SignalR-demos,代码行数:12,代码来源:EventBase.cs
示例2: WhenDisposeIsCalledMoreThanOnce_ThenExceptionIsNotThrown
public void WhenDisposeIsCalledMoreThanOnce_ThenExceptionIsNotThrown()
{
SubscriptionToken token = new SubscriptionToken(t => { });
token.Dispose();
token.Dispose();
}
开发者ID:selvendiranj,项目名称:compositewpf-copy,代码行数:7,代码来源:SubscriptionTokenFixture.cs
示例3: Equals_Should_Return_False_When_Comparing_Different_Instances
public void Equals_Should_Return_False_When_Comparing_Different_Instances()
{
SubscriptionToken token = new SubscriptionToken();
object tokenObject = new SubscriptionToken();
Assert.False(token.Equals(tokenObject));
}
开发者ID:JoeyCyril,项目名称:BoC,代码行数:8,代码来源:SubscriptionTokenFixture.cs
示例4: EqualsShouldReturnFalseWhenComparingDifferentInstances
public void EqualsShouldReturnFalseWhenComparingDifferentInstances()
{
var aToken = new SubscriptionToken();
object anotherToken = new SubscriptionToken();
Assert.That(aToken.Equals(anotherToken), Is.False);
}
开发者ID:pleb,项目名称:Tank,代码行数:8,代码来源:SubscriptionTokenFixture.cs
示例5: HashCodeIsTheSameForSameToken
public void HashCodeIsTheSameForSameToken()
{
SubscriptionToken token = new SubscriptionToken();
int hashCode = token.GetHashCode();
Assert.AreNotEqual(0, hashCode);
Assert.AreEqual(hashCode, token.GetHashCode());
}
开发者ID:selvendiranj,项目名称:compositewpf-copy,代码行数:8,代码来源:SubscriptionTokenFixture.cs
示例6: EqualsShouldReturnFalseWhenComparingDifferentObjectInstances
public void EqualsShouldReturnFalseWhenComparingDifferentObjectInstances()
{
SubscriptionToken token = new SubscriptionToken();
object tokenObject = new SubscriptionToken();
Assert.IsFalse(token.Equals(tokenObject));
}
开发者ID:selvendiranj,项目名称:compositewpf-copy,代码行数:8,代码来源:SubscriptionTokenFixture.cs
示例7: EqualsShouldReturnTrueWhenComparingSameObjectInstances
public void EqualsShouldReturnTrueWhenComparingSameObjectInstances()
{
SubscriptionToken token = new SubscriptionToken();
object tokenObject = token;
Assert.IsTrue(token.Equals(tokenObject));
}
开发者ID:selvendiranj,项目名称:compositewpf-copy,代码行数:8,代码来源:SubscriptionTokenFixture.cs
示例8: Unsubscribe
/// <summary>
/// Removes the subscriber matching the <seealso cref="SubscriptionToken"/>.
/// </summary>
/// <param name="token">The <see cref="SubscriptionToken"/> returned by <see cref="EventBase"/> while subscribing to the event.</param>
public virtual void Unsubscribe(SubscriptionToken token)
{
lock (Subscriptions) {
IEventSubscription subscription = Subscriptions.FirstOrDefault(evt => evt.SubscriptionToken == token);
if (subscription != null) {
Subscriptions.Remove(subscription);
}
}
}
开发者ID:michaelnero,项目名称:SignalR-demos,代码行数:13,代码来源:EventBase.cs
示例9: Unsubscribe
/// <summary>
/// 移除符合<seealso cref="T:UniCloud.Domain.Events.SubscriptionToken" />的订阅。
/// </summary>
/// <param name="token">
/// 订阅事件时,由<see cref="T:UniCloud.Domain.Events.EventBase" />返回的
/// <see cref="T:UniCloud.Domain.Events.SubscriptionToken" />。
/// </param>
public virtual void Unsubscribe(SubscriptionToken token)
{
lock (Subscriptions)
{
var local0 = Subscriptions.FirstOrDefault(evt => evt.SubscriptionToken == token);
if (local0 == null)
return;
Subscriptions.Remove(local0);
}
}
开发者ID:unicloud,项目名称:FRP,代码行数:17,代码来源:EventBase.cs
示例10: WhenSubscriptionTokenIsDisposed_ThenEventUnSubscribes
public void WhenSubscriptionTokenIsDisposed_ThenEventUnSubscribes()
{
bool unsubscribed = false;
SubscriptionToken token = new SubscriptionToken(t => { unsubscribed = true; });
token.Dispose();
Assert.IsTrue(unsubscribed);
}
开发者ID:selvendiranj,项目名称:compositewpf-copy,代码行数:10,代码来源:SubscriptionTokenFixture.cs
示例11: Stop
public Task<bool> Stop()
{
bool returnValue = false;
try
{
// ***
// *** Unsubscribe from the event
// ***
if (_exceptionEventToken != null)
{
this.EventAggregator.GetEvent<Events.TemperatureChangedEvent>().Unsubscribe(_exceptionEventToken);
_exceptionEventToken.Dispose();
_exceptionEventToken = null;
}
// ***
// *** Release the collection items
// ***
this.Items.Clear();
returnValue = true;
}
catch (Exception ex)
{
this.EventAggregator.GetEvent<Events.DebugEvent>().Publish(new DebugEventArgs(ex));
returnValue = false;
}
return Task<bool>.FromResult(returnValue);
}
开发者ID:jango2015,项目名称:sensortelemetry,代码行数:31,代码来源:DebugConsoleService.cs
示例12: HeadPageViewModel
public HeadPageViewModel(
IEventAggregator events,
MouthViewModel mouth,
RightEyeViewModel rightEye,
LeftEyeViewModel leftEye,
NoseViewModel nose,
INavigationService navService,
MotionActivatedSimpleAnimation animation)
{
_events = events;
_actionFacialCodingEventToken = _events.GetEvent<Events.ActionFacialCodingEvent>().Subscribe((args) =>
{
this.OnActionFacialCodingCommand(args);
}, ThreadOption.UIThread);
_sensorChangedEventToken = _events.GetEvent<Events.RangeSensorEvent>().Subscribe((args) =>
{
this.OnRangeSensorChanged(args);
}, ThreadOption.UIThread);
_navService = navService;
GoBackCommand = new DelegateCommand(_navService.GoBack);
NavigateControlCommand = new DelegateCommand(() => navService.Navigate("Control", null));
HideCommand = new DelegateCommand(this.Hide);
_mouth = mouth;
_rightEye = rightEye;
_leftEye = leftEye;
_nose = nose;
_animationService = animation;
Image = new BitmapImage(new Uri(@"ms-appx:///Assets/pumpkinbackground.png", UriKind.RelativeOrAbsolute));
}
开发者ID:mlinnen,项目名称:Hackster.io.Pumpkin,代码行数:34,代码来源:HeadPageViewModel.cs
示例13: ItemListFilter
public ItemListFilter()
{
InitializeComponent();
Init();
ItemListFilterViewModel = new ItemListFilterViewModel(iEventAggregator, controls.Length);
this.DataContext = ItemListFilterViewModel;
propertyChangedMap = new Dictionary<string, Action>()
{
{ "SelectedControlIndex", () => {
SetControlSelected(controls[selectedControlIndex], false);
selectedControlIndex = ItemListFilterViewModel.SelectedControlIndex;
SetControlSelected(controls[selectedControlIndex], true);
}},
};
ItemListFilterViewModel.PropertyChanged += PropertyChangedHandler;
eventMap = new Dictionary<string, Action>()
{
{"FILTER_SELECT_CONTROL", SelectControl }
};
filterActionToken = this.iEventAggregator.GetEvent<PubSubEvent<ViewEventArgs>>().Subscribe(
(viewEventArgs) =>
{
EventHandler(viewEventArgs);
}
);
}
开发者ID:yousefm87,项目名称:FilePlayer,代码行数:32,代码来源:ItemListFilter.xaml.cs
示例14: App
App()
{
iEventAggregator = Event.EventInstance.EventAggregator;
viewActionToken = this.iEventAggregator.GetEvent<PubSubEvent<ViewEventArgs>>().Subscribe(
(viewEventArgs) => { EventHandler(viewEventArgs); }
);
}
开发者ID:yousefm87,项目名称:FilePlayer,代码行数:7,代码来源:App.xaml.cs
示例15: ModuleBWorkspace
public ModuleBWorkspace(IStringCopyService stringCopyService)/*IEventAggregator eventAggregator*/
{
// código exclusivo para la recepción de un string a traves de un agregador de eventos.
var eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();
// eventAggregator.GetEvent<MyCopyDataAddedEvent>().Subscribe(OnCopyDataReceived, ThreadOption.UIThread);
var evento = eventAggregator.GetEvent<MyCopyDataAddedEvent>();
if (subscriptionToken != null)
{
evento.Unsubscribe(subscriptionToken);
}
subscriptionToken = evento.Subscribe(OnCopyDataReceived, ThreadOption.UIThread, true);
InitializeComponent();
//código exclusivo para recepción de un string a traves de un servicio compartido
stringCopyService.CopyStringEvent += TheStringCopyService_CopyStringEvent;
//código exclusivo para la recepción de datos atraves del regioncontext.
// get the region context from the current view
// (which is plugged into the region)
Microsoft.Practices.Prism.ObservableObject<object> regionContexto =
RegionContext.GetObservableContext(this);
// set an event handler to run when PropertyChanged event is fired
regionContexto.PropertyChanged += regionContext_PropertyChanged;
}
开发者ID:llenroc,项目名称:Inflexion2,代码行数:29,代码来源:ModuleBWorkspace.xaml.cs
示例16: SoundQuestionWindowViewModel
public SoundQuestionWindowViewModel(IEventAggregator eventAggregator, StandingsService standingsService, InputService inputService)
: base(eventAggregator, standingsService, inputService)
{
_soundToken = ShowEvent.Subscribe(PauseStart);
_closeEvent = eventAggregator.GetEvent<CloseEvent>();
_stopToken = _closeEvent.Subscribe((o) => Dispose());
}
开发者ID:ludoleif,项目名称:JeBuzzdy,代码行数:7,代码来源:SoundQuestionWindowViewModel.cs
示例17: SearchGameDataViewModel
public SearchGameDataViewModel(string _gameQuery)
{
iEventAggregator = Event.EventInstance.EventAggregator;
SelectedCol = 0;
SelectedRow = 0;
TitleBarText = "Searching for " + _gameQuery + "...";
GameData = GameRetriever.GetGameDataSetLists(_gameQuery);
GameQuery = _gameQuery;
eventMap = new Dictionary<string, Action>()
{
{ "SEARCHGAMEDATA_MOVE_LEFT", () => { SelectedCol = SelectedCol - 1; } },
{ "SEARCHGAMEDATA_MOVE_RIGHT", () => { SelectedCol = SelectedCol + 1; } },
{ "SEARCHGAMEDATA_MOVE_UP", () => { SelectedRow = SelectedRow - 1; } },
{ "SEARCHGAMEDATA_MOVE_DOWN", () => { SelectedRow = SelectedRow + 1; } },
{ "SEARCHGAMEDATA_SELECT", SelectItem }
};
searchGameDataActionToken = iEventAggregator.GetEvent<PubSubEvent<SearchGameDataEventArgs>>().Subscribe(
(viewEventArgs) =>
{
EventHandler(this, viewEventArgs);
}
);
}
开发者ID:yousefm87,项目名称:FilePlayer,代码行数:27,代码来源:SearchGameDataViewModel.cs
示例18: OnNavigatedTo
public void OnNavigatedTo(NavigationContext navigationContext)
{
_trackMenuBarToken = _eventAggregator.GetEvent<TrackCommandBarEvent>().Subscribe(OnTrackMenuBarEvent, true);
_tracksMenuBarToken = _eventAggregator.GetEvent<TracksCommandBarEvent>().Subscribe(OnTracksMenuBarEvent, true);
Album = navigationContext.Tag as IAlbum;
}
开发者ID:kms,项目名称:torshify-client,代码行数:7,代码来源:AlbumViewModel.cs
示例19: OnImportsSatisfied
public void OnImportsSatisfied()
{
if (_obj == null)
{
_obj = _eventAggregator.GetEvent<CompositePresentationEvent<ObservableCollection<IDataItem>>>().Subscribe(dataItemsReceived => DataService.DataItems = dataItemsReceived, true);
}
}
开发者ID:hack2root,项目名称:SilverlightComposer,代码行数:7,代码来源:MainPageViewModel.cs
示例20: ItemListFilterViewModel
public ItemListFilterViewModel(IEventAggregator iEventAggregator, int _numControls)
{
this.iEventAggregator = iEventAggregator;
buttonActions = new string[] { "FILTER_RESET", "FILTER_TYPE", "FILTER_FILES" };
Filter = "";
FilterType = "Contains";
numControls = _numControls;
MoveRightCommand = new DelegateCommand(MoveRight, CanMoveRight);
MoveLeftCommand = new DelegateCommand(MoveLeft, CanMoveLeft);
RemoveLastCharFromFilterCommand = new DelegateCommand(RemoveLastCharFromFilter, CanRemoveLastCharFromFilter);
ResetFiltersCommand = new DelegateCommand(ResetFilters, CanResetFilters);
EventMap = new Dictionary<string, Action>()
{
{"FILTER_MOVE_LEFT", () =>
{
if (MoveLeftCommand.CanExecute())
{
MoveLeftCommand.Execute();
}
}
},
{"FILTER_MOVE_RIGHT", () =>
{
if (MoveRightCommand.CanExecute())
{
MoveRightCommand.Execute();
}
}
},
{"CHAR_BACK", () =>
{
if (RemoveLastCharFromFilterCommand.CanExecute())
{
RemoveLastCharFromFilterCommand.Execute();
}
}
}
};
EventMapParam = new Dictionary<string, Action<string>>()
{
{"CHAR_SELECT", AppendToFilter},
{"VOS_OPTION", (_filterType) =>
{
FilterType = _filterType;
}
}
};
filterViewToken = this.iEventAggregator.GetEvent<PubSubEvent<ViewEventArgs>>().Subscribe(
(viewEventArgs) =>
{
EventHandler(viewEventArgs);
}
);
}
开发者ID:yousefm87,项目名称:FilePlayer,代码行数:59,代码来源:ItemListFilterViewModel.cs
注:本文中的SubscriptionToken类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论