Skip to content

Commit

Permalink
Report Window Processes Visual added, time on notifications added + R…
Browse files Browse the repository at this point in the history
…elease 1.1
  • Loading branch information
Zerumi committed Feb 14, 2021
1 parent fe99b74 commit 52fcc30
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 17 deletions.
7 changes: 6 additions & 1 deletion AMWE Administrator/AMWE Administrator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>amwe.ico</ApplicationIcon>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<ItemGroup>
<None Remove="cryptcode.txt" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>

Expand Down
14 changes: 14 additions & 0 deletions AMWE Administrator/AMWE Administrator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,35 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C7453E1D-DABD-4BA4-B965-6AC571E8CDAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7453E1D-DABD-4BA4-B965-6AC571E8CDAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7453E1D-DABD-4BA4-B965-6AC571E8CDAE}.Debug|x86.ActiveCfg = Debug|x86
{C7453E1D-DABD-4BA4-B965-6AC571E8CDAE}.Debug|x86.Build.0 = Debug|x86
{C7453E1D-DABD-4BA4-B965-6AC571E8CDAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7453E1D-DABD-4BA4-B965-6AC571E8CDAE}.Release|Any CPU.Build.0 = Release|Any CPU
{C7453E1D-DABD-4BA4-B965-6AC571E8CDAE}.Release|x86.ActiveCfg = Release|x86
{C7453E1D-DABD-4BA4-B965-6AC571E8CDAE}.Release|x86.Build.0 = Release|x86
{64695FBE-F7AA-4940-B62E-92C1ECB73A27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64695FBE-F7AA-4940-B62E-92C1ECB73A27}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64695FBE-F7AA-4940-B62E-92C1ECB73A27}.Debug|x86.ActiveCfg = Debug|x86
{64695FBE-F7AA-4940-B62E-92C1ECB73A27}.Debug|x86.Build.0 = Debug|x86
{64695FBE-F7AA-4940-B62E-92C1ECB73A27}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64695FBE-F7AA-4940-B62E-92C1ECB73A27}.Release|Any CPU.Build.0 = Release|Any CPU
{64695FBE-F7AA-4940-B62E-92C1ECB73A27}.Release|x86.ActiveCfg = Release|x86
{64695FBE-F7AA-4940-B62E-92C1ECB73A27}.Release|x86.Build.0 = Release|x86
{7344A154-D7A8-460A-B45F-45A778C56D46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7344A154-D7A8-460A-B45F-45A778C56D46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7344A154-D7A8-460A-B45F-45A778C56D46}.Debug|x86.ActiveCfg = Debug|x86
{7344A154-D7A8-460A-B45F-45A778C56D46}.Debug|x86.Build.0 = Debug|x86
{7344A154-D7A8-460A-B45F-45A778C56D46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7344A154-D7A8-460A-B45F-45A778C56D46}.Release|Any CPU.Build.0 = Release|Any CPU
{7344A154-D7A8-460A-B45F-45A778C56D46}.Release|x86.ActiveCfg = Release|x86
{7344A154-D7A8-460A-B45F-45A778C56D46}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
6 changes: 3 additions & 3 deletions AMWE Administrator/Chat.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ public Chat(HubConnection chatHubConnection, uint _ChatID, Client client)
ChatID = _ChatID;
Client = client;
InitializeComponent();
lbChatState.Content = $"Вы ведете чат с {client.Id}: {client.Nameofpc}{ChatID}";
lbChatState.Content = $"Вы ведете чат с ID {client.Id}: {client.Nameofpc}{ChatID}";
Grid.Background = App.MainColor;
ChatBox.Foreground = App.FontColor;
tbMessage.Background = App.SecondColor;
tbMessage.Foreground = App.FontColor;
lbChatState.Foreground = App.FontColor;
}

public void AddMessage(string Message)
public void AddMessage(DateTime timestamp, string user, string Message)
{
ChatBox.Text += $"{Message}\n";
ChatBox.Text += $"({timestamp.ToLongTimeString()}) {user}: {Message}\n";
}

private async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
Expand Down
1 change: 1 addition & 0 deletions AMWE Administrator/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<MenuItem x:Name="mWorkday" Header="Получение информации о рабочем дне..." IsEnabled="False" Click="MWorkday_Click"/>
</MenuItem>
<MenuItem Header="Диагностика">
<MenuItem x:Name="mConnect" Header="Подключено к: " IsEnabled="False"/>
<MenuItem Header="Посмотреть статусы подключения" Click="MenuDiagnostics_CheckConnectionState"/>
</MenuItem>
<MenuItem Header="Информация">
Expand Down
16 changes: 9 additions & 7 deletions AMWE Administrator/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public MainWindow()

