Example #1
0
        private void attachmentSelected(object sender, RoutedEventArgs e)
        {
            selectedAtt = (Attach)(sender as Button).DataContext;
            if (selectedAtt.Path.EndsWith("avi") || selectedAtt.Path.EndsWith("mp3") || selectedAtt.Path.EndsWith("mp4"))
            {
                media.Source      = new Uri(selectedAtt.Path);
                media.Visibility  = Visibility.Visible;
                play.Visibility   = Visibility.Visible;
                pause.Visibility  = Visibility.Visible;
                slider.Visibility = Visibility.Visible;

                DispatcherTimer timer = new DispatcherTimer();
                timer.Interval = TimeSpan.FromSeconds(1);
                timer.Tick    += timer_Tick;
                timer.Start();
            }
        }
Example #2
0
        private void addAttachments_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter      = "Image files (*.png;*.jpeg;*.gif;*.bmp)|*.png;*.jpeg;*.gif;*.bmp|All files (*.*)|*.*";
            ofd.Multiselect = true;

            if (ofd.ShowDialog() == true)
            {
                foreach (string filename in ofd.FileNames)
                {
                    Attach attachment = new Attach();
                    attachment.FileName = System.IO.Path.GetFileName(filename);
                    attachment.Path     = System.IO.Path.GetFullPath(filename);
                    attachments.Add(attachment);
                }
            }

            lbAttachments.ItemsSource = attachments;
        }