diff --git a/App.xaml.cs b/App.xaml.cs
index 3eeb82e..01634da 100644
--- a/App.xaml.cs
+++ b/App.xaml.cs
@@ -109,7 +109,7 @@ void LoadIcon(string iconName)
// The Window object doesn't have Width and Height properties in WInUI 3 Desktop yet.
// To set the Width and Height, you can use the Win32 API SetWindowPos.
// Note, you should apply the DPI scale factor if you are thinking of dpi instead of pixels.
- SetWindowSize(m_windowHandle, 1200, 680);
+ SetWindowSize(m_windowHandle, 1250, 680);
}
public static string Title;
diff --git a/Changelog.xml b/Changelog.xml
index ed0fb7c..fbec1c0 100644
--- a/Changelog.xml
+++ b/Changelog.xml
@@ -3,4 +3,5 @@
+
\ No newline at end of file
diff --git a/ITATKWinUI.csproj b/ITATKWinUI.csproj
index f27ecfd..7db2162 100644
--- a/ITATKWinUI.csproj
+++ b/ITATKWinUI.csproj
@@ -27,6 +27,7 @@
+
@@ -41,10 +42,12 @@
-
-
-
-
+
+
+
+
+
+
@@ -106,6 +109,12 @@
PreserveNewest
+
+ Always
+
+
+ MSBuild:Compile
+
Always
diff --git a/MainWindow.xaml b/MainWindow.xaml
index bbc3015..4fe80c5 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -49,13 +49,14 @@
-
-
+ -->
+
-
+
@@ -180,7 +181,7 @@
-
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 0ad20de..cbc82da 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -27,6 +27,8 @@
using System.Management.Automation.Runspaces;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
+using CsvHelper;
+using System.Globalization;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
@@ -53,6 +55,17 @@ namespace ITATKWinUI
// }
//}
+ public class ReportingRecord
+ {
+ public string ScriptName { get; set; }
+ public string ScriptPath { get; set; }
+ public DateTime DateTime { get; set; }
+ public string UserExecuting { get; set; }
+ public string HostExecuting { get; set; }
+ public string FileExtension { get; set; }
+ public string Target { get; set; }
+ }
+
public partial class MainWindow : Window
{
//TODO: Need a way to reset these as well as resetting the UI
@@ -432,7 +445,13 @@ void Image_Loaded(object sender, RoutedEventArgs e)
tmp.Content = headerContentStackPanel;
//Add Run and Explore click events
- headerContentRunButton.Click += (sender, e) => LaunchScript(path, psVersion, inputType);
+ void RunButtonMethods()
+ {
+ LaunchScript(path, psVersion, inputType);
+ WriteReportingRecord(name, path, CurrentInput, psVersion);
+ }
+
+ headerContentRunButton.Click += (sender, e) => RunButtonMethods();
headerContentExploreButton.Click += (sender, e) => LaunchExplorer(path);
return tmp;
@@ -572,6 +591,11 @@ private void MainNav_SelectionChanged(NavigationView sender, NavigationViewSelec
_page = typeof(Settings);
contentFrame.Navigate(_page);
//TODO: Should we hide the machine input, terminal, and machine info pane here? If so ensure we show it once we navigate away below
+ } else if (args.SelectedItemContainer.Content.ToString() == "Reporting")
+ {
+ Type _page = null;
+ _page = typeof(Reporting);
+ contentFrame.Navigate(_page);
}
else
{
@@ -674,6 +698,51 @@ private void FullScreenTerminal_Click(object sender, RoutedEventArgs e)
}
}
+ public static string reportFilePath = Environment.CurrentDirectory + "\\Usage.csv";
+
+ public static void WriteReportingRecord(string ScriptTitle, string ScriptFilePath, string MachineInput, string Type)
+ {
+ //Name, Input, Time, User Executing, Host Executing
+ var newRecord = new List
+ {
+ new ReportingRecord {
+ ScriptName = ScriptTitle,
+ ScriptPath = ScriptFilePath,
+ HostExecuting = Environment.MachineName,
+ FileExtension = Type,
+ Target = MachineInput,
+ UserExecuting = Environment.UserName,
+ DateTime = DateTime.Now
+ }
+ };
+
+ var records = GetReportingRecords();
+
+ using (var writer = new StreamWriter(reportFilePath))
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteHeader();
+ csv.NextRecord();
+ foreach (var record in records)
+ {
+ csv.WriteRecord(record);
+ csv.NextRecord();
+ }
+ csv.WriteRecords(newRecord);
+ csv.NextRecord();
+ }
+ }
+
+ public static List GetReportingRecords()
+ {
+ using (var reader = new StreamReader(reportFilePath))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords();
+ return records.ToList();
+ }
+ }
+
private void ClearTerminal_Click(object sender, RoutedEventArgs e)
{
//ScriptTerminal.Text = "";
@@ -806,6 +875,7 @@ PSDataCollection RunPing(string CurrentInput)
}
else
{
+ CurrentInput = "";
PingSymbol.Visibility = Visibility.Collapsed;
}
}
diff --git a/README.md b/README.md
index d4c7c3c..04b9fe1 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@
- Eventually, explore cross-platform support for macOS and Linux.
**Prerequisites (In-Progress):**
-- At a minimum if you just want to run the built app you will need the proper [Windows App Runtime Redist](https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads#current-releases) (Currently: Version 1.0.1) installed, this project is primarily targeted towards x64 but please feel free to open an Issue or PR for other platforms if you find they aren't working.
+- At a minimum if you just want to run the built app you will need the proper [Windows App Runtime Redist](https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads#current-releases) (Currently: Version 1.1.3) installed, this project is primarily targeted towards x64 but please feel free to open an Issue or PR for other platforms if you find they aren't working.
- For development - environmental requirements can be found [here](https://docs.microsoft.com/en-us/windows/apps/winui/winui3/create-your-first-winui3-app#unpackaged-create-a-new-project-for-an-unpackaged-c-or-c-winui-3-desktop-app)
- Currently, this project is intended to be unpackaged if you are running the .sln from Visual Studio
- Other potential things to check:
diff --git a/Reporting.xaml b/Reporting.xaml
new file mode 100644
index 0000000..577138e
--- /dev/null
+++ b/Reporting.xaml
@@ -0,0 +1,13 @@
+
+
+
+
diff --git a/Reporting.xaml.cs b/Reporting.xaml.cs
new file mode 100644
index 0000000..7c7b584
--- /dev/null
+++ b/Reporting.xaml.cs
@@ -0,0 +1,62 @@
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+
+// To learn more about WinUI, the WinUI project structure,
+// and more about our project templates, see: http://aka.ms/winui-project-info.
+
+namespace ITATKWinUI
+{
+ ///
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ ///
+ public sealed partial class Reporting : Page
+ {
+ System.Collections.ObjectModel.ObservableCollection ReportData = new System.Collections.ObjectModel.ObservableCollection();
+
+ public Reporting()
+ {
+ this.InitializeComponent();
+
+ var records = MainWindow.GetReportingRecords();
+
+ foreach(ReportingRecord record in records)
+ {
+ ReportData.Add(new ReportingData(record.ScriptName, record.ScriptPath, record.HostExecuting, record.FileExtension, record.Target, record.UserExecuting, record.DateTime));
+ }
+ }
+ }
+
+ public class ReportingData
+ {
+ public string ScriptName { get; set; }
+ public string ScriptPath { get; set; }
+ public string HostExecuting { get; set; }
+ public string FileExtension { get; set; }
+ public string Target { get; set; }
+ public string UserExecuting { get; set; }
+ public DateTime DateTime { get; set; }
+
+ public ReportingData(string ScriptName, string ScriptPath, string HostExecuting, string FileExtension, string Target, string UserExecuting, DateTime DateTime)
+ {
+ this.ScriptName = ScriptName;
+ this.ScriptPath = ScriptPath;
+ this.HostExecuting = HostExecuting;
+ this.FileExtension = FileExtension;
+ this.Target = Target;
+ this.UserExecuting = UserExecuting;
+ this.DateTime = DateTime;
+ }
+ }
+}
diff --git a/Usage.csv b/Usage.csv
new file mode 100644
index 0000000..6ab1927
Binary files /dev/null and b/Usage.csv differ
diff --git a/XML/Categories.xml b/XML/Categories.xml
index 2a1e8f3..70f7da1 100644
--- a/XML/Categories.xml
+++ b/XML/Categories.xml
@@ -5,7 +5,6 @@
-