#region Configure ChatSystem Connection
ChatSystemConnection.ServerTimeout = TimeSpan.FromDays(2);
ChatSystemConnection.On<uint, string>("ReceiveMessage", RecieveMessage);
ChatSystemConnection.On<uint, string, string, DateTime>("ReceiveMessage", RecieveMessage);
ChatSystemConnection.On<uint>("AcceptChatID", AcceptChat);
ChatSystemConnection.On<uint>("CloseDeleteChat", DeleteChat);
ChatSystemConnection.Closed += async (error) =>
Expand Down Expand Up @@ -148,7 +148,9 @@ public MainWindow()

InitializeComponent();

foreach(var obj in WinHelper.FindVisualChildren<Label>(Grid))
mConnect.Header = $"Подключено к {App.ServerAddress}";

foreach (var obj in WinHelper.FindVisualChildren<Label>(Grid))
{
obj.Foreground = App.FontColor;
}
Expand All @@ -171,10 +173,10 @@ private async void DeleteChat(uint id)
chats.Remove(chat);
}

private void RecieveMessage(uint id, string message)
private void RecieveMessage(uint id, string message, string user, DateTime timestamp)
{
var chat = chats.Find(x => x.ChatID == id);
chat.Dispatcher.BeginInvoke((Action)(() => chat.AddMessage(message)));
chat.Dispatcher.BeginInvoke((Action)(() => chat.AddMessage(timestamp, user, message)));
}

