Ejemplo n.º 1
0
        public MainWindowViewModel()
        {
            this.FirstName = new TextVM {
                IsEnabled = true, Text = "John"
            };
            this.FirstName.TextChanged += OnTextChanged;

            this.LastName = new TextVM {
                IsEnabled = true, Text = "Smith"
            };
            this.LastName.TextChanged += OnTextChanged;

            this.PeopleList = new CollectionVM <Person>(new List <Person>
            {
                new Person {
                    FirstName = "Dimitar", LastName = "Radenkov"
                },
                new Person {
                    FirstName = "Alexander", LastName = "Radenkov"
                },
            });
            this.PeopleList.Selected = this.PeopleList.Items.FirstOrDefault();

            this.ButtonAdd = new ButtonVM {
                Command = new DelegateCommand(OnButtonAddClicked)
            };
            this.ButtonDelete = new ButtonVM {
                Command = new DelegateCommand(OnButtonDeleteClicked)
            };
        }
Ejemplo n.º 2
0
 protected override void HandlePropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     base.HandlePropertyChanged(sender, e);
     if (sender == ViewModel && (
             ButtonVM.NeedsSync(e, nameof(ViewModel.TypedModel.PenaltyCard.Shape))))
     {
         ReDraw();
     }
 }
Ejemplo n.º 3
0
 protected virtual void HandlePropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (sender == ButtonVM && (
             ButtonVM.NeedsSync(e, nameof(ButtonVM.BackgroundColor)) ||
             ButtonVM.NeedsSync(e, nameof(ButtonVM.TextColor)) ||
             ButtonVM.NeedsSync(e, nameof(ButtonVM.Name)) ||
             ButtonVM.NeedsSync(e, nameof(ButtonVM.HotKey))))
     {
         ReDraw();
     }
 }
Ejemplo n.º 4
0
    void Awake()
    {
        data = SaveDataFiler.Load <SaveData>(0);
        if (data == null)
        {
            Debug.Log("Non Save Data");
            data = new SaveData();
        }

        viewRoot.Bind(textVM     = new TextVM());
        viewRoot.Bind(toggleVM   = new ToggleVM());
        viewRoot.Bind(buttonVM   = new ButtonVM());
        viewRoot.Bind(dropdownVM = new DropdownVM());
        SetDefault();
    }
Ejemplo n.º 5
0
	void Awake()
	{
		data = SaveDataFiler.Load<SaveData>(0);
		if (data == null)
		{
			Debug.Log("Non Save Data");
			data = new SaveData();
		}

		viewRoot.Bind(textVM = new TextVM());
		viewRoot.Bind(toggleVM = new ToggleVM());
		viewRoot.Bind(buttonVM = new ButtonVM());
		viewRoot.Bind(dropdownVM = new DropdownVM());
		SetDefault();
	}
Ejemplo n.º 6
0
        public JsonResult Insert(ButtonVM viewModel)
        {
            var clientResult = new JsonData <object>();
            var sessionModel = Session[Keys.SessionKey] as MemberSessionVM;

            viewModel.LogMemberID = sessionModel.MemberID;

            Mapper.Initialize(u => u.CreateMap <ButtonVM, Button>());
            var model = Mapper.Map <Button>(viewModel);

            model.ButtonID = Guid.NewGuid();

            services.Command((db) =>
            {
                db.Insert <Button>(model);
                clientResult.SetClientData("y", "操作成功", new { id = model.ButtonID });
            });
            return(Json(clientResult));
        }
