// shadow with by http://www.cycloloco.com/shadowmaker/shadowmaker.htm

        public ExampleGalleryPlain()
        {

            var Menu = new IHTMLDiv().AttachToDocument();
            var Title = typeof(ExampleGalleryPlain).Name;

            new IHTMLElement(IHTMLElement.HTMLElementEnum.h1,
                Title).AttachTo(Menu);

            new IHTMLDiv("This is a collection of projects developed with jsc. They were coded in c# and translated to javascript with jsc. Click on the pictures to load the applications or on the names to open them in a new window. You might need to press refresh to come back to this index. Enoy! :)").AttachTo(Menu);

            base.Initialize(Menu,
                (image, href, type, TypeClicked) =>
                {
                    var div = new IHTMLDiv();

                    var a = new IHTMLAnchor(href, "");

                    a.target = "_blank";
                    a.style.textDecoration = "none";
                    a.style.whiteSpace = IStyle.WhiteSpaceEnum.nowrap;

                    image.style.border = "0px solid black";
                    image.style.SetSize(120, 90);
                    image.AttachTo(a);
                    image.style.margin = "0.2em";
                    image.style.marginRight = "1em";
                    image.style.verticalAlign = "middle";

                    a.appendChild(type.Name);

                    a.onclick +=
                        ev =>
                        {
                            ev.PreventDefault();

                            TypeClicked(type);
                        };

                    a.AttachTo(div);

                    return div;
                }
           );
        }
        // shadow with by http://www.cycloloco.com/shadowmaker/shadowmaker.htm

        public ExampleGalleryWithShadows()
        {

            var style = "assets/ExampleGallery/ExampleGallery.css".ImportStyleSheet();

            Native.Document.body.style.backgroundImage = "url(assets/ExampleGallery/bg.png)";
	
            var Menu = new IHTMLDiv().AttachToDocument();
            var Title = typeof(ExampleGalleryWithShadows).Name;

            new IHTMLElement(IHTMLElement.HTMLElementEnum.h1,
                Title).AttachTo(Menu);

            Native.Document.title = Title;


            new IHTMLImage("assets/ExampleGallery/PreviewSelection.png").InvokeOnComplete(
                selection =>
            new IHTMLImage("assets/ExampleGallery/PreviewShadow.png").InvokeOnComplete(
                img =>
                {
                    base.Initialize(Menu,
                        (image, href, type, TypeClicked) =>
                        {
                            var div = new IHTMLDiv();

                            div.style.SetSize(120, 90);

                            var shadow = (IHTMLImage)img.cloneNode(false);

                            shadow.AttachTo(div);
                            shadow.style.SetLocation(0, 0);
                            shadow.style.zIndex = 0;


                            image.AttachTo(div);
                            image.style.SetSize(120, 90);




                            div.style.position = IStyle.PositionEnum.relative;
                            div.style.marginTop = "3em";
                            div.style.marginLeft = "1em";
                            div.style.marginRight = "1em";
                            div.style.marginBottom = "1em";
                            div.style.Float = IStyle.FloatEnum.left;

                            #region name
                            var name = new IHTMLAnchor(href, type.Name);

                            name.style.position = IStyle.PositionEnum.absolute;
                            name.className = "PreviewName";
                            name.style.color = Color.White;
                            name.style.textDecoration = "none";

                            name.target = "_blank";
                            name.style.top = "-1.5em";
                            name.AttachTo(div);
                            #endregion

                            var a = new IHTMLAnchor(href, "");

                            a.target = "_blank";
                            a.style.display = IStyle.DisplayEnum.block;

                            var cselection = (IHTMLImage)selection.cloneNode(false);
                            cselection.style.borderWidth = "0px";
                            cselection.style.SetLocation(-9, -9);
                            cselection.style.zIndex = 1;
                            cselection.className = "PreviewShadow";
                            cselection.AttachTo(a);


                            image.style.border = "0px solid black";
                            image.style.zIndex = 2;
                            image.AttachTo(a);

                            a.className = "Preview";
                            a.AttachTo(div);
                            a.style.zIndex = 2;
                            a.style.SetLocation(0, 0, 120, 90);


                            a.onclick +=
                                ev =>
                                {
                                    ev.PreventDefault();

                                    Native.Document.body.style.backgroundImage = "";

                                    TypeClicked(type);
                                };

                            return div;
                        }
                   );
                }
            )
            );
        }
