aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-05-09 18:07:56 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-05-09 18:07:56 +0300
commite1236499b485a69648bea4d7871aa185e5dae745 (patch)
tree8cd4ccd7d272c8c4e61d4bd6bcba434eb9522b85 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
parent2a459c79e90a2ade3f1dac1ae4541c0f4d74965c (diff)
downloadTango-e1236499b485a69648bea4d7871aa185e5dae745.tar.gz
Tango-e1236499b485a69648bea4d7871aa185e5dae745.zip
New TemporaryManager !
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs24
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs18
3 files changed, 23 insertions, 21 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs
index a3a0a734e..10b05bc64 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs
@@ -175,7 +175,7 @@ namespace Tango.MachineStudio.UI.Console
engine.ReferencedAssemblies.Add(module.GetType());
}
- await engine.Run(Code);
+ await engine.Run(Code, null);
}
private void WriteLine(String text)
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs
index 79572eb71..eb3572728 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs
@@ -133,13 +133,13 @@ namespace Tango.MachineStudio.UI.TFS
item.Type = WorkItemType.Bug;
var bitmap = UIHelper.TakeSnapshot(MainWindow.Instance);
- String filePath = PathHelper.GetTempFilePath();
- bitmap.SaveJpeg(filePath, 30);
+ var tempFile = TemporaryManager.CreateFile();
+ bitmap.SaveJpeg(tempFile.Path, 30);
item.Attachments.Add(new Attachment()
{
Description = "Screen Capture",
- FilePath = filePath,
+ FilePath = tempFile.Path,
Name = "Screen Capture.jpg",
});
@@ -156,26 +156,26 @@ namespace Tango.MachineStudio.UI.TFS
if (appFileLogger != null)
{
- String appLogFile = PathHelper.GetTempFilePath();
- File.Copy(appFileLogger.LogFile, appLogFile);
+ var appLogFile = TemporaryManager.CreateFile();
+ File.Copy(appFileLogger.LogFile, appLogFile.Path);
item.Attachments.Add(new Attachment()
{
Description = "Application Log File",
- FilePath = appLogFile,
+ FilePath = appLogFile.Path,
Name = Path.GetFileName(appFileLogger.LogFile),
});
}
if (embeddedFileLogger != null && File.Exists(embeddedFileLogger.LogFile))
{
- String embeddedLogFile = PathHelper.GetTempFilePath();
- File.Copy(appFileLogger.LogFile, embeddedLogFile);
+ var embeddedLogFile = TemporaryManager.CreateFile();
+ File.Copy(appFileLogger.LogFile, embeddedLogFile.Path);
item.Attachments.Add(new Attachment()
{
Description = "Embedded Log File",
- FilePath = embeddedLogFile,
+ FilePath = embeddedLogFile.Path,
Name = Path.GetFileName(embeddedFileLogger.LogFile),
});
}
@@ -201,13 +201,13 @@ namespace Tango.MachineStudio.UI.TFS
machineView.Background = System.Windows.Media.Brushes.White;
machineView.DataContext = new MachineDesigner.ViewModels.MainViewVM() { SelectedMachine = machine, Configuration = machine.Configuration };
- String configImageFile = PathHelper.GetTempFilePath();
- machineView.RenderToFile(configImageFile, System.Drawing.Imaging.ImageFormat.Jpeg, new Size(machineView.Width, machineView.Height), 100);
+ var configImageFile = TemporaryManager.CreateFile();
+ machineView.RenderToFile(configImageFile.Path, System.Drawing.Imaging.ImageFormat.Jpeg, new Size(machineView.Width, machineView.Height), 100);
item.Attachments.Add(new Attachment()
{
Description = "Machine Configuration",
- FilePath = configImageFile,
+ FilePath = configImageFile.Path,
Name = "Machine Configuration.jpg"
});
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs
index 0f6ec8b98..c8b4b6adc 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs
@@ -13,6 +13,7 @@ using System.Threading.Tasks;
using Tango.Core.Commands;
using Tango.Core.DI;
using Tango.Core.Helpers;
+using Tango.Core.IO;
using Tango.Logging;
using Tango.MachineStudio.Common.Authentication;
using Tango.MachineStudio.Common.Navigation;
@@ -45,7 +46,7 @@ namespace Tango.MachineStudio.UI.ViewModels
private IStudioApplicationManager _application;
private IAuthenticationProvider _authentication;
private CheckForUpdatesResponse _updateInfo;
- private String _newPackageTempFolder;
+ private TemporaryFolder _newPackageTempFolder;
private UpdateStatus _status;
public UpdateStatus Status
@@ -184,7 +185,7 @@ namespace Tango.MachineStudio.UI.ViewModels
Task.Factory.StartNew(() =>
{
- var tempFile = PathHelper.GetTempFilePath() + ".zip";
+ var tempFile = TemporaryManager.CreateFile(".zip");
try
{
@@ -192,7 +193,7 @@ namespace Tango.MachineStudio.UI.ViewModels
int fileSize = 0;
- using (FileStreamWrapper fs = new FileStreamWrapper(tempFile, FileMode.Create, (current) =>
+ using (FileStreamWrapper fs = new FileStreamWrapper(tempFile.Path, FileMode.Create, (current) =>
{
InvokeUINow(() =>
{
@@ -216,9 +217,10 @@ namespace Tango.MachineStudio.UI.ViewModels
Status = UpdateStatus.Updating;
- _newPackageTempFolder = PathHelper.GetTempFolderPath();
+ _newPackageTempFolder = TemporaryManager.CreateFolder();
+ _newPackageTempFolder.Persist = true;
- using (ZipFile zip = ZipFile.Read(tempFile))
+ using (ZipFile zip = ZipFile.Read(tempFile.Path))
{
int currentEntry = 0;
@@ -235,7 +237,7 @@ namespace Tango.MachineStudio.UI.ViewModels
{
Thread.Sleep(10);
- string newPath = Path.Combine(_newPackageTempFolder, entry.FileName);
+ string newPath = Path.Combine(_newPackageTempFolder.Path, entry.FileName);
try
{
@@ -246,7 +248,7 @@ namespace Tango.MachineStudio.UI.ViewModels
else
{
CurrentUpdateFile = Path.GetFileName(entry.FileName);
- entry.Extract(_newPackageTempFolder, ExtractExistingFileAction.OverwriteSilently);
+ entry.Extract(_newPackageTempFolder.Path, ExtractExistingFileAction.OverwriteSilently);
}
}
catch
@@ -266,7 +268,7 @@ namespace Tango.MachineStudio.UI.ViewModels
}
finally
{
- PathHelper.TryDeleteFile(tempFile);
+ tempFile.Delete();
}
});
}