Example #1
0
        protected virtual void LoadFormItems()
        {
            ShowingItemsInfo showingItemsInfo = FormModel.ShowingItemsInfo;
            ItemModelType    modelType        = WidgetModel.CurrentItemType;

            Action <ShowingItemsInfo> loadAction;

            if (!_itemLoaders.TryGetValue(modelType, out loadAction))
            {
                DevLogger.Error(string.Format("Need add loader for {0}", modelType));
                return;
            }

            loadAction.SafeRaise(showingItemsInfo);
        }
        public void TestComplextMayBeType()
        {
            var model = ItemModelType.Create();

            Assert.NotNull(model);
            Assert.Null(model.Item);

            model.ApplySnapshot(new Dictionary <string, object>
            {
                {
                    "Item",
                    new Dictionary <string, object>
                    {
                        {
                            "Value",
                            "Something"
                        }
                    }
                }
            });

            Assert.NotNull(model.Item);

            Assert.Equal("Something", model.Item.Value);

            model.ApplySnapshot(new Dictionary <string, object>
            {
                {
                    "Item",
                    null
                }
            });

            Assert.Null(model.Item);

            var snapshot = model.GetSnapshot <IDictionary <string, object> >();

            Assert.NotNull(snapshot);
            Assert.True(snapshot.ContainsKey("Item"));
            Assert.Null(snapshot["Item"]);
        }
Example #3
0
 public void ClearUserData()
 {
     UserName         = string.Empty;
     Balance          = new Price();
     _currentItemType = ItemModelType.None;
 }