Exemplo n.º 3
0
        //public readonly ApplicationWebService service = new ApplicationWebService();

        /// <summary>
        /// This is a javascript application.
        /// </summary>
        /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
        public Application(IDefault page)
        {
            var service = this;

            #region pre
            Func<string, IHTMLDiv, IHTMLElement> pre =
                (value, output) =>
                {
                    return new IHTMLPre { innerText = value }.AttachTo(output);
                };
            #endregion

            #region pre
            Func<string, IHTMLDiv, IHTMLElement> browse = null;

            browse =
                (path, output) =>
                {

                    var list = new IHTMLButton { innerText = path }.AttachTo(output);


                    var group = new IHTMLDiv().AttachTo(output);




                    list.onclick +=
                        delegate
                        {
                            group.style.margin = "1em";
                            group.style.paddingLeft = "1em";
                            group.style.border = "1px solid gray";

                            list.disabled = true;

                            service.File_list(path,
                                ydirectory: value =>
                                {
                                    browse(path + "/" + value, group);
                                },

                                yfile: value =>
                                {
                                    var link = new IHTMLAnchor { href = "/io" + path + "/" + value, innerText = value };

                                    link.style.display = IStyle.DisplayEnum.block;
                                    link.AttachTo(group);
                                }
                            );
                        };

                    return group;
                };
            #endregion



            #region f
            Action<string, string, Action<string, Action<string>>, Func<string, IHTMLDiv, IHTMLElement>> f =
                (text, arg1, c, y) =>
                {
                    var btn = new IHTMLButton(text).AttachToDocument();
                    var output = new IHTMLDiv().AttachToDocument();

                    btn.onclick +=
                        e =>
                        {
                            btn.style.color = JSColor.Red;

                            output.Clear();

                            c(arg1,
                                value =>
                                {
                                    btn.style.color = JSColor.Blue;


                                    y(value, output);
                                }
                            );
                        }
                    ;
                };
            #endregion

            #region ff
            Action<string, Func<Task<string>>, Func<string, IHTMLDiv, IHTMLElement>> ff =
                (text, c, y) =>
                {
                    var btn = new IHTMLButton(text).AttachToDocument();
                    var output = new IHTMLDiv().AttachToDocument();

                    btn.WhenClicked(
                        async e =>
                        {
                            btn.style.color = JSColor.Red;

                            output.Clear();

                            var value = await c();

                            btn.style.color = JSColor.Blue;


                            y(value, output);
                        }
                     );
                };
            #endregion


#if CORE_PARTIAL
            ff("Environment_getDataDirectory", () => service.Environment_getDataDirectory(), browse);
            ff("Environment_getDownloadCacheDirectory", () => service.Environment_getDownloadCacheDirectory(), browse);
            ff("Environment_getExternalStorageDirectory", () => service.Environment_getExternalStorageDirectory(), browse);
            ff("Environment_getExternalStorageState", () => service.Environment_getExternalStorageState(), pre);
            ff("Environment_getRootDirectory", () => service.Environment_getRootDirectory(), browse);

            //service.Environment_DIRECTORY("",
            //    (
            //        string DIRECTORY_MUSIC,
            //        string DIRECTORY_PODCASTS,
            //        string DIRECTORY_RINGTONES,
            //        string DIRECTORY_ALARMS,
            //        string DIRECTORY_NOTIFICATIONS,
            //        string DIRECTORY_PICTURES,
            //        string DIRECTORY_MOVIES,
            //        string DIRECTORY_DOWNLOADS,
            //        string DIRECTORY_DCIM
            //    ) =>

            f("Environment_getExternalStoragePublicDirectory DIRECTORY_MUSIC", DIRECTORY_MUSIC, service.Environment_getExternalStoragePublicDirectory, browse);
            f("Environment_getExternalStoragePublicDirectory DIRECTORY_PODCASTS", DIRECTORY_PODCASTS, service.Environment_getExternalStoragePublicDirectory, browse);
            f("Environment_getExternalStoragePublicDirectory DIRECTORY_RINGTONES", DIRECTORY_RINGTONES, service.Environment_getExternalStoragePublicDirectory, browse);
            f("Environment_getExternalStoragePublicDirectory DIRECTORY_ALARMS", DIRECTORY_ALARMS, service.Environment_getExternalStoragePublicDirectory, browse);
            f("Environment_getExternalStoragePublicDirectory DIRECTORY_NOTIFICATIONS", DIRECTORY_NOTIFICATIONS, service.Environment_getExternalStoragePublicDirectory, browse);
            f("Environment_getExternalStoragePublicDirectory DIRECTORY_PICTURES", DIRECTORY_PICTURES, service.Environment_getExternalStoragePublicDirectory, browse);
            f("Environment_getExternalStoragePublicDirectory DIRECTORY_MOVIES", DIRECTORY_MOVIES, service.Environment_getExternalStoragePublicDirectory, browse);
            f("Environment_getExternalStoragePublicDirectory DIRECTORY_DOWNLOADS", DIRECTORY_DOWNLOADS, service.Environment_getExternalStoragePublicDirectory, browse);

#endif

            f("Environment_getExternalStoragePublicDirectory DIRECTORY_DCIM", DIRECTORY_DCIM, service.Environment_getExternalStoragePublicDirectory, browse);



            new IHTMLElement(IHTMLElement.HTMLElementEnum.hr).AttachToDocument();



            // new IHTMLButton("Environment_getDownloadCacheDirectory").AttachToDocument().onclick +=
            //    e => service.Environment_getDownloadCacheDirectory("",
            //            value => new IHTMLPre { innerText = value }.AttachToDocument()
            //);
        }
        // shadow with by http://www.cycloloco.com/shadowmaker/shadowmaker.htm

        public ExampleGalleryWithShadowsPlain()
        {

            var Menu = new IHTMLDiv().AttachToDocument();
            var Title = typeof(ExampleGalleryWithShadows).Name;

            new IHTMLElement(IHTMLElement.HTMLElementEnum.h1,
                Title).AttachTo(Menu);

            new IHTMLDiv("This is a collection of projects developed with jsc. They were coded in c# and translated to javascript with jsc. Click on the pictures to load the applications or on the names to open them in a new window. You might need to press refresh to come back to this index. Enoy! :)").AttachTo(Menu);


            new IHTMLImage("assets/ExampleGallery/PreviewShadow.png").InvokeOnComplete(
                img =>
                {
                    base.Initialize(Menu,
                        (image, href, type, TypeClicked) =>
                        {
                            var div = new IHTMLDiv();

                            div.style.SetSize(120, 90);
                            

                            var shadow = (IHTMLImage)img.cloneNode(false);

                            shadow.AttachTo(div);
                            shadow.style.SetLocation(0, 0);
                            shadow.style.zIndex = 0;


                            image.AttachTo(div);
                            image.style.SetSize(120, 90);




                            div.style.position = IStyle.PositionEnum.relative;
                            div.style.marginTop = "1em";
                            div.style.marginLeft = "1em";
                            div.style.marginRight = "12em";
                            div.style.marginBottom = "1em";
                            div.style.Float = IStyle.FloatEnum.left;
                            //div.style.clear =  "both";


                            #region name
                            var name = new IHTMLAnchor(href, type.Name);

                            name.style.position = IStyle.PositionEnum.absolute;
                            name.className = "PreviewName";
                            name.style.color = Color.Black;
                            name.style.textDecoration = "none";

                            name.target = "_blank";
                            name.style.left = "130px";
                            name.AttachTo(div);
                            #endregion

                            var a = new IHTMLAnchor(href, "");

                            a.target = "_blank";
                            a.style.display = IStyle.DisplayEnum.block;

               
                            image.style.border = "0px solid black";
                            image.style.zIndex = 2;
                            image.AttachTo(a);

                            a.className = "Preview";
                            a.AttachTo(div);
                            a.style.zIndex = 2;
                            a.style.SetLocation(0, 0, 120, 90);


                            a.onclick +=
                                ev =>
                                {
                                    ev.PreventDefault();

                                    Native.Document.body.style.backgroundImage = "";

                                    TypeClicked(type);
                                };

                            return div;
                        }
                   );
                });
        }
        public ExampleGalleryWithReflections()
        {

            Native.Document.body.style.Aggregate(
               style =>
               {
                   style.backgroundColor = Color.Gray;
                   style.backgroundImage = "url(assets/ExampleGallery/bg.png)";

                   style.color = Color.White;
               }
           );

            try
            {
                IStyleSheet.Default.AddRule("a.Preview img.PreviewShadow").style.display = IStyle.DisplayEnum.none;
                IStyleSheet.Default.AddRule("a.Preview:hover img.PreviewShadow").style.display = IStyle.DisplayEnum.block;
            }
            catch
            {
                // no css support
            }

            var Menu = new IHTMLDiv().AttachToDocument();
            var Title = typeof(ExampleGalleryWithReflections).Name;

            new IHTMLElement(IHTMLElement.HTMLElementEnum.h1,
                Title).AttachTo(Menu);

            Native.Document.title = Title;

            new IHTMLImage("assets/ExampleGallery/PreviewSelection.png").InvokeOnComplete(
            selection =>
                {
                    base.Initialize(Menu,
                        (image, href, type, TypeClicked) =>
                        {
                            var div =
                                new ReflectionSetup
                                {
                                    Image = image,
                                    Position = new Point(0, 0),
                                    Size = new Point(120, 90),
                                    ReflectionZoom = 0.5,
                                    Drag = false,
                                    Bottom = 2
                                }.ConvertToImageReflection();

                            div.style.position = IStyle.PositionEnum.relative;
                            div.style.marginTop = "3em";
                            div.style.marginLeft = "1em";
                            div.style.marginRight = "1em";
                            div.style.marginBottom = "3em";
                            div.style.Float = IStyle.FloatEnum.left;

                            #region name
                            var name = new IHTMLAnchor(href, type.Name);

                            name.style.position = IStyle.PositionEnum.absolute;
                            name.style.textDecoration = "none";
                            name.style.color = Color.White;
                            name.className = "PreviewName";

                            name.target = "_blank";
                            name.style.top = "-1.5em";
                            name.AttachTo(div);
                            #endregion

                            var a = new IHTMLAnchor(href, "");

                            var cselection = (IHTMLImage)selection.cloneNode(false);
                            cselection.style.borderWidth = "0px";
                            cselection.style.SetLocation(-9, -9);
                            cselection.style.zIndex = 1;
                            cselection.className = "PreviewShadow";
                            cselection.AttachTo(a);

                            a.className = "Preview";
                            a.target = "_blank";
                            image.style.border = "0px solid black";
                            image.AttachTo(a);
                            image.style.zIndex = 2;
                            a.AttachTo(div);
                            a.style.zIndex = 2;
                            a.style.SetLocation(0, 0);

                            a.onclick +=
                                ev =>
                                {
                                    ev.PreventDefault();

                                    TypeClicked(type);
                                };

                            return div;
                        });
                    }
             );
        }
		private void RenderWriteHistory(Dictionary<SolutionFileTextFragment, Color> Lookup, SolutionFile f, IHTMLElement Container)
		{
			Func<SolutionFileTextFragment, Color> LookupOrDefault =
				ff =>
				{
					if (this.Colors.ContainsKey(ff))
						return this.Colors[ff];

					return this.Colors[SolutionFileTextFragment.None];
				};

			var Content = new IHTMLDiv().AttachTo(Container);


			Content.style.position = IStyle.PositionEnum.relative;

			var ViewBackground = new IHTMLDiv().AttachTo(Content);

			ViewBackground.style.position = IStyle.PositionEnum.absolute;
			ViewBackground.style.left = "0px";
			ViewBackground.style.top = "0px";
			ViewBackground.style.width = "4em";
			ViewBackground.style.borderRight = "1px dotted gray";
			ViewBackground.style.paddingRight = "0.5em";

			var ViewTrap = new IHTMLDiv().AttachTo(Content);

			ViewTrap.style.position = IStyle.PositionEnum.absolute;
			ViewTrap.style.left = "0px";
			ViewTrap.style.top = "0px";
			ViewTrap.style.right = "0px";
			ViewTrap.style.bottom = "0px";
			//ViewTrap.style.backgroundColor = Color.White;

			var ViewTrapContainer = new IHTMLDiv().AttachTo(ViewTrap);

			ViewTrapContainer.style.cursor = IStyle.CursorEnum.text;
			ViewTrapContainer.style.position = IStyle.PositionEnum.relative;
			ViewTrapContainer.style.paddingLeft = "5em";

			var View = new IHTMLDiv().AttachTo(ViewTrapContainer);



			var ContentHeightDummy = new IHTMLDiv().AttachTo(Content);

			var RegionStack = new Stack<List<Action<bool>>>();
			var RegionGlobal = new List<Action<bool>>();
			RegionStack.Push(RegionGlobal);

			var Lines = new List<IHTMLDiv>();

			var CurrentLineDirty = false;
			var CurrentLine = default(IHTMLDiv);
			var CurrentLineContent = default(IHTMLDiv);

			Action NextLine = delegate
			{
				CurrentLineDirty = false;

				var c = new IHTMLDiv();
				var cc = new IHTMLDiv();
				var cb = new IHTMLDiv();

				CurrentLine = c.AttachTo(View);
				CurrentLineContent = cc.AttachTo(c);

				var CurrentRegion = RegionStack.Peek();

				RegionStack.WithEach(
					k =>
					{
						k.Add(
							IsActive =>
							{
								// should we react when in a global region
								if (k == RegionGlobal)
									return;

								if (IsActive)
								{
									cc.style.backgroundColor = Color.FromGray(0xf9);
									cb.style.backgroundColor = Color.FromGray(0xf9);
								}
								else
								{
									cc.style.backgroundColor = Color.None;
									cb.style.backgroundColor = Color.None;
								}
							}
						);
					}
				);

				CurrentLine.onmouseover +=
					delegate
					{
						CurrentRegion.Invoke(true);
						cc.style.backgroundColor = Color.FromGray(0xf0);
						cb.style.backgroundColor = Color.FromGray(0xf0);
					};

				CurrentLine.onmouseout +=
					delegate
					{
						CurrentRegion.Invoke(false);
						cc.style.backgroundColor = Color.None;
						cb.style.backgroundColor = Color.None;
					};


				Lines.Add(CurrentLine);
				//CurrentLineContent.style.marginLeft = "5em";

				var BCurrentLine = cb.AttachTo(ViewBackground);

				BCurrentLine.style.textAlign = IStyle.TextAlignEnum.right;

				var span = new IHTMLCode { innerText = "" + Lines.Count };
				span.style.color = Lookup[SolutionFileTextFragment.Type];
				span.AttachTo(BCurrentLine);

				//Content.style.height = Lines.Count + "em";

				new IHTMLDiv { new IHTMLCode { innerText = Environment.NewLine } }.AttachTo(ContentHeightDummy);
			};



			foreach (var item in f.WriteHistory.ToArray())
			{
				if (item is SolutionFileWriteArguments.BeginRegion)
				{
					RegionStack.Push(new List<Action<bool>>());
				}

				if (item is SolutionFileWriteArguments.EndRegion)
				{
					RegionStack.Pop();
				}

				if (CurrentLine == null)
					NextLine();



				var innerText = item.Text;
				innerText = innerText.TakeUntilLastIfAny(Environment.NewLine);

				if (!string.IsNullOrEmpty(innerText))
				{
					var span = new IHTMLCode { innerText = innerText };

					if (item.Fragment == SolutionFileTextFragment.Indent)
					{
						span.style.width = "2em";
						span.style.display = IStyle.DisplayEnum.inline_block;

						if (CurrentLineDirty)
							span.style.borderLeft = "1px dotted #afafaf";
					}


					span.style.color = LookupOrDefault(item.Fragment);

					CurrentLineDirty = true;
					span.AttachTo(CurrentLineContent);

					if (item.Tag != null)
					{
						span.style.cursor = ScriptCoreLib.JavaScript.DOM.IStyle.CursorEnum.pointer;
						span.onmouseover +=
							delegate
							{
								span.style.textDecoration = "underline";
							};

						span.onmouseout +=
							delegate
							{
								span.style.textDecoration = "";
							};



						var Type = item.Tag as SolutionProjectLanguageType;
						if (Type != null)
						{
							span.title = Type.FullName;
						}

						var Method = item.Tag as SolutionProjectLanguageMethod;
						if (Method != null)
						{
							span.title = Method.Name;
						}


						var Uri = item.Tag as Uri;
						if (Uri != null)
						{
							var a = new IHTMLAnchor();
							a.style.color = LookupOrDefault(item.Fragment);

							a.href = Uri.ToString();
							a.target = "_blank";
							a.Add(span);
							a.AttachTo(CurrentLineContent);

							a.onclick +=
								e =>
								{
                                    // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201511/20151103
									e.preventDefault();

									if (LinkCommentClick != null)
										LinkCommentClick(Uri);
								};
						}
					}
				}

				if (item.Text.EndsWith(Environment.NewLine))
				{
					if (!CurrentLineDirty)
					{
						var span = new IHTMLCode { innerText = " " };
						span.AttachTo(CurrentLineContent);
					}

					CurrentLine = null;
				}
			}
		}
