Esempio n. 1
0
 public void FreezeVerse()
 {
     if (this.mode == projection.Modes.Freeze)
     {
         this.NormalVerse();
     }
     else
     {
         projection projection = this;
         using (Bitmap bmp = new Bitmap(projection.Width, projection.Height))
         {
             this.DrawBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
             using (Image image1 = (Image)bmp)
             {
                 Image image2 = (Image) new Bitmap(image1.Width, image1.Height, PixelFormat.Format32bppArgb);
                 using (Graphics graphics = Graphics.FromImage(image2))
                     graphics.DrawImage(image1, 0, 0);
                 this.freezePic.Image = image2;
             }
         }
         this.freezePic.Visible = true;
         this.mode = projection.Modes.Freeze;
         this.SetPreviewImage();
     }
 }
Esempio n. 2
0
        public void SetPreviewImageThread()
        {
            projection projection = this;

            using (Bitmap bmp = new Bitmap(projection.Width, projection.Height))
            {
                this.DrawBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
                using (Image image1 = (Image)bmp)
                {
                    Image image2 = (Image) new Bitmap(image1.Width, image1.Height, PixelFormat.Format32bppArgb);
                    using (Graphics graphics = Graphics.FromImage(image2))
                        graphics.DrawImage(image1, 0, 0);
                    frmControl openForm  = (frmControl)Application.OpenForms["frmControl"];
                    Graphics   graphics1 = Graphics.FromImage(image2);
                    if (this.mode == projection.Modes.Hide)
                    {
                        graphics1.DrawRectangle(new Pen((Brush) new SolidBrush(Color.LightBlue), 30f), 0, 0, this.Width, this.Height);
                        graphics1.DrawLine(new Pen((Brush) new SolidBrush(Color.LightBlue), 30f), new Point(0, 0), new Point(this.Width, this.Height));
                    }
                    else if (this.mode == projection.Modes.Freeze)
                    {
                        graphics1.DrawRectangle(new Pen((Brush) new SolidBrush(Color.DarkRed), 30f), 0, 0, this.Width, this.Height);
                        graphics1.DrawLine(new Pen((Brush) new SolidBrush(Color.DarkRed), 30f), new Point(0, 0), new Point(this.Width, this.Height));
                    }
                    else if (this.mode == projection.Modes.White)
                    {
                        graphics1.FillRectangle(Brushes.White, new Rectangle(0, 0, this.Width, this.Height));
                    }
                    openForm.previewBox.Image = image2;
                }
            }
        }
