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


C# ISubject类代码示例

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

示例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;
 }
开发者ID:sirmosca,项目名称:DraftBuddy,代码行数:13,代码来源:FantasyTeamPresenter.cs

示例3: RemoveSubject

 public void RemoveSubject(ISubject s)
 {
     if (IsSubjectListened(s))
     {
         subjectList.Remove(s);
     }
 }
开发者ID:duoduo3369,项目名称:javaExercise,代码行数:7,代码来源:ListenerObject.cs

示例4: AddSubject

 public void AddSubject(ISubject s)
 {
     if (!IsSubjectListened(s))
     {
         subjectList.Add(s);
     }
 }
开发者ID:duoduo3369,项目名称:javaExercise,代码行数:7,代码来源:ListenerObject.cs

示例5: FriendObserver

 public FriendObserver(ListBox displayBox, ISubject friendSubject)
 {
     status = "";
     this.friendSubject = friendSubject;
     this.displayBox = displayBox;
     friendSubject.addObserver(this);
 }
开发者ID:gregfield,项目名称:IN710-fielgm2,代码行数:7,代码来源:FriendObserver.cs

示例6: RulerBase

        public RulerBase(IModifierBus bus, IRules rules, ISubject<IInfo> infoChannel)
        {
            _bus = bus;
            _rules = rules;

            _infoChannel = infoChannel;
        }
开发者ID:brajan1984,项目名称:GamePlatform,代码行数:7,代码来源:RulerBase.cs

示例7: PriceGrabber

 public PriceGrabber(ISubject subject, double usaPrice, double israelPrice)
 {
     _subject = subject;
     _subject.Register(this);
     USAPrice = usaPrice;
     IsraelPrice = israelPrice;
 }
开发者ID:Pavel-Durov,项目名称:Design-Patterns,代码行数:7,代码来源:PriceGrabber.cs

示例8: Field

 public Field(ISubject parent, string sourceName, string displayName, Type type)
 {
     Subject = parent;
     SourceName = sourceName;
     DisplayName = displayName;
     DataType = type;
 }
开发者ID:AdamCollings,项目名称:dbqf,代码行数:7,代码来源:Field.cs

示例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>());
    }
开发者ID:joethinh,项目名称:nohros-must,代码行数:25,代码来源:LoginContextTests.cs

示例10: Add

 public void Add(ISubject subject)
 {
    if(this.DoesNotContain(subject) || subject == null)
    {
        this.subjects.Add(subject);
    }    
 }
开发者ID:imarcu,项目名称:EvidentaInvatamant,代码行数:7,代码来源:SubjectRepository.cs

示例11: Initializing_a_dynamic_object_implementation

 public void Initializing_a_dynamic_object_implementation()
 {
     _subject = (ISubject)typeof(ISubject).InitializeProxy(new
         {
             Value = _stringValue,
         });
 }
开发者ID:daffers,项目名称:Magnum,代码行数:7,代码来源:Serializing_a_dynamic_object_implementation.cs

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

示例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;
 }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:35,代码来源:AuthorizingException.cs

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

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


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