Ejemplo n.º 1
0
 public static void OpenFile(object sender, ExecutedRoutedEventArgs e, System.Windows.Window ownerWindow)
 {
     if (e.Parameter is WorkLogStuff)
     {
         var logStuff = e.Parameter as WorkLogStuff;
         if (TaskStuffFileHelper.IsImage(logStuff))
         {
             var         image = WorkLogStuffFileHelper.GetImage(logStuff);
             ImageWindow wnd   = new ImageWindow();
             wnd.LoadImage(image);
             wnd.ShowDialog(ownerWindow);
         }
         else
         {
             string displayFile = WorkLogStuffFileHelper.GetDisplayFile(logStuff);
             if (displayFile.EndsWith(".xps", StringComparison.OrdinalIgnoreCase))
             {
                 XpsDocumentWindow wnd = new XpsDocumentWindow();
                 wnd.OpenXpsDocument(displayFile);
                 wnd.ShowDialog(ownerWindow);
             }
             else if (displayFile.EndsWith(".mp3", StringComparison.OrdinalIgnoreCase) || displayFile.EndsWith(".wav", StringComparison.OrdinalIgnoreCase))
             {
                 var player = CO_IA.Client.Utility.AudioPlayer;
                 player.Stop();
                 player.Open(new Uri(displayFile, UriKind.RelativeOrAbsolute));
                 player.Play();
             }
             else
             {
                 System.Diagnostics.Process p = new System.Diagnostics.Process();
                 p.StartInfo = new System.Diagnostics.ProcessStartInfo {
                     FileName = displayFile
                 };
                 p.Start();
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void worklogeditcontrol_OpenWorkLogStuff(object arg1, ExecutedRoutedEventArgs arg2)
 {
     WorkLogStuffFileHelper.OpenFile(arg1, arg2, this);
 }