示例#1
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);
     }
 }
示例#2
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] ", ""));
        }