Esempio n. 1
0
        private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index < 0 || e.Index >= lbProjects.Items.Count)
            {
                return;
            }

            AnouncementData d             = (AnouncementData)lbProjects.Items[e.Index];
            Font            boldFont      = new Font(this.Font, FontStyle.Bold);
            SolidBrush      brushNormal   = new SolidBrush(Color.FromArgb(223, 223, 223));
            SolidBrush      brushSelected = new SolidBrush(Color.FromArgb(255, 204, 91));
            StringFormat    sf            = new StringFormat();

            sf.Trimming = StringTrimming.EllipsisCharacter;

            // Draw the background
            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                e.Graphics.FillRectangle(brushSelected, e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.Width - 2, e.Bounds.Height - 2);
            }
            else
            {
                e.Graphics.FillRectangle(brushNormal, e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.Width - 2, e.Bounds.Height - 2);
            }

            // Draw text
            e.Graphics.DrawString(d.name, boldFont, Brushes.Black, new Rectangle(e.Bounds.X + 30, e.Bounds.Y + 6, e.Bounds.Width - 35, this.Font.Height + 2), sf);

            // Draw image
            Image i = global::EmpowerPresenter.Properties.Resources.comment_edit;

            e.Graphics.DrawImage(i, new Rectangle(e.Bounds.X + 6, e.Bounds.Y + 5, i.Width, i.Height), new Rectangle(0, 0, i.Width, i.Height), GraphicsUnit.Pixel);
        }
Esempio n. 2
0
        public void LoadData(AnouncementData ad)
        {
            bSaved = true;
            data   = ad;

            // Update image
            PhotoInfo pi = new PhotoInfo();

            pi.ImageId  = imageId;
            ctx.img     = pi.FullSizeImage;
            ctx.opacity = ad.opacity;
        }
Esempio n. 3
0
        private void LoadProjList()
        {
            currentProject = null;
            lbProjects.Items.Clear();
            AnouncementStore ss = new AnouncementStore();

            lProjects = ss.GetAnouncements();
            foreach (AnouncementData s in lProjects.Values)
            {
                lbProjects.Items.Add(s);
            }
        }
Esempio n. 4
0
        private void lbProjects_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lbProjects.SelectedIndex == -1)
            {
                currentProject = null;
            }
            else
            {
                currentProject = (AnouncementData)lbProjects.SelectedItem;
            }

            UpdateUI();
        }
Esempio n. 5
0
        public void Deactivate()
        {
            this.Hide();

            currentProject = null;
            lbProjects.Items.Clear();
            lProjects.Clear();
            llDeleteProj.Enabled = false;

            Program.Presenter.ClearNavList();
            Program.Presenter.UnregisterPopupWindow(this);
            Program.Presenter.DeactivateKeyClient(this);
            Program.Presenter.DeactiveSearcher();
        }
Esempio n. 6
0
        public void SaveAnouncement(AnouncementData ad)
        {
            // Search and remove the previous version
            XmlNode nodeToRemove = null;

            foreach (XmlNode xn in xd.DocumentElement.ChildNodes)
            {
                if (xn.Name == "Anouncement" && xn.Attributes["Name"].InnerText == ad.name)
                {
                    nodeToRemove = xn;
                }
            }
            if (nodeToRemove != null)
            {
                xd.DocumentElement.RemoveChild(nodeToRemove);
            }

            // Write the new version
            XmlNode      an     = xd.CreateElement("Anouncement");
            XmlAttribute xaName = xd.CreateAttribute("Name");

            xaName.InnerText = ad.name;
            an.Attributes.Append(xaName);
            AddStringNode(an, "ImageId", ad.imageId.ToString());
            AddStringNode(an, "Opacity", ad.opacity.ToString());

            // Write out each region
            foreach (GfxTextRegion tr in ad.lTextRegions)
            {
                XmlNode xnTr = xd.CreateElement("TextRegion");

                // Save basics
                string bounds = tr.bounds.X.ToString() + "," + tr.bounds.Y.ToString() + "," +
                                tr.bounds.Width.ToString() + "," + tr.bounds.Height.ToString();
                AddStringNode(xnTr, "Bounds", bounds);
                AddStringNode(xnTr, "Message", tr.message);

                // Save the font
                PresenterFont.AppendToXMLNode(xnTr, tr.font);

                an.AppendChild(xnTr);
            }

            // Finish and save
            xd.DocumentElement.AppendChild(an);
            Save();
        }
Esempio n. 7
0
        public Dictionary <string, AnouncementData> GetAnouncements()
        {
            #if DEMO
            return(new Dictionary <string, AnouncementData>());
            #else
            Dictionary <string, AnouncementData> anouncements = new Dictionary <string, AnouncementData>();
            foreach (XmlNode xn in xd.DocumentElement.ChildNodes)
            {
                if (xn.Name == "Anouncement")
                {
                    AnouncementData d = new AnouncementData();
                    d.name    = xn.Attributes["Name"].InnerText;
                    d.imageId = int.Parse(xn["ImageId"].InnerText);
                    if (xn["Opacity"] != null)
                    {
                        d.opacity = int.Parse(xn["Opacity"].InnerText);
                    }

                    // Load all text regions
                    foreach (XmlNode xnc in xn.ChildNodes)
                    {
                        if (xnc.Name == "TextRegion")
                        {
                            GfxTextRegion textRegion = new GfxTextRegion();
                            string[]      parts      = xnc["Bounds"].InnerText.Split(",".ToCharArray());
                            if (parts.Length != 4)
                            {
                                continue;
                            }
                            textRegion.bounds  = new RectangleF(float.Parse(parts[0]), float.Parse(parts[1]), float.Parse(parts[2]), float.Parse(parts[3]));
                            textRegion.message = xnc["Message"].InnerText;
                            textRegion.font    = PresenterFont.FromXMLNode(xnc);

                            d.lTextRegions.Add(textRegion);
                        }
                    }

                    anouncements.Add(d.name, d);
                }
            }
            return(anouncements);
            #endif
        }
Esempio n. 8
0
 //////////////////////////////////////////////////////////////////////////////
 public AnouncementProject()
 {
     data = new AnouncementData();
     UpdateBackground(Program.ConfigHelper.BibleImage);
 }