private void AcceptChat(uint id)
Expand Down Expand Up @@ -364,7 +366,7 @@ await Dispatcher.BeginInvoke((Action)(async() => {
chats.Add(chat);
TextBlock textBlock = new TextBlock()
{
Text = $"Мы ожидаем ответа на открытие чата от {id} / {client.Nameofpc}",
Text = $"({DateTime.Now.ToShortTimeString()}) Мы ожидаем ответа на открытие чата от {id} / {client.Nameofpc}",
Foreground = App.FontColor
};
textBlock.MouseEnter += Notification_GotMouseCapture;
Expand Down Expand Up @@ -505,7 +507,7 @@ private void PrintInfo(object sender, RoutedEventArgs e)
{
try
{
MessageBox.Show($"Assistant in Monitoring the Work of Employees Administrator\nVersion 1.0.2020.1312\nAMWE RealTime server version 1.0.2020.1312\nMade by Zerumi (Discord: Zerumi#4666)\nGitHub: https://github.com/Zerumi");
MessageBox.Show($"Assistant in Monitoring the Work of Employees Administrator\nVersion 1.1.2021.1402\nAMWE RealTime server version 1.0.2020.1312\nMade by Zerumi (Discord: Zerumi#4666)\nGitHub: https://github.com/Zerumi");
}
catch (Exception ex)
{
Expand Down Expand Up @@ -554,7 +556,7 @@ await Dispatcher.BeginInvoke((Action)(async() =>
{
textBlock = new TextBlock()
{
Text = "Всем клиентам сейчас сообщено что собирать и отправлять отчеты бесполезно и не нужно. Запустите рабочий день, чтобы начать сбор отчетов.",
Text = $"({DateTime.Now.ToShortTimeString()}) Всем клиентам сейчас сообщено что собирать и отправлять отчеты бесполезно и не нужно. Запустите рабочий день, чтобы начать сбор отчетов.",
Foreground = App.FontColor
};
textBlock.MouseEnter += Notification_GotMouseCapture;
Expand Down
4 changes: 2 additions & 2 deletions AMWE Administrator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2020.1312")]
[assembly: AssemblyFileVersion("1.0.2020.1312")]
[assembly: AssemblyVersion("1.1.2020.1312")]
[assembly: AssemblyFileVersion("1.1.2020.1312")]
41 changes: 39 additions & 2 deletions AMWE Administrator/ReportWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
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:local="clr-namespace:AMWE_Administrator"
mc:Ignorable="d"
Title="Информация об отчете" Height="400" Width="1000" ResizeMode="CanMinimize">
<Grid x:Name="Grid" Background="{DynamicResource {x:Static SystemColors.InfoBrushKey}}">
Expand Down Expand Up @@ -293,7 +292,45 @@
</TabItem.Header>
<TabItem.Content>
<Grid x:Name="gProcesses" Margin="10">

<Label x:Name="gpOverallInfo" Content="Количество измененных процессов: {x}" Margin="10,10,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="Список измененных процессов:" Margin="10,36,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<ScrollViewer Margin="10,62,10,10">
<Grid Margin="5">
<Label Content="Прошлый отчет:" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<TextBlock x:Name="tbLast" Text="123" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,31,0,0" Width="230"/>
<Label Content="Изменения:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="245,0,0,0"/>
<TextBlock x:Name="tbChanges" Text="123" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="245,31,0,0" Width="230"/>
<Label Content="Текущий отчет:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="480,0,0,0"/>
<TextBlock x:Name="tbCurrent" Text="123" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="480,31,0,0" Width="230"/>
</Grid>
</ScrollViewer>
</Grid>
</TabItem.Content>
</TabItem>
<TabItem x:Name="GraphsTab" Visibility="Hidden">
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="3">Графики</TextBlock>
</StackPanel>
</TabItem.Header>
<TabItem.Content>
<Grid>
<Border BorderThickness="1" Margin="10,34,0,0" BorderBrush="Black" Height="120" VerticalAlignment="Top" HorizontalAlignment="Left" Width="250">
<Canvas x:Name="grOverall">
<Line X1="0" Y1="20" X2="124" Y2="38" Stroke="Green"/>
<Line X1="124" Y1="38" X2="249" Y2="20" Stroke="Green"/>
<Line X1="0" Y1="58" X2="249" Y2="58" Stroke="Green"/>
<Label Content="1" Margin="0,0,0,0" FontSize="8"/>
<Label Content="0,7" Margin="0,19,0,0" FontSize="8"/>
<Label Content="0,5" Margin="0,38,0,0" FontSize="8"/>
</Canvas>
</Border>
<Border BorderThickness="1" Margin="10,0,0,10" BorderBrush="Black" HorizontalAlignment="Left" Width="125" Height="80" VerticalAlignment="Bottom">
<Canvas/>
</Border>
<Border BorderThickness="1" Margin="150,0,0,10" BorderBrush="Black" HorizontalAlignment="Left" Width="125" Height="80" VerticalAlignment="Bottom">
<Canvas/>
</Border>
</Grid>
</TabItem.Content>
</TabItem>
Expand Down
22 changes: 21 additions & 1 deletion AMWE Administrator/ReportWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// (or by any other means, with saving authorship by Zerumi and PizhikCoder retained)
using ReportHandler;
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
Expand All @@ -21,7 +22,7 @@ public ReportWindow(Report report)
{
Report = report;
InitializeComponent();

Grid.Background = App.MainColor;
gKeyboard.Background = App.MainColor;

Expand Down Expand Up @@ -226,6 +227,25 @@ public ReportWindow(Report report)
{
sLastProcesses += $"\n{item}";
}

var added = report.LastProcesses.Except(report.OldProcesses).ToList();
var removed = report.OldProcesses.Except(report.LastProcesses).ToList();

string sChangesProcesses = "";
foreach (var item in added)
{
sChangesProcesses += $"+ {item}\n";
}
foreach (var item in removed)
{
sChangesProcesses += $"- {item}\n";
}

gpOverallInfo.Content = $"Количество измененных процессов: {report.ProcessChangedCount}";
tbLast.Text = sOldProcesses.Remove(0,1);
tbCurrent.Text = sLastProcesses.Remove(0,1);
tbChanges.Text = sChangesProcesses;

ReportOutput.Text = $"Вердикт нейросети клиента: {report.OverallRating}\nВердикт по клавиатуре: {report.KeyBoardRating}\nВердикт по мышке: {report.MouseRating}\nВердикт по процессам: {report.ProcessRating}\n--------------------------------\nИнформация по нажатым клавишам:{sKeyPressedInfo}\n{(report.isMouseCoordChanged? "Замечено движение курсора" : "Движение курсора не было замечено")}\nИнформация по активным приложениям:{sLastProcesses}\nПо сравнению с первоначальными замерами, изменилось {report.ProcessChangedCount} процессов (список:){sOldProcesses}\nОтчет подготовлен AMWE Client'ом компьютера {report.Client.Nameofpc} и обработан AMWE Administrator для {App.Username}\n{DateTime.Now} по локальному времени";
}
}
Expand Down
5 changes: 4 additions & 1 deletion AMWE RealTime Server/Hubs/UserToAdminChatHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,21 @@ public async Task SendMessageToChat(uint ChatID, string Message)
{
_logger.LogInformation($"Отправлено сообщение в чат {ChatID} от {Context.User.Identity.Name} // {Message}");
var chat = chatStates.Find(x => x.ID == ChatID);
string user;
bool check;
try
{
check = uint.Parse(Context.User.Identity.Name.GetUntilOrEmpty("/").Substring(3)) == chat.User.Id;
user = chat.User.Nameofpc;
}
catch (Exception)
{
check = Context.ConnectionId == chat.AdminConnectionID;
user = Context.User.Identity.Name;
}
if (chat.IsAccepted && check)
{
await Clients.Group($"Chat {ChatID}").SendAsync("ReceiveMessage", ChatID, Message);
await Clients.Group($"Chat {ChatID}").SendAsync("ReceiveMessage", ChatID, Message, user, DateTime.Now);
}
}

Expand Down
1 change: 1 addition & 0 deletions ReportHandler/ReportHandler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<AssemblyName>ReportHandler</AssemblyName>
<TargetFramework>net5.0-windows</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>

</Project>
1 change: 1 addition & 0 deletions m3md2/m3md2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<TargetFramework>net5.0-windows</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 52fcc30

Please sign in to comment.