コード例 #1
0
 private void ToolView_Load(object sender, EventArgs e)
 {
     Library.MasterObject mo = Library.Project.CurrentProject.MasterObjects.Find(a => { return(a.Name == this.HTMLObject.MasterObjectName); });
     if (mo != null)
     {
         this.textBox2.Text = mo.Title;
     }
     try
     {
         Library.OutputHTML html = this.HTMLObject.GenerateDesign();
         FileStream         fs   = new FileStream(ConfigDirectories.GetBuildFolder(Library.Project.CurrentProject.Title) + this.HTMLObject.Name + ".html", FileMode.Create);
         StreamWriter       sw   = new StreamWriter(fs);
         sw.WriteLine(html.HTML.ToString());
         sw.Close();
         sw.Dispose();
         fs.Close();
         fs.Dispose();
         this.webBrowser1.Navigate(ConfigDirectories.GetBuildFolder(Library.Project.CurrentProject.Title) + this.HTMLObject.Name + ".html");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #2
0
        private void click(object sender, EventArgs e)
        {
            AddObject add = new AddObject();

            Library.Project proj = Library.Project.CurrentProject;
            DialogResult    dr   = add.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                HtmlElement obj = this.webBrowser1.Document.GetElementById("callback");
                if (obj != null)
                {
                    Library.HTMLObject item = new Library.HTMLObject();
                    item.Title     = add.txtName.Text;
                    item.Container = obj.GetAttribute("container");
                    if (!String.IsNullOrEmpty(add.SelectedMasterObject))
                    {
                        item.MasterObjectName = add.SelectedMasterObject;
                        Library.MasterObject mo = proj.MasterObjects.Find(a => a.Name == add.SelectedMasterObject);
                        if (mo != null)
                        {
                            // recherche de l'objet container
                            Library.IContainer objectContainer;
                            if (proj.FindContainer(item.Container, out objectContainer, (List <Library.IContainer> containers,
                                                                                         List <Library.IContent> objects, string searchName, out Library.IContainer found) =>
                            {
                                return(this.MasterPage.SearchContainer(containers, objects, searchName, out found));
                            }))
                            {
                                item.Width            = objectContainer.Width;
                                item.Height           = objectContainer.Height;
                                item.ConstraintHeight = objectContainer.ConstraintHeight;
                                item.ConstraintWidth  = objectContainer.ConstraintWidth;
                            }
                        }
                    }
                    else if (add.Tool != null)
                    {
                        item           = new Library.HTMLObject(add.Tool);
                        item.Title     = add.txtName.Text;
                        item.Container = obj.GetAttribute("container");
                        // recherche de l'objet container
                        Library.IContainer objectContainer;
                        if (proj.FindContainer(item.Container, out objectContainer, (List <Library.IContainer> containers,
                                                                                     List <Library.IContent> objects, string searchName, out Library.IContainer found) =>
                        {
                            return(this.MasterPage.SearchContainer(containers, objects, searchName, out found));
                        }))
                        {
                            item.Width            = objectContainer.Width;
                            item.Height           = objectContainer.Height;
                            item.ConstraintHeight = objectContainer.ConstraintHeight;
                            item.ConstraintWidth  = objectContainer.ConstraintWidth;
                        }
                    }

                    item.BelongsTo = this.mPage.Name;
                    proj.Add(item, "");
                    this.mPage.Objects.Add(item);
                    this.btnValidate1.SetDirty();
                    this.ReloadBrowser();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Create a destination object and store its into the project
        /// </summary>
        /// <param name="proj">project</param>
        /// <param name="width">width value</param>
        /// <param name="height">height value</param>
        /// <param name="h">horizontal count</param>
        /// <param name="v">vertical count</param>
        public void CreateDestination(Library.Project proj, uint width, uint height, uint h, uint v)
        {
            if (this.Destination == null)
            {
                if (this.Type == RefObject.MasterPage)
                {
                    MasterPage mp = new MasterPage();
                    mp.Name             = this.Name;
                    mp.ConstraintHeight = EnumConstraint.FIXED;
                    mp.Height           = height;
                    mp.ConstraintWidth  = EnumConstraint.FIXED;
                    mp.Width            = width;
                    mp.CountColumns     = h;
                    mp.CountLines       = v;
                    proj.MasterPages.Add(mp);
                    this.Destination = mp;
                    string[] splitted = mp.ElementTitle.Split('/');
                    string   path     = String.Join("/", splitted.Take(splitted.Count() - 1));
                    mp.Name = splitted.Last();
                    proj.Add(mp, path);
                }
                else if (this.Type == RefObject.Page)
                {
                    MasterPage mp = new Library.MasterPage();
                    Page       p  = new Library.Page();
                    if (Library.Project.AddPage(proj, p, this.Name))
                    {
                        mp.Name             = "MasterPage_" + System.IO.Path.GetFileNameWithoutExtension(p.Name);
                        mp.ConstraintHeight = EnumConstraint.FIXED;
                        mp.Height           = height;
                        mp.ConstraintWidth  = EnumConstraint.FIXED;
                        mp.Width            = width;
                        mp.CountColumns     = h;
                        mp.CountLines       = v;
                        proj.MasterPages.Add(mp);
                        p.MasterPageName   = mp.Name;
                        p.ConstraintHeight = EnumConstraint.FIXED;
                        p.Height           = height;
                        p.ConstraintWidth  = EnumConstraint.FIXED;
                        p.Width            = width;
                        this.SecondObject  = mp;
                        this.Destination   = p;
                    }
                    else
                    {
                        throw new ArgumentException(Localization.Strings.GetString("ExceptionPageNotCreated"));
                    }
                }
                else if (this.Type == RefObject.MasterObject)
                {
                    MasterObject mo = new MasterObject();
                    mo.Title            = this.Name;
                    mo.ConstraintHeight = EnumConstraint.FIXED;
                    mo.Height           = height;
                    mo.ConstraintWidth  = EnumConstraint.FIXED;
                    mo.Width            = width;
                    mo.CountColumns     = h;
                    mo.CountLines       = v;
                    this.Destination    = mo;
                    string[] splitted = mo.ElementTitle.Split('/');
                    string   path     = String.Join("/", splitted.Take(splitted.Count() - 1));
                    mo.Name = splitted.Last();
                    proj.Add(mo, path);
                }
                else if (this.Type == RefObject.Tool)
                {
                    MasterObject mo = new Library.MasterObject();
                    HTMLTool     t  = new HTMLTool();
                    if (Library.Project.AddTool(proj, t, this.Name))
                    {
                        mo.Name             = "MasterObject_" + t.Title;
                        mo.ConstraintHeight = EnumConstraint.FIXED;
                        mo.Height           = height;
                        mo.ConstraintWidth  = EnumConstraint.FIXED;
                        mo.Width            = width;
                        mo.CountColumns     = h;
                        mo.CountLines       = v;

                        t.ConstraintHeight = EnumConstraint.FIXED;
                        t.ConstraintWidth  = EnumConstraint.FIXED;
                        t.Width            = width;
                        t.Height           = height;
                        this.SecondObject  = mo;
                        this.Destination   = t;
                    }
                    else
                    {
                        throw new ArgumentException(Localization.Strings.GetString("ExceptionToolNotCreated"));
                    }
                }
            }
            else
            {
                if (this.Type == RefObject.MasterPage)
                {
                    MasterPage mp = this.Destination;
                    for (int index = mp.Objects.Count - 1; index >= 0; --index)
                    {
                        if (proj.Instances.Contains(mp.Objects[index]))
                        {
                            proj.Remove(mp.Objects[index]);
                        }
                    }
                    mp.ConstraintHeight = EnumConstraint.FIXED;
                    mp.Height           = height;
                    mp.ConstraintWidth  = EnumConstraint.FIXED;
                    mp.Width            = width;
                    mp.CountColumns     = h;
                    mp.CountLines       = v;
                }
                else if (this.Type == RefObject.Page)
                {
                    Page       p  = this.Destination;
                    MasterPage mp = this.SecondObject;
                    for (int index = mp.Objects.Count - 1; index >= 0; --index)
                    {
                        if (proj.Instances.Contains(mp.Objects[index]))
                        {
                            proj.Remove(mp.Objects[index]);
                        }
                    }
                    for (int index = p.Objects.Count - 1; index >= 0; --index)
                    {
                        if (proj.Instances.Contains(p.Objects[index]))
                        {
                            proj.Remove(p.Objects[index]);
                        }
                    }

                    mp.ConstraintHeight = EnumConstraint.FIXED;
                    mp.Height           = height;
                    mp.ConstraintWidth  = EnumConstraint.FIXED;
                    mp.Width            = width;
                    mp.CountColumns     = h;
                    mp.CountLines       = v;
                    p.ConstraintHeight  = EnumConstraint.FIXED;
                    p.Height            = height;
                    p.ConstraintWidth   = EnumConstraint.FIXED;
                    p.Width             = width;
                }
                else if (this.Type == RefObject.MasterObject)
                {
                    MasterObject mo = this.Destination;
                    for (int index = mo.Objects.Count - 1; index >= 0; --index)
                    {
                        if (proj.Instances.Contains(mo.Objects[index]))
                        {
                            proj.Remove(mo.Objects[index]);
                        }
                    }
                    mo.ConstraintHeight = EnumConstraint.FIXED;
                    mo.Height           = height;
                    mo.ConstraintWidth  = EnumConstraint.FIXED;
                    mo.Width            = width;
                    mo.CountColumns     = h;
                    mo.CountLines       = v;
                }
                else if (this.Type == RefObject.Tool)
                {
                    HTMLTool     t  = this.Destination;
                    MasterObject mo = this.SecondObject;
                    for (int index = mo.Objects.Count - 1; index >= 0; --index)
                    {
                        if (proj.Instances.Contains(mo.Objects[index]))
                        {
                            proj.Remove(mo.Objects[index]);
                        }
                    }
                    mo.ConstraintHeight = EnumConstraint.FIXED;
                    mo.Height           = height;
                    mo.ConstraintWidth  = EnumConstraint.FIXED;
                    mo.Width            = width;
                    mo.CountColumns     = h;
                    mo.CountLines       = v;

                    t.ConstraintHeight = EnumConstraint.FIXED;
                    t.ConstraintWidth  = EnumConstraint.FIXED;
                    t.Width            = width;
                    t.Height           = height;
                }
            }
        }
コード例 #4
0
 private void MasterObjectCreationForm_Load(object sender, EventArgs e)
 {
     this.MasterObject = new Library.MasterObject();
     this.masterObjectBindingSource.DataSource = this.MasterObject;
 }
 private void MasterObjectCreationWindow_Load(object sender, EventArgs e)
 {
     this.panel.MasterObject = this.MasterObject;
     this.panel.init();
 }
 public MasterObjectCreationWindow(Library.MasterObject mObject)
 {
     this.mObject = mObject;
     InitializeComponent();
     this.RegisterControls(ref this.localeComponentId, mObject.Title);
 }
 public MasterObjectCreationPanel(Library.MasterObject mObj)
 {
     this.mObject = mObj;
     InitializeComponent();
 }