Exemplo n.º 7
0
        private static void SpawnDefaultView()
        {
            // http://simiandesign.com/2006/04/18/superscripts-subscripts-css-and-the-line-height/

            #region ApplyStyle
            Action<td, DateTime> ApplyStyle = (col, x) =>
            {

                // users will want to notice weekends

                if (x.IsFirstDayOfMonth())
                    col.style.borderLeft = "1px solid gray";

                if (x.DayOfWeek == DayOfWeek.Saturday)
                {
                    col.style.borderLeft = "1px solid gray";
                    col.style.backgroundColor = "#efefef";
                }

                if (x.DayOfWeek == DayOfWeek.Sunday)
                {
                    col.style.borderRight = "1px solid gray";
                    col.style.backgroundColor = "#efefef";
                }

                if (x.IsLastDayOfMonth())
                    col.style.borderRight = "1px solid gray";

                col.style.width = "2em";
                col.style.height = "2em";
                col.style.textAlign = IStyle.TextAlignEnum.center;
            };
            #endregion

            //var sch = new ScheduleController(ApplyStyle);


            var DateSelectionChanged = default(Action);

            var date = DateTime.Now;

            #region spinners

            var YearSpinner = new SpinnerSpan<int>.SpinnerSpanSettings
            {
                Value = date.Year,
                GetText = i => "year".Localize() + ": " + i,
                GetNext = date.Year.MakeNextFunc(3),
                GetPrevious = date.Year.MakePreviousFunc(3),
                Changed =
                                    delegate
                                    {
                                        if (DateSelectionChanged != null) DateSelectionChanged();
                                    }

            }.Create();

            var MonthSpinner = new SpinnerSpan<int>.SpinnerSpanSettings
            {
                Value = date.Month,
                GetText = i => "month".Localize() + ": " + i,
                GetNext = i =>
                {
                    if (i == 12)
                    {
                        YearSpinner.Silent = true;
                        YearSpinner.GoNext();
                        YearSpinner.Silent = false;

                        return 1;
                    }

                    return i++;
                },
                GetPrevious = i =>
                {
                    if (i == 1)
                    {
                        YearSpinner.Silent = true;
                        YearSpinner.GoPrevious();
                        YearSpinner.Silent = false;
                        return 12;
                    }

                    return i--;
                },
                Changed =
                    delegate
                    {
                        if (DateSelectionChanged != null) DateSelectionChanged();
                    }
            }.Create();

            YearSpinner.Control.AttachTo(Native.Document.body);
            MonthSpinner.Control.AttachTo(Native.Document.body);

            var _DefaultWorkers = new[] { "Worker1", "Worker2" };

            if (Storage.Workers == null)
            {
                // safari wont save cookies when document isnt from a webserver
                Storage.Workers = _DefaultWorkers;


                //if (Storage.Workers == null)
                //    throw new Exception( "Cookies are not working!!");
                //if (Storage.Workers.Length != _new.Length)
                //    throw new Exception( "Cookies are not working!");
            }


            var Make = new IHTMLAnchor("make new work schedule".Localize());



            Action MakeNewSchedule =
                delegate
                {
                    int stage = 1;

                    try
                    {
                        stage = 2;
                        var schnew = new ScheduleController(ApplyStyle, new DateTime(YearSpinner.Value, MonthSpinner.Value, 1));

                        stage = 3;
                        schnew.Control.AttachTo(Native.Document.body);
                        stage = 4;
                        schnew.WorkersChanged +=
                            delegate
                            {
                                Storage.Workers = schnew.Workers.Where(w => !w.Name.IsNullOrEmpty()).Select(w => w.Name).ToArray();
                            };
                        stage = 5;

                        // compiler bug: passing params attribute when they are not first should use local variable!

                        var _Workers = Storage.Workers;

                        if (_Workers == null)
                            _Workers = _DefaultWorkers;

                        _Workers = _Workers.Concat(new[] { "" }).ToArray();

                        stage = 6;

                        schnew.LazyLoad(
                            () => { }, _Workers
                        );
                        stage = 7;
                    }
                    catch (Exception exc)
                    {
                        throw new Exception("MakeNewSchedule failed: {" + exc.Message + "}; stage: " + stage);
                    }
                };

            Make.AttachTo(Native.Document.body).onclick +=
                ev =>
                {
                    ev.PreventDefault();

                    MakeNewSchedule();
                };

            #endregion

            DateSelectionChanged =
                delegate
                {
                    // compiler bug: opcode strobj not supported - cannot store struct to field directly.

                    //var newdate = new DateTime(YearSpinner.Value, MonthSpinner.Value, 1);

                    //date = newdate;
                    //days = newdays;

                };

            //sch.Control.AttachTo(Native.Document.body);



            MakeNewSchedule();
        }