Change folder structure
This commit is contained in:
110
Source/LogDashboard.UI/App.config
Normal file
110
Source/LogDashboard.UI/App.config
Normal file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
App.config
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="Raytheon.LogDashboard.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
</startup>
|
||||
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true">
|
||||
<targets>
|
||||
<target fileName="${logger}.txt"
|
||||
xsi:type="File"
|
||||
name="file"
|
||||
layout="${date:format=MM/dd/yyyy hh.mm.ss} ${message}"
|
||||
archiveAboveSize="100000000"/>
|
||||
<target name="fileLog" type="AsyncWrapper" queueLimit="5000" overflowAction="Block">
|
||||
<target type="File" fileName="${specialfolder:folder=MyDocuments}/LogDashboard/logs/${shortdate}.txt"
|
||||
layout="${longdate};${level};${threadid};${callsite};${logger};${message};${exception:format=tostring}"
|
||||
archiveFileName="${specialfolder:folder=MyDocuments}/LogDashboard/logs/archive/{#}.zip"
|
||||
archiveDateFormat="MM-dd-yyyy"
|
||||
archiveNumbering="Date"
|
||||
enableArchiveFileCompression="True"
|
||||
maxArchiveFiles="7"
|
||||
archiveEvery="Day"/>
|
||||
</target>
|
||||
</targets>
|
||||
<rules>
|
||||
<logger name="*" minlevel="Debug" writeTo="fileLog"/>
|
||||
</rules>
|
||||
</nlog>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Windows.Interactivity" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<userSettings>
|
||||
<Raytheon.LogDashboard.Properties.Settings>
|
||||
<setting name="CurrentWindowHeight" serializeAs="String">
|
||||
<value>600</value>
|
||||
</setting>
|
||||
<setting name="PreviousWindowHeight" serializeAs="String">
|
||||
<value>600</value>
|
||||
</setting>
|
||||
<setting name="CurrentWindowWidth" serializeAs="String">
|
||||
<value>800</value>
|
||||
</setting>
|
||||
<setting name="PreviousWindowWidth" serializeAs="String">
|
||||
<value>800</value>
|
||||
</setting>
|
||||
<setting name="CurrentWindowLeft" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
<setting name="PreviousWindowLeft" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
<setting name="CurrentWindowTop" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
<setting name="PreviousWindowTop" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
<setting name="SettingsPath" serializeAs="String">
|
||||
<value></value>
|
||||
</setting>
|
||||
</Raytheon.LogDashboard.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
59
Source/LogDashboard.UI/App.xaml
Normal file
59
Source/LogDashboard.UI/App.xaml
Normal file
@@ -0,0 +1,59 @@
|
||||
<!--
|
||||
App.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<Application x:Class="LogDashboard.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
d1p1:Ignorable="d"
|
||||
xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
StartupUri="View/MainWindow.xaml"
|
||||
>
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||
<!-- Theme setting -->
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
|
||||
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" xmlns:vm="clr-namespace:Raytheon.LogDashboard.ViewModel" />
|
||||
<vm:LogDashViewModelLocator x:Key="LogDashLocator" d:IsDataSource="True" xmlns:vm="clr-namespace:Raytheon.LogDashboard.ViewModel;assembly=Raytheon.LogDashboardLib" />
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
221
Source/LogDashboard.UI/App.xaml.cs
Normal file
221
Source/LogDashboard.UI/App.xaml.cs
Normal file
@@ -0,0 +1,221 @@
|
||||
//******************************************************************************//
|
||||
// App.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using Microsoft.Win32;
|
||||
using NLog;
|
||||
using Raytheon.LogDashboard.Helpers;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.IO;
|
||||
using Raytheon.LogDashboard.View;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System.Reflection;
|
||||
|
||||
namespace LogDashboard
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public static bool IsManualStartup { get; private set; } = false;
|
||||
public ResourceDictionary ThemeDictionary => Resources.MergedDictionaries[1];
|
||||
|
||||
public void ChangeTheme(Uri uri)
|
||||
{
|
||||
ThemeDictionary.MergedDictionaries[1] = new ResourceDictionary { Source = uri };
|
||||
}
|
||||
|
||||
static Mutex mutex = new Mutex(true, "{8F6F0AC4-B9A1-45fd-A8CF-72F04E6BDE8F}");
|
||||
|
||||
[STAThread]
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
|
||||
|
||||
if(e.Args.Any(x => (x.EndsWith(".txt") || x.EndsWith(".log")) && File.Exists(x)))
|
||||
{
|
||||
IsManualStartup = true;
|
||||
|
||||
try
|
||||
{
|
||||
if(!mutex.WaitOne(TimeSpan.Zero, true))
|
||||
{
|
||||
Process proc = Process.GetCurrentProcess();
|
||||
string processName = proc.ProcessName.Replace(".vshost", "");
|
||||
var runningProcess = Process.GetProcesses()
|
||||
.FirstOrDefault(x => (x.ProcessName == processName || x.ProcessName == proc.ProcessName || x.ProcessName == proc.ProcessName + ".vshost") && x.Id != proc.Id);
|
||||
|
||||
if(runningProcess == null)
|
||||
{
|
||||
App app = new App();
|
||||
app.InitializeComponent();
|
||||
MainWindow window = new MainWindow();
|
||||
Raytheon.LogDashboard.View.MainWindow.HandleParameter(e.Args);
|
||||
app.Run(window);
|
||||
return;
|
||||
}
|
||||
|
||||
UnsafeNative.SendMessage(runningProcess.MainWindowHandle, string.Join(" ", e.Args));
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
logger.Warn(exception, "OnStartup check exception (open with arguments)");
|
||||
}
|
||||
}
|
||||
|
||||
string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
string logDashboardConfigFilePath = Path.Combine(assemblyFolder, "LogDashboard.xml");
|
||||
// load settings from configuration file
|
||||
Raytheon.LogDashboard.Model.Settings.SetInstance(logDashboardConfigFilePath).Load();
|
||||
|
||||
if(Raytheon.LogDashboard.Model.Settings.Instance.OnlyOneAppInstance)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(mutex.WaitOne(TimeSpan.Zero, true))
|
||||
{
|
||||
mutex.ReleaseMutex();
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Trace("OnStartup: one instance of Log Viewer already started");
|
||||
Messenger.Default.Send("OnStartup: one instance of Log Viewer already started", "DisplayCustomMessage");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
logger.Warn(exception, "OnStartup check exception");
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if(!IsAssociated())
|
||||
{
|
||||
string filePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||
|
||||
SetAssociation(".txt", "LogDashboard", filePath);
|
||||
SetAssociation(".log", "LogDashboard", filePath);
|
||||
SetAssociation(".csv", "LogDashboard", filePath);
|
||||
}
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
logger.Warn(exception, "OnStartup set file association exception");
|
||||
}
|
||||
|
||||
base.OnStartup(e);
|
||||
}
|
||||
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
logger.Fatal($"Unhandled exception {e.ExceptionObject as Exception}");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
logger.Fatal($"Unhandled Exception: {e.Exception}");
|
||||
Environment.Exit(2);
|
||||
}
|
||||
|
||||
#region File Association
|
||||
|
||||
private bool IsAssociated()
|
||||
{
|
||||
return Registry.CurrentUser.OpenSubKey(@"Software\Classes\LogViewer", false) != null;
|
||||
}
|
||||
|
||||
[DllImport("Shell32.dll")]
|
||||
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
|
||||
|
||||
private const int SHCNE_ASSOCCHANGED = 0x8000000;
|
||||
private const int SHCNF_FLUSH = 0x1000;
|
||||
|
||||
private void SetAssociation(string extension, string progId, string applicationFilePath)
|
||||
{
|
||||
bool madeChanges = false;
|
||||
|
||||
madeChanges |= SetKeyDefaultValue($@"Software\Classes\{progId}\shell\open\command", "\"" + applicationFilePath + "\" \"%1\"");
|
||||
madeChanges |= SetProgIdValue($@"Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\{extension}\OpenWithProgids", progId);
|
||||
|
||||
if(madeChanges)
|
||||
{
|
||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSH, IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
private bool SetProgIdValue(string path, string progId)
|
||||
{
|
||||
using(var key = Registry.CurrentUser.CreateSubKey(path))
|
||||
{
|
||||
if(key.GetValueNames().All(x => x != progId))
|
||||
{
|
||||
key.SetValue(progId, Encoding.Unicode.GetBytes(string.Empty), RegistryValueKind.Binary);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool SetKeyDefaultValue(string keyPath, string value)
|
||||
{
|
||||
using(var key = Registry.CurrentUser.CreateSubKey(keyPath))
|
||||
{
|
||||
if(key.GetValue(null) as string != value)
|
||||
{
|
||||
key.SetValue(null, value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
101
Source/LogDashboard.UI/Helpers/UnsafeNative.cs
Normal file
101
Source/LogDashboard.UI/Helpers/UnsafeNative.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
//******************************************************************************//
|
||||
// UnsafeNative.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
// Ignore Spelling: COPYDATA
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Raytheon.LogDashboard.Helpers
|
||||
{
|
||||
internal static class UnsafeNative
|
||||
{
|
||||
public const int WM_COPYDATA = 0x004A;
|
||||
|
||||
public static string GetMessage(int message, IntPtr lParam)
|
||||
{
|
||||
if (message == WM_COPYDATA)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = Marshal.PtrToStructure<CopyDataStruct>(lParam);
|
||||
string result = string.Copy(data.lpData);
|
||||
return result;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void SendMessage(IntPtr hwnd, string message)
|
||||
{
|
||||
byte[] messageBytes = Encoding.Unicode.GetBytes(message); /* ANSII encoding */
|
||||
CopyDataStruct data = new CopyDataStruct
|
||||
{
|
||||
dwData = IntPtr.Zero,
|
||||
lpData = message,
|
||||
cbData = messageBytes.Length + 1 /* +1 because of \0 string termination */
|
||||
};
|
||||
|
||||
if (SendMessage(hwnd, WM_COPYDATA, IntPtr.Zero, ref data) != 0)
|
||||
{
|
||||
throw new Win32Exception(Marshal.GetLastWin32Error());
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
|
||||
[DllImport("User32.dll", EntryPoint = "SendMessage")]
|
||||
private static extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, ref CopyDataStruct lParam);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct CopyDataStruct
|
||||
{
|
||||
public IntPtr dwData;
|
||||
public int cbData;
|
||||
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string lpData;
|
||||
}
|
||||
}
|
||||
}
|
||||
105
Source/LogDashboard.UI/LogDashboard.UI.csproj
Normal file
105
Source/LogDashboard.UI/LogDashboard.UI.csproj
Normal file
@@ -0,0 +1,105 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<AssemblyName>Raytheon.LogDashboard</AssemblyName>
|
||||
<RootNamespace>Raytheon.LogDashboard</RootNamespace>
|
||||
<Company>Raytheon Technologies</Company>
|
||||
<Product>Logging Dashboard Application</Product>
|
||||
<Authors>Specialty Engineering</Authors>
|
||||
<Copyright>Raytheon Technologies</Copyright>
|
||||
<Version>1.3.10</Version>
|
||||
<AssemblyVersion>$(Version)</AssemblyVersion>
|
||||
<FileVersion>$(Version)</FileVersion>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ApplicationIcon>Resources\LogDashboard.ico</ApplicationIcon>
|
||||
<DeploymentFolder>$(SolutionDir)_Deployment\</DeploymentFolder>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Resources\rt_logo_30h.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\LogDashboard.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MahApps.Metro" Version="2.4.10" />
|
||||
<PackageReference Include="MahApps.Metro.Resources" Version="0.6.1" />
|
||||
<PackageReference Include="MvvmLight" Version="5.4.1.1" />
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LogDashboard\LogDashboard.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Windows.Interactivity" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Settings.Designer.cs">
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Resources\Resource1.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resource1.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\rt_logo_30h.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Resources\Resource1.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resource1.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Update="Properties\Resources.resx">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Update="Properties\Locals.resx">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Locals.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="CopyFilesToDeploymentDir" AfterTargets="AfterBuild">
|
||||
<ItemGroup>
|
||||
<FILES_1 Include="$(OutDir)*.dll" />
|
||||
<FILES_2 Include="$(TargetPath)" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(DeploymentFolder)" />
|
||||
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(DeploymentFolder)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="ProjClean" AfterTargets="AfterClean">
|
||||
<RemoveDir Directories="$(DeploymentFolder)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
134
Source/LogDashboard.UI/Properties/Settings.Designer.cs
generated
Normal file
134
Source/LogDashboard.UI/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,134 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Raytheon.LogDashboard.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.13.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("600")]
|
||||
public double CurrentWindowHeight {
|
||||
get {
|
||||
return ((double)(this["CurrentWindowHeight"]));
|
||||
}
|
||||
set {
|
||||
this["CurrentWindowHeight"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("600")]
|
||||
public double PreviousWindowHeight {
|
||||
get {
|
||||
return ((double)(this["PreviousWindowHeight"]));
|
||||
}
|
||||
set {
|
||||
this["PreviousWindowHeight"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("800")]
|
||||
public double CurrentWindowWidth {
|
||||
get {
|
||||
return ((double)(this["CurrentWindowWidth"]));
|
||||
}
|
||||
set {
|
||||
this["CurrentWindowWidth"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("800")]
|
||||
public double PreviousWindowWidth {
|
||||
get {
|
||||
return ((double)(this["PreviousWindowWidth"]));
|
||||
}
|
||||
set {
|
||||
this["PreviousWindowWidth"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("100")]
|
||||
public double CurrentWindowLeft {
|
||||
get {
|
||||
return ((double)(this["CurrentWindowLeft"]));
|
||||
}
|
||||
set {
|
||||
this["CurrentWindowLeft"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("100")]
|
||||
public double PreviousWindowLeft {
|
||||
get {
|
||||
return ((double)(this["PreviousWindowLeft"]));
|
||||
}
|
||||
set {
|
||||
this["PreviousWindowLeft"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("100")]
|
||||
public double CurrentWindowTop {
|
||||
get {
|
||||
return ((double)(this["CurrentWindowTop"]));
|
||||
}
|
||||
set {
|
||||
this["CurrentWindowTop"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("100")]
|
||||
public double PreviousWindowTop {
|
||||
get {
|
||||
return ((double)(this["PreviousWindowTop"]));
|
||||
}
|
||||
set {
|
||||
this["PreviousWindowTop"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("./LogDashboard.xml")]
|
||||
public string SettingsPath {
|
||||
get {
|
||||
return ((string)(this["SettingsPath"]));
|
||||
}
|
||||
set {
|
||||
this["SettingsPath"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Source/LogDashboard.UI/Properties/Settings.settings
Normal file
33
Source/LogDashboard.UI/Properties/Settings.settings
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Raytheon.LogDashboard.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="CurrentWindowHeight" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">600</Value>
|
||||
</Setting>
|
||||
<Setting Name="PreviousWindowHeight" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">600</Value>
|
||||
</Setting>
|
||||
<Setting Name="CurrentWindowWidth" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">800</Value>
|
||||
</Setting>
|
||||
<Setting Name="PreviousWindowWidth" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">800</Value>
|
||||
</Setting>
|
||||
<Setting Name="CurrentWindowLeft" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
<Setting Name="PreviousWindowLeft" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
<Setting Name="CurrentWindowTop" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
<Setting Name="PreviousWindowTop" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
<Setting Name="SettingsPath" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">./LogDashboard.xml</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
BIN
Source/LogDashboard.UI/Resources/LogDashboard.ico
Normal file
BIN
Source/LogDashboard.UI/Resources/LogDashboard.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
73
Source/LogDashboard.UI/Resources/Resource1.Designer.cs
generated
Normal file
73
Source/LogDashboard.UI/Resources/Resource1.Designer.cs
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Raytheon.LogDashboard.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resource1 {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resource1() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Raytheon.LogDashboard.Resources.Resource1", typeof(Resource1).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon LogDashboard {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("LogDashboard", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
124
Source/LogDashboard.UI/Resources/Resource1.resx
Normal file
124
Source/LogDashboard.UI/Resources/Resource1.resx
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="LogDashboard" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>LogDashboard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
Source/LogDashboard.UI/Resources/rt_logo_30h.png
Normal file
BIN
Source/LogDashboard.UI/Resources/rt_logo_30h.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
105
Source/LogDashboard.UI/View/MainWindow.xaml
Normal file
105
Source/LogDashboard.UI/View/MainWindow.xaml
Normal file
@@ -0,0 +1,105 @@
|
||||
<!--
|
||||
MainWindow.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<mah:MetroWindow x:Class="Raytheon.LogDashboard.View.MainWindow"
|
||||
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ctrl="clr-namespace:Raytheon.LogDashboard.View;assembly=Raytheon.LogDashboardLib"
|
||||
xmlns:Dialog="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
|
||||
DataContext="{Binding Main, Source={StaticResource Locator}}"
|
||||
Dialog:DialogParticipation.Register="{Binding}"
|
||||
WindowTitleBrush="{Binding IconColor}"
|
||||
mc:Ignorable="d"
|
||||
Title="Common Platforms Log Dashboard"
|
||||
ResizeMode="CanResizeWithGrip"
|
||||
Closing="MetroWindow_Closing"
|
||||
Height="{Binding CurrentWindowHeight, Mode=TwoWay}"
|
||||
Width="{Binding CurrentWindowWidth, Mode=TwoWay}"
|
||||
Left="{Binding CurrentWindowLeft, Mode=TwoWay}"
|
||||
Top="{Binding CurrentWindowTop, Mode=TwoWay}"
|
||||
Icon="/Resources/rt_logo_30h.png"
|
||||
Loaded="MainWindow_OnLoaded">
|
||||
|
||||
<mah:MetroWindow.Flyouts>
|
||||
<mah:FlyoutsControl>
|
||||
<mah:FlyoutsControl.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type mah:Flyout}">
|
||||
<Setter Property="RenderTransform" Value="{x:Null}"></Setter>
|
||||
<Setter Property="AreAnimationsEnabled" Value="True" />
|
||||
<Setter Property="AnimateOpacity" Value="True" />
|
||||
<Setter Property="Theme" Value="Adapt" />
|
||||
<Setter Property="Position" Value="Right" />
|
||||
</Style>
|
||||
</mah:FlyoutsControl.ItemContainerStyle>
|
||||
|
||||
<mah:Flyout Header="Settings"
|
||||
MinWidth="600"
|
||||
Theme="Adapt"
|
||||
IsOpen="{Binding LogDashboard.ShowSettings, Source={StaticResource LogDashLocator}}">
|
||||
|
||||
<mah:MetroContentControl Margin="0,0,20,0">
|
||||
<ctrl:SettingsCtrl DataContext="{Binding Settings, Source={StaticResource LogDashLocator}}" />
|
||||
</mah:MetroContentControl>
|
||||
|
||||
</mah:Flyout>
|
||||
|
||||
<mah:Flyout Header="Search Namespaces"
|
||||
Theme="Adapt"
|
||||
MinWidth="400"
|
||||
IsOpen="{Binding LogDashboard.ShowTree, Source={StaticResource Locator}}">
|
||||
|
||||
<mah:MetroContentControl Margin="0,0,60,0">
|
||||
<ctrl:SidebarTreeView DataContext="{Binding LogDashboard, Source={StaticResource LogDashLocator}}" />
|
||||
</mah:MetroContentControl>
|
||||
|
||||
</mah:Flyout>
|
||||
|
||||
</mah:FlyoutsControl>
|
||||
|
||||
</mah:MetroWindow.Flyouts>
|
||||
|
||||
<Grid>
|
||||
<mah:MetroContentControl>
|
||||
<ctrl:LogDashboardCtrl DataContext="{Binding LogDashboard, Source={StaticResource Locator}}" />
|
||||
</mah:MetroContentControl>
|
||||
</Grid>
|
||||
|
||||
</mah:MetroWindow>
|
||||
|
||||
|
||||
|
||||
212
Source/LogDashboard.UI/View/MainWindow.xaml.cs
Normal file
212
Source/LogDashboard.UI/View/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
//******************************************************************************//
|
||||
// MainWindow.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Forms;
|
||||
using NLog;
|
||||
using Raytheon.LogDashboard.Helpers;
|
||||
using Raytheon.LogDashboard.ViewModel;
|
||||
using Application = System.Windows.Application;
|
||||
using Raytheon.LogDashboard.Resources;
|
||||
using MahApps.Metro.Controls;
|
||||
using MahApps.Metro.Controls.Dialogs;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Raytheon.LogDashboard.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : MetroWindow, IDisposable
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
private NotifyIcon trayIcon;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Loaded += (s, e) =>
|
||||
{
|
||||
WindowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle;
|
||||
HwndSource.FromHwnd(WindowHandle)?.AddHook(HandleMessages);
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On Loaded Event
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AppDomain.CurrentDomain.SetupInformation.ActivationArguments?.ActivationData != null)
|
||||
{
|
||||
string[] activationData = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData;
|
||||
foreach (var arg in activationData.Where(x => x.EndsWith(".txt") || x.EndsWith(".log") || x.EndsWith(".csv")))
|
||||
{
|
||||
ViewModelLocator.LogDashboard.ImportLogs(arg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
List<string> args = Environment.GetCommandLineArgs().Where(x => x.EndsWith(".txt") || x.EndsWith(".log") || x.EndsWith(".csv")).ToList();
|
||||
if (args.Any())
|
||||
{
|
||||
ViewModelLocator.LogDashboard.ImportLogs(args.Where(x => x.EndsWith(".txt") || x.EndsWith(".log") || x.EndsWith(".csv")));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#region tray
|
||||
|
||||
protected override void OnStateChanged(EventArgs e)
|
||||
{
|
||||
if (WindowState == WindowState.Minimized && Model.Settings.Instance.MinimizeToTray)
|
||||
{
|
||||
if (trayIcon == null)
|
||||
{
|
||||
trayIcon = new NotifyIcon
|
||||
{
|
||||
Icon = Resource1.LogDashboard,
|
||||
Visible = true,
|
||||
Text = "Log Viewer"
|
||||
};
|
||||
trayIcon.DoubleClick += delegate
|
||||
{
|
||||
Show();
|
||||
WindowState = WindowState.Normal;
|
||||
};
|
||||
|
||||
trayIcon.ContextMenuStrip = new ContextMenuStrip();
|
||||
ToolStripMenuItem openAppMenuItem = new ToolStripMenuItem("Open");
|
||||
ToolStripMenuItem exitAppMenuItem = new ToolStripMenuItem("Exit");
|
||||
|
||||
trayIcon.ContextMenuStrip.Items.AddRange(new ToolStripItem[] { openAppMenuItem, exitAppMenuItem });
|
||||
trayIcon.ContextMenuStrip.ItemClicked += TrayIconContextMenuClick;
|
||||
}
|
||||
Hide();
|
||||
}
|
||||
|
||||
base.OnStateChanged(e);
|
||||
}
|
||||
|
||||
private void TrayIconContextMenuClick(object sender, ToolStripItemClickedEventArgs e)
|
||||
{
|
||||
switch (e.ClickedItem.Text)
|
||||
{
|
||||
case "Open":
|
||||
Show();
|
||||
WindowState = WindowState.Normal;
|
||||
break;
|
||||
case "Exit":
|
||||
Close();
|
||||
Environment.Exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (trayIcon != null)
|
||||
{
|
||||
trayIcon.Visible = false;
|
||||
trayIcon.Dispose();
|
||||
trayIcon.Icon = null;
|
||||
}
|
||||
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region param transfer
|
||||
|
||||
public static IntPtr WindowHandle { get; private set; }
|
||||
|
||||
internal static void HandleParameter(string[] args)
|
||||
{
|
||||
if (Application.Current?.MainWindow is MainWindow mainWindow &&
|
||||
args != null && args.Length > 0 && args.All(x => x.EndsWith(".txt") || x.EndsWith(".log") || x.EndsWith(".csv")))
|
||||
{
|
||||
ViewModelLocator.LogDashboard.ImportLogs(args.First());
|
||||
}
|
||||
}
|
||||
|
||||
private static IntPtr HandleMessages(IntPtr handle, int message, IntPtr wParameter, IntPtr lParameter, ref Boolean handled)
|
||||
{
|
||||
string data = UnsafeNative.GetMessage(message, lParameter);
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
if(Application.Current.MainWindow == null)
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
if(Application.Current.MainWindow.WindowState == WindowState.Minimized)
|
||||
{
|
||||
Application.Current.MainWindow.WindowState = WindowState.Normal;
|
||||
}
|
||||
|
||||
UnsafeNative.SetForegroundWindow(new WindowInteropHelper(Application.Current.MainWindow).Handle);
|
||||
|
||||
string[] args = data.Split(' ');
|
||||
HandleParameter(args);
|
||||
handled = true;
|
||||
}
|
||||
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
trayIcon?.Dispose();
|
||||
}
|
||||
|
||||
private void MetroWindow_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
ViewModelLocator.LogDashboard.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
167
Source/LogDashboard.UI/ViewModel/MainWindowViewModel.cs
Normal file
167
Source/LogDashboard.UI/ViewModel/MainWindowViewModel.cs
Normal file
@@ -0,0 +1,167 @@
|
||||
//******************************************************************************//
|
||||
// MainWindowViewModel.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using ControlzEx.Theming;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using MahApps.Metro.Controls.Dialogs;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Raytheon.LogDashboard.ViewModel
|
||||
{
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
protected static LogDashViewModelLocator LocatorInstance;
|
||||
private IDialogCoordinator _dialogCoordinator;
|
||||
|
||||
public MainWindowViewModel(IDialogCoordinator instance)
|
||||
{
|
||||
_dialogCoordinator = instance;
|
||||
|
||||
Messenger.Default.Register<string>(this, "ColorChange", ColorChangeHandler);
|
||||
Messenger.Default.Register<string>(this, "ThemeChange", ThemeChangeHandler);
|
||||
|
||||
Messenger.Default.Register<string>(this, "DisplayCustomMessage", DisplayCustomMessageHandler);
|
||||
|
||||
LocatorInstance = (Application.Current.Resources["LogDashLocator"] as LogDashViewModelLocator);
|
||||
}
|
||||
|
||||
private void ThemeChangeHandler(string theme)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(theme))
|
||||
{
|
||||
if(theme.Contains("Dark"))
|
||||
{
|
||||
ThemeManager.Current.ChangeThemeBaseColor(Application.Current.MainWindow, "Dark");
|
||||
}
|
||||
else
|
||||
{
|
||||
ThemeManager.Current.ChangeThemeBaseColor(Application.Current.MainWindow, "Light");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ColorChangeHandler(string selectedColor)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(selectedColor) && Application.Current.MainWindow != null)
|
||||
{
|
||||
ThemeManager.Current.ChangeThemeColorScheme(Application.Current.MainWindow, selectedColor);
|
||||
|
||||
Application.Current.Resources["MahApps.Brushes.ToggleSwitch.FillOn"] = ColorConverter.ConvertFromString(selectedColor);
|
||||
|
||||
RaisePropertyChanged(() => IconColor);
|
||||
}
|
||||
}
|
||||
|
||||
public SolidColorBrush IconColor
|
||||
{
|
||||
get => LocatorInstance.SelectedColorTheme.Color;
|
||||
}
|
||||
|
||||
public static double PreviousWindowHeight
|
||||
{
|
||||
get { return Properties.Settings.Default.PreviousWindowHeight; }
|
||||
set { Properties.Settings.Default.PreviousWindowHeight = value; }
|
||||
}
|
||||
public static double CurrentWindowHeight
|
||||
{
|
||||
get { return Properties.Settings.Default.CurrentWindowHeight; }
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.PreviousWindowHeight = Properties.Settings.Default.CurrentWindowHeight;
|
||||
Properties.Settings.Default.CurrentWindowHeight = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public static double PreviousWindowWidth
|
||||
{
|
||||
get { return Properties.Settings.Default.PreviousWindowWidth; }
|
||||
set { Properties.Settings.Default.PreviousWindowWidth = value; }
|
||||
}
|
||||
public static double CurrentWindowWidth
|
||||
{
|
||||
get { return Properties.Settings.Default.CurrentWindowWidth; }
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.PreviousWindowWidth = Properties.Settings.Default.CurrentWindowWidth;
|
||||
Properties.Settings.Default.CurrentWindowWidth = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public static double PreviousWindowLeft
|
||||
{
|
||||
get { return Properties.Settings.Default.PreviousWindowLeft; }
|
||||
set { Properties.Settings.Default.PreviousWindowLeft = value; }
|
||||
}
|
||||
public static double CurrentWindowLeft
|
||||
{
|
||||
get { return Properties.Settings.Default.CurrentWindowLeft; }
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.PreviousWindowLeft = Properties.Settings.Default.CurrentWindowLeft;
|
||||
Properties.Settings.Default.CurrentWindowLeft = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public static double PreviousWindowTop
|
||||
{
|
||||
get { return Properties.Settings.Default.PreviousWindowTop; }
|
||||
set { Properties.Settings.Default.PreviousWindowTop = value; }
|
||||
}
|
||||
public static double CurrentWindowTop
|
||||
{
|
||||
get { return Properties.Settings.Default.CurrentWindowTop; }
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.PreviousWindowTop = Properties.Settings.Default.CurrentWindowTop;
|
||||
Properties.Settings.Default.CurrentWindowTop = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// handles custom message with single Okay button
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
private async void DisplayCustomMessageHandler(string message)
|
||||
{
|
||||
await _dialogCoordinator.ShowMessageAsync(this, "Log Dashboard", message).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
58
Source/LogDashboard.UI/ViewModel/ViewModelLocator.cs
Normal file
58
Source/LogDashboard.UI/ViewModel/ViewModelLocator.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
//******************************************************************************//
|
||||
// ViewModelLocator.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
// Ignore Spelling: Locator
|
||||
|
||||
using CommonServiceLocator;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
using MahApps.Metro.Controls.Dialogs;
|
||||
|
||||
namespace Raytheon.LogDashboard.ViewModel
|
||||
{
|
||||
public class ViewModelLocator : ViewModelBase
|
||||
{
|
||||
public ViewModelLocator()
|
||||
{
|
||||
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
|
||||
|
||||
SimpleIoc.Default.Register(() => new MainWindowViewModel(DialogCoordinator.Instance));
|
||||
SimpleIoc.Default.Register<LogDashboardViewModel>();
|
||||
}
|
||||
public static MainWindowViewModel Main => ServiceLocator.Current.GetInstance<MainWindowViewModel>();
|
||||
public static LogDashboardViewModel LogDashboard => ServiceLocator.Current.GetInstance<LogDashboardViewModel>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user