public MediaDetails(Domain.Medium Medium)
     : this()
 {
     this.Medium = Medium;
     txtName.Text = Medium.Title;
     txtDescription.Text = Medium.Description;
 }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (txtName.Text == "")
            {
                MessageBox.Show("Please enter a title");
                return;
            }

            /* encapsulate details into Domain.Medium */
            string filename = "Media\\" + DateTime.Now.ToString("yyyyMMMdd-HHmmss-ddd");

            Domain.Medium medium;
            if (isNew)
            {
                medium = new Domain.Medium();
                if (isVideo)
                {
                    medium.Type = Domain.MediumType.Video;
                    filename += ".wmv";
                }
                else
                {
                    medium.Type = Domain.MediumType.Image;
                    filename += ".jpg";
                }

                medium.Path = filename;
            }
            else
                medium = Medium;

            File.Move(Directory.GetCurrentDirectory() + "\\medi.um", Directory.GetCurrentDirectory() + "\\" + filename);

            //if isVideo and isNew
            if (isVideo)
            {
                var cmd = Directory.GetCurrentDirectory() + @"\ffmpeg.exe -itsoffset 1 -i " + Directory.GetCurrentDirectory() + @"\" + filename + @" -vcodec mjpeg -vframes 1 -an -f rawvideo -s 30x30 -y " + Directory.GetCurrentDirectory() + @"\" + filename + @"-thumbnail.jpg";
                ProcessStartInfo psi = new ProcessStartInfo("CMD.exe", "/c " + cmd);
                psi.UseShellExecute = false;
                psi.CreateNoWindow = true;
                var p = Process.Start(psi);
                p.WaitForExit();
            }

            medium.Title = txtName.Text;
            medium.Description = txtDescription.Text;

            /* communicate with patientVisit to add medium to TempVisitMedium*/
            ((PatientVisits)this.Owner).AddMedium(medium);
        }