Exemplo n.º 1
0
 private void OnCustomOpenFileWithDefaultProgram(CustomFileOperationEventArgs args)
 {
     if (this.customOpenFileWithDefaultProgram != null)
     {
         this.customOpenFileWithDefaultProgram(this, args);
     }
 }
Exemplo n.º 2
0
 public void Open(IFileData fileData)
 {
     DevExpress.ExpressApp.Utils.Guard.ArgumentNotNull(fileData, "fileData");
     if (!FileDataHelper.IsFileDataEmpty(fileData))
     {
         CustomFileOperationEventArgs customFileOperationEventArgs = new CustomFileOperationEventArgs(fileData);
         this.OnCustomOpenFileWithDefaultProgram(customFileOperationEventArgs);
         if (!customFileOperationEventArgs.Handled)
         {
             string text = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("B"));
             try
             {
                 Directory.CreateDirectory(text);
             }
             catch
             {
                 Tracing.Tracer.LogValue("tempDirectory", text);
                 throw;
             }
             string text2 = Path.Combine(text, fileData.FileName);
             try
             {
                 using (FileStream fileStream = new FileStream(text2, FileMode.CreateNew))
                 {
                     fileData.SaveToStream(fileStream);
                 }
                 Process.Start(text2);
             }
             catch
             {
                 Tracing.Tracer.LogValue("tempFileName", text2);
                 throw;
             }
         }
     }
 }
Exemplo n.º 3
0
 public void Open(IFileData fileData)
 {
     DevExpress.ExpressApp.Utils.Guard.ArgumentNotNull(fileData, "fileData");
     if (!FileDataHelper.IsFileDataEmpty(fileData))
     {
         CustomFileOperationEventArgs customFileOperationEventArgs = new CustomFileOperationEventArgs(fileData);
         this.OnCustomOpenFileWithDefaultProgram(customFileOperationEventArgs);
         if (!customFileOperationEventArgs.Handled)
         {
             string text = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("B"));
             try
             {
                 Directory.CreateDirectory(text);
             }
             catch
             {
                 Tracing.Tracer.LogValue("tempDirectory", text);
                 throw;
             }
             string text2 = Path.Combine(text, fileData.FileName);
             try
             {
                 using (FileStream fileStream = new FileStream(text2, FileMode.CreateNew))
                 {
                     fileData.SaveToStream(fileStream);
                 }
                 Process.Start(text2);
             }
             catch
             {
                 Tracing.Tracer.LogValue("tempFileName", text2);
                 throw;
             }
         }
     }
 }
Exemplo n.º 4
0
 private void OnCustomOpenFileWithDefaultProgram(CustomFileOperationEventArgs args)
 {
     if (this.customOpenFileWithDefaultProgram != null)
     {
         this.customOpenFileWithDefaultProgram(this, args);
     }
 }