Esempio n. 3
0
 public void Project(int i)
 {
     if (this.txtBody.Text.Trim() == "" || this.txtTitle.Text.Trim() == "")
     {
         int num1 = (int)MessageBox.Show("You cannot project a song without a title or without text !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
     else
     {
         if (!this._saved)
         {
             if (MessageBox.Show("Do you want to save changes?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
             {
                 if (File.Exists(this.sgPath + (object)this.txtTitle) && this.newSong)
                 {
                     int num2 = (int)MessageBox.Show("A song with this title already exists !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                     return;
                 }
                 this.ArrangeText();
                 string contents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <song><title>" + this.txtTitle.Text + "</title><author></author><copyright></copyright><presentation>" + this.txtPresentation.Text + "</presentation><ccli></ccli><capo print=\"false\"></capo><key></key> <aka></aka><key_line></key_line><user1></user1><user2></user2><user3></user3> <theme></theme><tempo></tempo><time_sig></time_sig><lyrics>" + this.txtBody.Text + "</lyrics>\r\n  <hymn_number></hymn_number></song>";
                 if (this.OldTitle != this.txtTitle.Text && File.Exists(this.sgPath + this.OldTitle))
                 {
                     File.Delete(this.sgPath + this.OldTitle);
                 }
                 File.WriteAllText(this.sgPath + this.txtTitle.Text, contents);
                 this.OldTitle = this.txtTitle.Text;
                 this.txtBody.Select(this.txtBody.Text.Length, 1);
                 this._saved = true;
                 this.savedStatus(true);
                 this._Refresh();
                 this.newSong = false;
             }
             else if (this.newSong)
             {
                 int num2 = (int)MessageBox.Show("You cannot project a new song without saving it first !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 return;
             }
         }
         if (this.isProjecting)
         {
             return;
         }
         projection projection = new projection();
         Screen[]   allScreens = Screen.AllScreens;
         this.setFormLocation((Form)projection, allScreens[i]);
         projection.SetText(new List <string>((IEnumerable <string>) this.txtBody.Text.Split('[')));
         projection.title        = this.txtTitle.Text;
         projection.presentation = this.txtPresentation.Text;
         projection.Show();
         new frmControl(this.txtPresentation.Text).Show();
         this.frm          = (projection)Application.OpenForms["projection"];
         this.isProjecting = true;
         this.Log(this.txtTitle.Text);
     }
 }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string     str          = frmMain.ShowDialog("Announce", "Enter title ", "Anunt");
            string     presentation = "[1] " + Environment.NewLine + frmMain.ShowDialog("Annoucne", "Enter text ", "");
            projection projection   = new projection();

            Screen[] allScreens = Screen.AllScreens;
            if (allScreens.Length > 1)
            {
                this.setFormLocation((Form)projection, allScreens[1]);
            }
            else
            {
                this.setFormLocation((Form)projection, allScreens[0]);
            }
            projection.SetText(new List <string>((IEnumerable <string>)presentation.Split('[')));
            projection.title        = str;
            projection.presentation = "1";
            projection.Show();
            new frmControl(presentation).Show();
            this.frm          = (projection)Application.OpenForms["projection"];
            this.isProjecting = true;
            this.Log("Anunt - " + str + ": " + presentation.Replace(Environment.NewLine, "").Replace("[1] ", ""));
        }
Esempio n. 5
0
 private void frmControl_Load(object sender, EventArgs e)
 {
     this.frm = (projection)Application.OpenForms["projection"];
     this.LoadText(this.frm.sg);
 }
Esempio n. 6
0
 private void frmMain_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Control && e.KeyCode == Keys.D2)
     {
         this.Project(1);
     }
     if (e.Control && e.KeyCode == Keys.D1)
     {
         this.Project(0);
     }
     else if (e.KeyCode == Keys.Escape && this.isProjecting)
     {
         this.frm = (projection)Application.OpenForms["projection"];
         this.frm.Close();
         Application.OpenForms["frmControl"].Close();
         this.isProjecting = false;
     }
     else if (e.Control && e.KeyCode == Keys.F)
     {
         this.boxFind.Focus();
     }
     else if (e.Control && e.KeyCode == Keys.S && !this._saved)
     {
         if (File.Exists(this.sgPath + (object)this.txtTitle) && this.newSong)
         {
             int num1 = (int)MessageBox.Show("A song with this title already exists !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
         else
         {
             this.ArrangeText();
             string contents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <song><title>" + this.txtTitle.Text + "</title><author></author><copyright></copyright><presentation>" + this.txtPresentation.Text + "</presentation><ccli></ccli><capo print=\"false\"></capo><key></key> <aka></aka><key_line></key_line><user1></user1><user2></user2><user3></user3> <theme></theme><tempo></tempo><time_sig></time_sig><lyrics>" + this.txtBody.Text + "</lyrics>\r\n  <hymn_number></hymn_number></song>";
             if (this.OldTitle != this.txtTitle.Text && File.Exists(this.sgPath + this.OldTitle))
             {
                 File.Delete(this.sgPath + this.OldTitle);
             }
             File.WriteAllText(this.sgPath + this.txtTitle.Text, contents);
             this.OldTitle = this.txtTitle.Text;
             this.txtBody.Select(this.txtBody.Text.Length, 1);
             this._saved = true;
             int selectedIndex = this.listSongs.SelectedIndex;
             this.savedStatus(true);
             this._Refresh();
             this.listSongs.SelectedItem = (object)this.OldTitle;
             this.newSong = false;
             this.listSongs.Focus();
             if (!this.isProjecting)
             {
                 return;
             }
             this.frm.sg.Clear();
             this.frm.SetText(new List <string>((IEnumerable <string>) this.txtBody.Text.Split('[')));
             this.frm.title        = this.txtTitle.Text;
             this.frm.presentation = this.txtPresentation.Text;
             ((frmControl)Application.OpenForms["frmControl"]).LoadText(this.frm.sg);
         }
     }
     else if (e.KeyCode == Keys.Return && this.boxFind.Focused && this.boxFind.Text != "")
     {
         if (this.isProjecting)
         {
             this.boxFind.Text = "";
             int num2 = (int)MessageBox.Show("You can't edit another song while projecting !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
         else
         {
             this.listSongs.SelectedItem = (object)this.boxFind.Text;
             if (this.listSongs.Items.Contains((object)this.boxFind.Text) || !(this.boxFind.Text.Trim() != ""))
             {
                 return;
             }
             frmSearch openForm = (frmSearch)Application.OpenForms["frmSearch"];
             if (openForm == null)
             {
                 List <string> songs = new List <string>();
                 foreach (string str in this.listSongs.Items)
                 {
                     songs.Add(str);
                 }
                 frmSearch frmSearch = new frmSearch(songs, this.sgPath);
                 frmSearch.txtQuery.Text = this.boxFind.Text;
                 frmSearch.Show();
                 frmSearch.StartSearching();
             }
             else
             {
                 openForm.txtQuery.Text = this.boxFind.Text;
                 openForm.StartSearching();
                 openForm.Focus();
             }
         }
     }
     else
     {
         if (e.KeyCode != Keys.Delete || this.txtBody.Focused)
         {
             return;
         }
         if (this.isProjecting && this.isProjecting)
         {
             int num2 = (int)MessageBox.Show("You can't delete this song while you projecting It !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
         else
         {
             if (this.listSaved.Focused && this.listSaved.SelectedIndex != -1)
             {
                 this.listSaved.Items.Remove(this.listSaved.SelectedItem);
             }
             if (!this.listSongs.Focused || this.listSongs.SelectedIndex == -1 || MessageBox.Show("Are you sure you want to delete this song ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) != DialogResult.Yes)
             {
                 return;
             }
             File.Delete(this.sgPath + this.listSongs.SelectedItem.ToString());
             this.txtPresentation.Text = this.txtTitle.Text = this.txtBody.Text = "";
             this._Refresh();
         }
     }
 }