Exemplo n.º 1
0
        public ObjectDataProvider(string idProperty, IEnumerable items)
        {
            _items = new ConcurrentCollection(idProperty);

            if (items != null)
            {
                _items.ReplaceAll(items.Cast <object>());
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MockHttpHandler"/> class.
        /// </summary>
        public MockHttpHandler()
        {
            _setups         = new ConcurrentCollection <HttpCall>();
            InvokedRequests = new InvokedHttpRequestCollection(this);
            _items          = new Dictionary <Type, object>();
            _readOnlyItems  = new ReadOnlyDictionary <Type, object>(_items);

            _fallbackSetup = new HttpCall();
            Fallback       = new FallbackRequestSetupPhrase(_fallbackSetup);
            Reset();
        }
Exemplo n.º 3
0
        private static long _currentGameInstanceId = 133337; //seed this at 2UVT so it's not boring >.>

        #endregion Fields

        #region Constructors

        public GameInstance(string gameName, Image image, Difficulty difficulty)
        {
            if (String.IsNullOrWhiteSpace(gameName))
                gameName = null;

            GameInstanceId = Base36.Encode(Interlocked.Increment(ref _currentGameInstanceId));

            Connections = new ConcurrentCollection<string>();
            GameName = gameName;
            Image = image;
            SlicedImageSettings = image.GetSlicedImageSettings(difficulty);

            //Board is two places larger in each direction to give work space
            PuzzlynBoard = new PuzzlynBoard(SlicedImageSettings.NumberOfImageRows, SlicedImageSettings.NumberOfImageColumns);
        }
        public DataSource(View view, string idProperty, IDataProvider dataProvider)
        {
            _view         = view;
            _idProperty   = idProperty;
            _dataProvider = dataProvider;

            _dataItems    = new ConcurrentCollection(idProperty);
            _editStrategy = new EditDataSourceStrategy(this);
            _listStrategy = new ListDataSourceStrategy(this);

            SetListMode();

            // Подписка на события для обновления привязок данных

            OnItemsUpdated        += OnItemsUpdatedHandler;
            OnSelectedItemChanged += OnSelectedItemChangedHandler;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes new instance of <see cref="Tee"/> class with
 /// a given number of max lines to hold in a buffer and
 /// with an optional standard output and error stream actions
 /// </summary>
 /// <param name="maxLines">
 /// Max lines to keep in buffer:
 /// <list type="bullet">
 ///     <item>-1 -keep all</item>
 ///     <item>0 - keep nothing</item>
 ///     <item>N - keep last N</item>
 /// </list>
 /// </param>
 /// <param name="onStandardOutput">
 /// Callback action that will be called upon appearance
 /// of a new line standard output stream
 /// </param>
 /// <param name="onStandardError">
 /// Callback action that will be called upon appearance
 /// of a new line standard error stream
 /// </param>
 public Tee(int maxLines = -1, Action <string> onStandardOutput = null, Action <string> onStandardError = null)
 {
     standardOutput = new ConcurrentCollection(Seq, maxLines, onStandardOutput);
     standardError  = new ConcurrentCollection(Seq, maxLines, onStandardError);
 }