Esempio n. 1
0
 public void LoadData(ScrollerData data)
 {
     bSaved    = true;
     this.name = data.name;
     this.font = data.font;
     UpdateMessage(data.message, data.leftMessage, data.rightMessage);
 }
Esempio n. 2
0
        public Dictionary <string, ScrollerData> GetProjectList()
        {
            #if DEMO
            return(new Dictionary <string, ScrollerData>());
            #else
            Dictionary <string, ScrollerData> anouncements = new Dictionary <string, ScrollerData>();
            foreach (XmlNode xn in xd.DocumentElement.ChildNodes)
            {
                if (xn.Name == "Project")
                {
                    ScrollerData d = new ScrollerData();
                    d.name         = xn.Attributes["Name"].InnerText;
                    d.leftMessage  = xn["LeftMessage"].InnerText;
                    d.message      = xn["Message"].InnerText;
                    d.rightMessage = xn["RightMessage"].InnerText;

                    // Get font
                    if (xn["FontName"] == null)
                    {
                        d.font = new PresenterFont();
                        d.font.SizeInPoints = 12;
                    }
                    else
                    {
                        d.font = PresenterFont.FromXMLNode(xn);
                    }

                    anouncements.Add(d.name, d);
                }
            }
            return(anouncements);
            #endif
        }
Esempio n. 3
0
        private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index < 0 || e.Index >= lbProjects.Items.Count)
            {
                return;
            }

            ScrollerData d             = (ScrollerData)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 + ": " + d.message, 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. 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
#if DEMO
            new DemoVersionOnly("Save project").ShowDialog();
#else
            ScrollerStore ss = new ScrollerStore();
            if (!proj.bSaved)
            {
                ProjSaveDlg f = new ProjSaveDlg();
                f.ValidateName += delegate(object s, CancelEventArgs ec)
                {
                    ec.Cancel = ss.NameExists((string)s);
                };
                if (f.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                proj.name = f.FileName;
            }

            ScrollerData sd = new ScrollerData();
            sd.name         = proj.name;
            sd.leftMessage  = proj.LeftMessage;
            sd.message      = proj.Message;
            sd.rightMessage = proj.RightMessage;
            sd.font         = proj.font;
            ss.SaveProject(sd);
            proj.dirty = false;

            proj.bSaved = true;
#endif
        }
Esempio n. 5
0
        private void LoadProjList()
        {
            currentProject = null;
            lbProjects.Items.Clear();
            ScrollerStore ss = new ScrollerStore();

            lProjects = ss.GetProjectList();
            foreach (ScrollerData s in lProjects.Values)
            {
                lbProjects.Items.Add(s);
            }
        }
Esempio n. 6
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. 7
0
 private void lbProjects_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lbProjects.SelectedIndex == -1)
     {
         currentProject = null;
         UpdateUI();
         return;
     }
     else
     {
         currentProject = (ScrollerData)lbProjects.SelectedItem;
         UpdateUI();
     }
 }
Esempio n. 8
0
        public void SaveProject(ScrollerData sd)
        {
            // Search and remove the previous version
            XmlNode nodeToRemove = null;

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

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

            xaName.InnerText = sd.name;
            an.Attributes.Append(xaName);
            AddStringNode(an, "LeftMessage", sd.leftMessage);
            AddStringNode(an, "Message", sd.message);
            AddStringNode(an, "RightMessage", sd.rightMessage);

            if (sd.font == null)
            {
                sd.font = new PresenterFont();
                sd.font.SizeInPoints = 12;
            }
            PresenterFont.AppendToXMLNode(an, sd.font);

            // Finish and save
            xd.DocumentElement.AppendChild(an);
            Save();
        }