Exemplo n.º 1
0
        public string GenerateJSCode()
        {
            StringBuilder builder = new StringBuilder();

            if (this.Name != this.DefaultName)
            {
                builder.Append(string.Format("\n\twindow.{0} = Scheduler.getSchedulerInstance();", (object)this.Name));
            }
            builder.Append("\n");
            builder.Append(string.Format(DHXScheduler.GetServerList().InitConfigSection, (object)this.Name));
            if (DHXScheduler.GetServerList().Count > 0)
            {
                builder.Append(DHXScheduler.GetServerList().RenderCollections(this.Name));
            }
            foreach (SchedulerControlsBase control in this._Controls)
            {
                control.Render(builder, this.Name);
            }
            foreach (SchedulerSettingsBase setting in this._Settings)
            {
                setting.Render(builder, this.Name);
            }
            if (this.HasBeforeInitCode)
            {
                builder.Append("\n");
                builder.Append(string.Join("\n", this.BeforeInit.ToArray()));
                builder.Append("\n");
            }
            if (this.EventHandlers.Events.Count > 0)
            {
                this.EventHandlers.Render(builder, this.Name);
            }
            if (this.TimeSpans.Items.Count > 0)
            {
                this.TimeSpans.Render(builder, this.Name);
            }
            if (this.Highlighter.Enabled)
            {
                this.Highlighter.Render(builder, this.Name);
            }
            List <string> stringList = new List <string>();

            stringList.Add(string.Format("'{0}_here'", (object)this.Name));
            DateTime initialDate = this.InitialDate;
            string   str         = initialDate == new DateTime() ? "null" : DateFormatHelper.DateToJS(initialDate);
            string   initialView = this.InitialView;

            if (initialDate != new DateTime() || initialView != (string)null)
            {
                if (initialView != (string)null)
                {
                    stringList.Add(str);
                    stringList.Add("'" + initialView + "'");
                }
                else if (initialDate != new DateTime())
                {
                    stringList.Add(str);
                }
            }
            builder.Append(string.Format("\n\t{0}.init({1});", (object)this.Name, (object)string.Join(",", stringList.ToArray())));
            if (this.Extensions != null && this.Extensions.Items != null && this.Extensions.Items.Count != 0)
            {
                foreach (KeyValuePair <SchedulerExtensions.Extension, DHXExtension> keyValuePair in this.Extensions.Items)
                {
                    keyValuePair.Value.Render(builder, this);
                }
            }
            if (this.HasAfterInitCode)
            {
                builder.Append("\n");
                builder.Append(string.Join("\n", this.AfterInit.ToArray()));
                builder.Append("\n");
            }
            if (this.HasDefaultValues)
            {
                this.EventHandlers.Events.Add(new DHXSchedulerEvent(DHXSchedulerEvent.Types.onEventCreated, this._ProcessDefaultValues()));
            }
            this.Data.DateFormat = this.Config.xml_date;
            this.Data.Render(builder, this.Name);
            foreach (SchedulerControlsBase control in this._Controls)
            {
                builder.Append(control.AfterInit());
            }
            return(builder.ToString());
        }
Exemplo n.º 2
0
 public static IDHXServerList GetServerList()
 {
     return(DHXScheduler.GetServerList(DHXScheduler.ServerListName));
 }