-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommands.cs
58 lines (48 loc) · 2.1 KB
/
Commands.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Windows;
using OpenSpanWPF;
using System.IO;
namespace ProcessCapture
{
public class Commands
{
public static readonly RoutedUICommand DeleteRecord = new RoutedUICommand("Delete image", "DeleteImage", typeof(OpenSpanWPF.OpenSpanWPFWindow));
public static readonly RoutedUICommand ShowImage = new RoutedUICommand("Show image", "ShowImage", typeof(OpenSpanWPF.OpenSpanWPFWindow));
public static readonly RoutedUICommand HideImage = new RoutedUICommand("Hide image", "HideImage", typeof(OpenSpanWPF.OpenSpanWPFWindow));
public static readonly RoutedUICommand SaveImage = new RoutedUICommand("Save image", "SaveImage", typeof(OpenSpanWPF.OpenSpanWPFWindow));
public static readonly RoutedUICommand Undo = new RoutedUICommand("Undo", "Undo", typeof(OpenSpanWPF.OpenSpanWPFWindow));
public static string GetFileName()
{
return string.Format(@"{0}Screen-{1}.png", OutputDir(), GetFileNumber());
}
public static string GetFileNumber()
{
Guid g = Guid.NewGuid();
return g.ToString();
}
public static string OutputDir()
{
OpenSpanWPFWindow window = (OpenSpanWPFWindow)Application.Current.MainWindow;
Project proj = window.processInfo.ProjectObject;
if (proj != null)
{
string projFile = proj.ProjectFileLocation;
if (projFile != null && projFile != string.Empty)
{
string dirName = Path.GetDirectoryName(projFile) + @"\" + ImagesFolderName + @"\";
if (!Directory.Exists(dirName))
{
Directory.CreateDirectory(dirName);
}
return dirName;
}
}
return System.IO.Path.GetTempPath();
}
private static string ImagesFolderName = "images";
}
}