Esempio n. 1
0
        /// <summary>
        /// Event called when the mapsets search response has been returned.
        /// </summary>
        private void OnMapsetsResponse(MapsetsResponse response)
        {
            bool hadCursor = Options.HasCursor;

            if (response.IsSuccess)
            {
                mapsetList.ModifyValue(mapsets =>
                {
                    // If there was previously no cursor, this must be a fresh search using different options since the last search.
                    if (!Options.HasCursor)
                    {
                        mapsets.Clear();
                    }
                    mapsets.AddRange(response.Mapsets);
                    Options.Cursor = response.Cursor;
                });
            }
            else
            {
                mapsetList.ModifyValue(mapsets => mapsets.Clear());
            }
            OnMapsetListChange?.Invoke(mapsetList.Value, hadCursor);
            StopMapsetRequest();
        }
        public void TestModifyValue()
        {
            Bindable <IntList> bindableList = new Bindable <IntList>(new IntList()
            {
                0, 1
            });

            bool calledNewValue = false;

            bindableList.OnNewValue += delegate { calledNewValue = true; };

            Assert.AreEqual(2, bindableList.Value.Count);
            Assert.IsFalse(calledNewValue);

            bindableList.ModifyValue((list) =>
            {
                list.Add(2);
                list.Add(3);
            });
            Assert.AreEqual(4, bindableList.Value.Count);
            Assert.IsTrue(calledNewValue);
        }
Esempio n. 3
0
 /// <summary>
 /// Adds the specified option to the options list.
 /// </summary>
 public void AddOption(DialogOption option)
 {
     options.ModifyValue(list => list.Add(option));
 }