示例#1
0
        public void InitializeContent(IApplication n)
        {
            //var n = new HyperDesignExample.HTML.Pages.Application();

            //n.Container.AttachToDocument();


            n.Read.onclick +=
                delegate
            {
                n.FirstName.value = "John";
                n.LastName.value  = "Doe";
            };

            // more code...
            // lets make some changes to the template code...
            // nice huh? :D

            var Items = new IHTMLDiv();

            Items.style.height          = "300px";
            Items.style.overflow        = IStyle.OverflowEnum.auto;
            Items.style.backgroundColor = Color.System.ButtonFace;
            Items.style.borderWidth     = "2px";
            Items.style.borderStyle     = "solid";
            Items.style.borderColor     = Color.System.ButtonShadow;

            Items.AttachToDocument();

            var List = new List <Employee>();

            n.Add.onclick +=
                delegate
            {
                var i = new HyperDesignExample.HTML.Pages.Summary();
                var j = new Employee
                {
                    Number    = List.Count + 1,
                    FirstName = n.FirstName.value,
                    LastName  = n.LastName.value
                };
                List.Add(j);

                Action Update =
                    delegate
                {
                    i.Number.value    = "#" + j.Number;
                    i.FirstName.value = j.FirstName;
                    i.LastName.value  = j.LastName;
                };

                Update();

                i.Delete.onclick +=
                    delegate
                {
                    i.Container.Orphanize();
                };

                i.Container.AttachTo(Items);

                i.Edit.onclick +=
                    delegate
                {
                    i.Edit.disabled = true;

                    var details = new HyperDesignExample.HTML.Pages.Details();

                    details.FirstName.value = i.FirstName.value;
                    details.LastName.value  = i.LastName.value;
                    details.Bio.value       = j.Bio;
                    details.Location.value  = j.Location;

                    details.Container.AttachTo(i.Details);

                    details.Discard.onclick +=
                        delegate
                    {
                        details.Container.Orphanize();
                        i.Edit.disabled = false;
                    };

                    details.Save.onclick +=
                        delegate
                    {
                        details.Container.Orphanize();
                        i.Edit.disabled = false;

                        j.Bio       = details.Bio.value;
                        j.FirstName = details.FirstName.value;
                        j.LastName  = details.LastName.value;
                        j.Location  = details.Location.value;

                        Update();
                    };
                };
            };
        }
        public void InitializeContent(IApplication n)
		{
            //var n = new HyperDesignExample.HTML.Pages.Application();
			
            //n.Container.AttachToDocument();

            
            n.Read.onclick +=
                delegate
                {
                    n.FirstName.value = "John";
                    n.LastName.value = "Doe";
                };

			// more code...
			// lets make some changes to the template code...
			// nice huh? :D

			var Items = new IHTMLDiv();

			Items.style.height = "300px";
			Items.style.overflow = IStyle.OverflowEnum.auto;
			Items.style.backgroundColor = Color.System.ButtonFace;
			Items.style.borderWidth = "2px";
			Items.style.borderStyle = "solid";
			Items.style.borderColor = Color.System.ButtonShadow;

			Items.AttachToDocument();

			var List = new List<Employee>();

			n.Add.onclick +=
				delegate
				{
					var i = new HyperDesignExample.HTML.Pages.Summary();
					var j = new Employee
					{
						Number = List.Count + 1,
						FirstName = n.FirstName.value,
						LastName = n.LastName.value
					};
					List.Add(j);

					Action Update =
						delegate
						{
							i.Number.value = "#" + j.Number;
							i.FirstName.value = j.FirstName;
							i.LastName.value = j.LastName;
						};

					Update();

					i.Delete.onclick +=
						delegate
						{
							i.Container.Orphanize();
						};

					i.Container.AttachTo(Items);

					i.Edit.onclick +=
						delegate
						{
							i.Edit.disabled = true;

							var details = new HyperDesignExample.HTML.Pages.Details();

							details.FirstName.value = i.FirstName.value;
							details.LastName.value = i.LastName.value;
							details.Bio.value = j.Bio;
							details.Location.value = j.Location;

							details.Container.AttachTo(i.Details);

							details.Discard.onclick +=
								delegate
								{
                                    details.Container.Orphanize();
									i.Edit.disabled = false;
								};

							details.Save.onclick +=
								delegate
								{
                                    details.Container.Orphanize();
									i.Edit.disabled = false;

									j.Bio = details.Bio.value;
									j.FirstName = details.FirstName.value;
									j.LastName = details.LastName.value;
									j.Location = details.Location.value;

									Update();
								};
						};
				};
		}