Exemple #1
0
 private void Form_DialogResultClicked(object sender, DialogResultEventArgs e)
 {
     if (e.Result == DialogResult.OK)
     {
         string message  = "";
         string message2 = "";
         if (Model.IsValid(out message) && IsXmlFileValid(out message2))
         {
             Binder.WriteXmlObjectToFile(Binder.GetXmlObjectFromModel(Model), Model.FullFileName);
             DialogResult = DialogResult.OK;
             Close();
             Dispose();
         }
         else
         {
             rtbOutput.Text = message2 + "---\n" + rtbOutput.Text.ToString() + "\n";
             if (MRMessageBox.Show(string.Format("Data not valid.\n{0}\n{1}\n\nDo you wish to save invalid xml file? ", message, message2), MRMessageBox.eMessageBoxStyle.YesNo, MRMessageBox.eMessageBoxType.Error, 300) == DialogResult.Yes)
             {
                 Binder.WriteXmlObjectToFile(Binder.GetXmlObjectFromModel(Model), Model.FullFileName);
                 DialogResult = DialogResult.Abort;
                 Close();
                 Dispose();
             }
         }
     }
     else if (e.Result == DialogResult.Cancel)
     {
         DialogResult = DialogResult.Cancel;
         Close();
         Dispose();
     }
 }
Exemple #2
0
        private void dgvSoundRecordingsAndReleases_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int editIndex   = 0;
            int deleteIndex = 1;

            if (e.ColumnIndex == editIndex)
            {
                TrackModel track = (TrackModel)dgvSoundRecordingsAndReleases.CurrentRow.DataBoundItem;
                if (track != null)
                {
                    using (var frm = new ERN_382TrackReleaseForm((TrackModel)track.Copy()))
                    {
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            track.CopyFromSource(frm.Model);
                        }
                    }
                }
            }
            else if (e.ColumnIndex == deleteIndex)
            {
                using (var f = new MRMessageBox("Želite li obrisati zapis?", MRMessageBox.eMessageBoxStyle.YesNo))
                {
                    if (f.ShowDialog() == DialogResult.Yes)
                    {
                        dgvSoundRecordingsAndReleases.Rows.RemoveAt(e.RowIndex);
                    }
                }
            }
        }
Exemple #3
0
        private AudioAlbumModel GetModelFromFile(string fileName)
        {
            AudioAlbumModel ret = null;

            try
            {
                ret = (AudioAlbumModel)Binder.GetModelFromXmlObject(Binder.GetXmlObjectFromFile(fileName));
            }
            catch (Exception ex)
            {
                MRMessageBox.Show(string.Format("Unable to read file {1}.\n{0}", ex.Message, fileName), MRMessageBox.eMessageBoxStyle.OK, MRMessageBox.eMessageBoxType.Error);
            }

            return(ret);
        }
 private void ERN_382TrackReleaseForm_DialogResultClicked(object sender, DialogResultEventArgs e)
 {
     if (e.Result == DialogResult.OK)
     {
         string message = "";
         if (Model.IsValid(out message))
         {
             DialogResult = DialogResult.OK;
         }
         else
         {
             MRMessageBox.Show(string.Format("Data not valid.\n{0}", message), MRMessageBox.eMessageBoxStyle.OK, MRMessageBox.eMessageBoxType.Error);
         }
     }
     else if (e.Result == DialogResult.Cancel)
     {
         DialogResult = DialogResult.Cancel;
     }
 }
Exemple #5
0
 private void Form_DialogResultClicked(object sender, DialogResultEventArgs e)
 {
     if (e.Result == DialogResult.OK)
     {
         string message = "";
         if (Model.IsValid(out message))
         {
             if (System.IO.File.Exists(Model.FullName) && MRMessageBox.Show("File exists. Overwrite?", MRMessageBox.eMessageBoxStyle.YesNo, MRMessageBox.eMessageBoxType.Warning) == DialogResult.Yes)
             {
                 System.IO.File.WriteAllText(Model.FullName, "");
                 DialogResult = DialogResult.OK;
             }
         }
         else
         {
             MRMessageBox.Show(string.Format("Data not valid.\n{0}", message), MRMessageBox.eMessageBoxStyle.OK, MRMessageBox.eMessageBoxType.Error);
         }
     }
     else if (e.Result == DialogResult.Cancel)
     {
         DialogResult = DialogResult.Cancel;
     }
 }