Ejemplo n.º 7
0
        //Update the property view after selection changed
        void UpdatePropertyView()
        {
            List <WidgetViewModBase> Widgets = _model.GetSelectionWidget();

            Property.ImagePropertyViewModel       ImageVM       = null;
            Property.LinkPropertyViewModel        LinkVM        = null;
            Property.TextPropertyViewModel        LableVM       = null;
            Property.ShapePropertyViewModel       ShapeVM       = null;
            Property.GroupPropertyViewModel       GroupVM       = null;
            Property.ListBoxPropertyViewModel     ListboxVM     = null;
            Property.DropListPropertyViewModel    DroplistVM    = null;
            Property.CheckBoxPropertyViewModel    CheckboxVM    = null;
            Property.RadioButtonPropertyViewModel RadioButtonVM = null;
            Property.TextAreaPropertyViewModel    TextareaVM    = null;
            Property.TextFieldPropertyViewModel   TextFieldVM   = null;
            Property.ButtonPropertyViewModel      ButtonVM      = null;
            Property.HamburgerPropertyViewModel   HamburgerVM   = null;
            Property.FlickPannelPropertyViewModel FlickpannelVM = null;
            Property.ToastPropertyViewModel       ToastVM       = null;
            Property.SVGPropertyViewModel         SVGVM         = null;
            Property.MasterPropertyViewModel      MasterVM      = null;
            Items.Clear();

            foreach (WidgetViewModBase data in Widgets)
            {
                if (data.IsGroup)
                {
                    if (GroupVM == null)
                    {
                        GroupVM = new Property.GroupPropertyViewModel();
                        Items.Add(GroupVM);
                    }

                    GroupVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.Image)
                {
                    if (ImageVM == null)
                    {
                        ImageVM = new Property.ImagePropertyViewModel();
                        Items.Add(ImageVM);
                    }

                    ImageVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.HotSpot)
                {
                    if (LinkVM == null)
                    {
                        LinkVM = new Property.LinkPropertyViewModel();
                        Items.Add(LinkVM);
                    }

                    LinkVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.Shape && data.shapetype == ShapeType.Paragraph)
                {
                    if (LableVM == null)
                    {
                        LableVM = new Property.TextPropertyViewModel();
                        Items.Add(LableVM);
                    }

                    LableVM.AddItems(data);
                }

                else if (data.WidgetType == WidgetType.ListBox)
                {
                    if (ListboxVM == null)
                    {
                        ListboxVM = new Property.ListBoxPropertyViewModel();
                        Items.Add(ListboxVM);
                    }

                    ListboxVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.DropList)
                {
                    if (DroplistVM == null)
                    {
                        DroplistVM = new Property.DropListPropertyViewModel();
                        Items.Add(DroplistVM);
                    }

                    DroplistVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.Checkbox)
                {
                    if (CheckboxVM == null)
                    {
                        CheckboxVM = new Property.CheckBoxPropertyViewModel();
                        Items.Add(CheckboxVM);
                    }

                    CheckboxVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.RadioButton)
                {
                    if (RadioButtonVM == null)
                    {
                        RadioButtonVM = new Property.RadioButtonPropertyViewModel();
                        Items.Add(RadioButtonVM);
                    }

                    RadioButtonVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.TextArea)
                {
                    if (TextareaVM == null)
                    {
                        TextareaVM = new Property.TextAreaPropertyViewModel();
                        Items.Add(TextareaVM);
                    }
                    TextareaVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.TextField)
                {
                    if (TextFieldVM == null)
                    {
                        TextFieldVM = new Property.TextFieldPropertyViewModel();
                        Items.Add(TextFieldVM);
                    }
                    TextFieldVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.Button)
                {
                    if (ButtonVM == null)
                    {
                        ButtonVM = new Property.ButtonPropertyViewModel();
                        Items.Add(ButtonVM);
                    }
                    ButtonVM.AddItems(data);
                }

                else if (data.WidgetType == WidgetType.Shape &&
                         (data.shapetype == ShapeType.Rectangle ||
                          data.shapetype == ShapeType.RoundedRectangle ||
                          data.shapetype == ShapeType.Ellipse ||
                          data.shapetype == ShapeType.Diamond ||
                          data.shapetype == ShapeType.Triangle))
                {
                    if (ShapeVM == null)
                    {
                        ShapeVM = new Property.ShapePropertyViewModel();
                        Items.Add(ShapeVM);
                    }

                    ShapeVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.HamburgerMenu)
                {
                    if (HamburgerVM == null)
                    {
                        HamburgerVM = new Property.HamburgerPropertyViewModel();
                        Items.Add(HamburgerVM);
                    }

                    HamburgerVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.DynamicPanel)
                {
                    if (FlickpannelVM == null)
                    {
                        FlickpannelVM = new Property.FlickPannelPropertyViewModel();
                        Items.Add(FlickpannelVM);
                    }

                    FlickpannelVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.Toast)
                {
                    if (ToastVM == null)
                    {
                        ToastVM = new Property.ToastPropertyViewModel();
                        items.Add(ToastVM);
                    }
                    ToastVM.AddItems(data);
                }
                else if (data.WidgetType == WidgetType.SVG)
                {
                    if (SVGVM == null)
                    {
                        SVGVM = new Property.SVGPropertyViewModel();
                        items.Add(SVGVM);
                    }
                    SVGVM.AddItems(data);
                }
                else if (data is MasterWidgetViewModel)
                {
                    if (MasterVM == null)
                    {
                        MasterVM = new Property.MasterPropertyViewModel();
                        items.Add(MasterVM);
                    }
                    MasterVM.AddItems(data);
                }
            }
            FirePropertyChanged("Items");
        }