本文整理汇总了C#中ISubject类的典型用法代码示例。如果您正苦于以下问题:C# ISubject类的具体用法?C# ISubject怎么用?C# ISubject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISubject类属于命名空间,在下文中一共展示了ISubject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendEntryBaseTest
protected AppendEntryBaseTest()
{
// Arrange
var mocker = new AutoMocker();
ServerIdentifier = new ServerIdentifier();
mocker.Use(ServerIdentifier);
mocker.Setup<ISubject<AppendEntryMessage>>(p => p.Subscribe(It.IsAny<IObserver<AppendEntryMessage>>()))
.Callback<IObserver<AppendEntryMessage>>((o) =>
{
AppendEntryCallback = o;
});
AppendEntryCallback = mocker.Get<ISubject<AppendEntryMessage>>();
AppendEntryResult = new Subject<AppendEntryResultMessage>();
Election = new Election();
LogReplication = new LogReplication();
AppendEntry = new Rafting.AppendEntry(AppendEntryResult,
mocker.Get<ISubject<AppendEntryMessage>>(),
mocker.Get<IHartbeatTimer>(),
LogReplication,
Election,
mocker.Get<ILoggerFactory>(),
new RaftOptions(),
mocker.Get<ServerIdentifier>(),
null);
}
示例2: FantasyTeamPresenter
/// <summary>
/// Initializes a new instance of the <see cref="FantasyTeamPresenter"/> class.
/// </summary>
/// <param name="view">The view.</param>
/// <param name="owningPerson">The owning person.</param>
/// <param name="subject">The subject.</param>
public FantasyTeamPresenter(IFantasyTeamView view, string owningPerson, ISubject subject)
{
_View = view;
_View.Unsubscribing += Unsubscribing;
FantasyTeam = owningPerson;
_Subject = subject;
}
示例3: RemoveSubject
public void RemoveSubject(ISubject s)
{
if (IsSubjectListened(s))
{
subjectList.Remove(s);
}
}
示例4: AddSubject
public void AddSubject(ISubject s)
{
if (!IsSubjectListened(s))
{
subjectList.Add(s);
}
}
示例5: FriendObserver
public FriendObserver(ListBox displayBox, ISubject friendSubject)
{
status = "";
this.friendSubject = friendSubject;
this.displayBox = displayBox;
friendSubject.addObserver(this);
}
示例6: RulerBase
public RulerBase(IModifierBus bus, IRules rules, ISubject<IInfo> infoChannel)
{
_bus = bus;
_rules = rules;
_infoChannel = infoChannel;
}
示例7: PriceGrabber
public PriceGrabber(ISubject subject, double usaPrice, double israelPrice)
{
_subject = subject;
_subject.Register(this);
USAPrice = usaPrice;
IsraelPrice = israelPrice;
}
示例8: Field
public Field(ISubject parent, string sourceName, string displayName, Type type)
{
Subject = parent;
SourceName = sourceName;
DisplayName = displayName;
DataType = type;
}
示例9: SetUp
public void SetUp() {
callback_ = new NopAuthCallbackHandler();
shared_ = new Dictionary<string, string>();
options_ = new Dictionary<string, string>();
module_ = Mock.Create<ILoginModule>();
Mock
.Arrange(
() => module_.Login(Arg.IsAny<IAuthCallbackHandler>(), subject_))
.Returns(AuthenticationInfos.Sucessful());
Mock
.Arrange(() => module_.Commit(Arg.IsAny<IAuthenticationInfo>()))
.Returns(true);
Mock
.Arrange(() => module_.ControlFlag)
.Returns(LoginModuleControlFlag.Required);
subject_ = Mock.Create<ISubject>();
Mock
.Arrange(() => subject_.Permissions)
.Returns(new HashSet<IPermission>());
Mock
.Arrange(() => subject_.Principals)
.Returns(new HashSet<IPrincipal>());
}
示例10: Add
public void Add(ISubject subject)
{
if(this.DoesNotContain(subject) || subject == null)
{
this.subjects.Add(subject);
}
}
示例11: Initializing_a_dynamic_object_implementation
public void Initializing_a_dynamic_object_implementation()
{
_subject = (ISubject)typeof(ISubject).InitializeProxy(new
{
Value = _stringValue,
});
}
示例12: GetDenyActions
private DenyResult[] GetDenyActions(ISubject subject, IAction[] actions, ISecurityObjectId objectId, ISecurityObjectProvider securityObjProvider)
{
var denyActions = new List<DenyResult>();
if (actions == null) actions = new IAction[0];
if (subject == null)
{
denyActions = actions.Select(a => new DenyResult(a, null, null)).ToList();
}
else if (subject is ISystemAccount && subject.ID == Constants.CoreSystem.ID)
{
// allow all
}
else
{
ISubject denySubject = null;
IAction denyAction = null;
foreach (var action in actions)
{
var allow = azManager.CheckPermission(subject, action, objectId, securityObjProvider, out denySubject, out denyAction);
if (!allow)
{
denyActions.Add(new DenyResult(action, denySubject, denyAction));
break;
}
}
}
return denyActions.ToArray();
}
示例13: FormatErrorMessage
internal static string FormatErrorMessage(ISubject subject, IAction[] actions, ISubject[] denySubjects,
IAction[] denyActions)
{
if (subject == null) throw new ArgumentNullException("subject");
if (actions == null || actions.Length == 0) throw new ArgumentNullException("actions");
if (denySubjects == null || denySubjects.Length == 0) throw new ArgumentNullException("denySubjects");
if (denyActions == null || denyActions.Length == 0) throw new ArgumentNullException("denyActions");
if (actions.Length != denySubjects.Length || actions.Length != denyActions.Length)
throw new ArgumentException();
string reasons = "";
for (int i = 0; i < actions.Length; i++)
{
string reason = "";
if (denySubjects[i] != null && denyActions[i] != null)
reason = String.Format("{0}:{1} access denied {2}.",
actions[i].Name,
(denySubjects[i] is IRole ? "role:" : "") + denySubjects[i].Name,
denyActions[i].Name
);
else
reason = String.Format("{0}: access denied.", actions[i].Name);
if (i != actions.Length - 1)
reason += ", ";
reasons += reason;
}
string sactions = "";
Array.ForEach(actions, action => { sactions += action.ToString() + ", "; });
string message = String.Format(
"\"{0}\" access denied \"{1}\". Cause: {2}.",
(subject is IRole ? "role:" : "") + subject.Name,
sactions,
reasons
);
return message;
}
示例14: MacroPlayer
public MacroPlayer()
{
_iterationStartedSubject = new ScheduledSubject<int>(RxApp.DeferredScheduler);
_stepCompletedSubject = new ScheduledSubject<int>(RxApp.DeferredScheduler);
_stepStartedSubject = new ScheduledSubject<StepStartedInfo>(RxApp.DeferredScheduler);
_stepProgressUpdatedSubject = new ScheduledSubject<int>(RxApp.DeferredScheduler);
}
示例15: ViewModel
public ViewModel()
{
Users = new ObservableCollection<UserFullInfo>();
Countries = new ObservableCollection<Country>(countryService.GetCountries());
UserProvider userP = new UserProvider();
//AsyncUser = new AsyncVirtualizingCollection<UserFullInfo>(userP, 100, 30);
AsyncUser = new AsyncVirtualizingCollection<UserFullInfo>(userP, 100, 30000);
var usersObservable = userService.GetUsers().ToObservable();
usersObservable.SubscribeOn(ThreadPoolScheduler.Instance).ObserveOn(DispatcherScheduler.Current).Subscribe(userInfo => Users.Add(userInfo));
userSubject = new Subject<UserFullInfo>();
userSubject.Subscribe(x =>
{
if (x == null)
return;
x.CountrySubject.OnNext(x.Country);
x.SubdivisionSubject.OnNext(x.Subdivision);
});
//var countrySubj = new Subject<UserFullInfo>();
currentUser = new UserFullInfo();
NewCommand = new RelayCommand(arg => NewMethod());
SaveCommand = new RelayCommand(arg => SaveMethod());
CloseComman = new RelayCommand(arg => CloseMethod());
}