Пример #1
0
        public IBulletinBoardService GetBulletinBoardService()
        {
            IBulletinBoardService bulletinBoardService = flyWeightPool["BulletinBoardService"] as IBulletinBoardService;

            if (bulletinBoardService == null)
            {
                bulletinBoardService = new BulletinBoardServiceImpl();
                flyWeightPool.Add("BulletinBoardService", bulletinBoardService);
            }
            return(bulletinBoardService);
        }
Пример #2
0
        public SafeBulletinBoardService(IBulletinBoardService bulletinBoardService, Action <string> errorCallback)
        {
            _bulletinBoardService = bulletinBoardService;
            _errorCallback        = s =>
            {
                if (!_throwed)
                {
                    errorCallback(s);
                }

                _throwed = true;
            };
        }
        public BulletinBoardWindow(string username, string email, IBulletinBoardService bulletinBoardService)
        {
            InitializeComponent();
            Username = username;
            Email    = email;
            var updateThread = new Thread(UpdateThread);

            BulletinBoardService = new SafeBulletinBoardService(bulletinBoardService, s =>
            {
                Dispatcher.Invoke(() =>
                {
                    updateThread.Abort();
                    var connectionWindow = new ConnectionWindow {
                        ErrorTextBlock = { Text = s }
                    };
                    connectionWindow.Show();
                    Close();
                });
            });
            DataContext = this;

            updateThread.Start();
        }
Пример #4
0
 public BulletinBoardController(IBulletinBoardService bulletinBoardService, ILogger logger)
 {
     _bulletinBoardService = bulletinBoardService;
     _ILogger = logger;
 }
 public OPCODE_DATA_BBS_THREAD_GET_CONTENT(IBulletinBoardService bulletinBoardService)
 {
     this.bulletinBoardService = bulletinBoardService ?? throw new ArgumentNullException(nameof(bulletinBoardService));
 }