Skip to content

Commit

Permalink
Settings apply added, tray icon added color themes added, timeout bug…
Browse files Browse the repository at this point in the history
… fixed
  • Loading branch information
Zerumi committed Dec 3, 2020
1 parent 07c743d commit 2eee029
Show file tree
Hide file tree
Showing 36 changed files with 298 additions and 339 deletions.
15 changes: 0 additions & 15 deletions AMWE Administrator/AMWE Administrator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,4 @@
<EmbeddedResource Include="cryptcode.txt" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>

</Project>
35 changes: 4 additions & 31 deletions AMWE Administrator/App.config
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="AMWE_Administrator.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System.Configuration.ConfigurationManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" >
<section name="AMWE_Administrator.Properties.Settings" type="System.Configuration.ClientSettingsSection, System.Configuration.ConfigurationManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<appSettings>
<add key="MainUri" value="http://amwe-server.glitch.me/" />
<add key="WebSocketsOnly" value="True"/>
<add key="Expect100Continue" value="True"/>
<add key="ColorTheme" value="Standart"/>
<add key="MinimizeToTray" value="True"/>
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
Expand Down Expand Up @@ -70,24 +63,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<applicationSettings>
<AMWE_Administrator.Properties.Settings>
<setting name="WebSocketOnly" serializeAs="String">
<value>True</value>
</setting>
<setting name="MoveToTray" serializeAs="String">
<value>True</value>
</setting>
<setting name="ColorTheme" serializeAs="String">
<value>Standart</value>
</setting>
</AMWE_Administrator.Properties.Settings>
</applicationSettings>
<userSettings>
<AMWE_Administrator.Properties.Settings>
<setting name="Expect100Continue" serializeAs="String">
<value>True</value>
</setting>
</AMWE_Administrator.Properties.Settings>
</userSettings>
</configuration>
20 changes: 14 additions & 6 deletions AMWE Administrator/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
// This code & software is licensed under the Creative Commons license. You can't use AMWE trademark
// You can use & improve this code by keeping this comments
// (or by any other means, with saving authorship by Zerumi and PizhikCoder retained)
using m3md2;
using ReportHandler;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;

namespace AMWE_Administrator
{
Expand All @@ -19,16 +16,27 @@ namespace AMWE_Administrator
/// </summary>
public partial class App : Application
{

#pragma warning disable CA2211 // Поля, не являющиеся константами, не должны быть видимыми
public static Cookie AuthCookie;
public static string ServerAddress { get; set; }
public static string Username { get; set; }
public static List<Report> reports = new List<Report>();
public static DateTime ServerDateTime;

public static IEnumerable<string> ColorThemes = m3md2.ColorThemes.GetColorNames();
public static Color[] colors = m3md2.ColorThemes.GetColors(ConfigurationRequest.GetValueByKey("ColorTheme"));
public static SolidColorBrush MainColor = new SolidColorBrush(App.colors[(int)ColorIndex.Main]);
public static SolidColorBrush SecondColor = new SolidColorBrush(App.colors[(int)ColorIndex.Second]);
public static SolidColorBrush FontColor = new SolidColorBrush(App.colors[(int)ColorIndex.Font]);
public static SolidColorBrush ExtraColor = new SolidColorBrush(App.colors[(int)ColorIndex.Extra]);
public static SolidColorBrush GreenColor = new SolidColorBrush(App.colors[(int)ColorIndex.Green]);
public static SolidColorBrush RedColor = new SolidColorBrush(App.colors[(int)ColorIndex.Red]);
#pragma warning restore CA2211 // Поля, не являющиеся константами, не должны быть видимыми

private void Application_Startup(object sender, StartupEventArgs e)
{

ServicePointManager.Expect100Continue = bool.Parse(ConfigurationRequest.GetValueByKey("Expect100Continue"));
}
}
}
10 changes: 5 additions & 5 deletions AMWE Administrator/AuthWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Login" Height="226" Width="270" Loaded="Window_Loaded">
Title="Login" Height="226" Width="270" Loaded="Window_Loaded" ResizeMode="NoResize">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
Expand All @@ -16,14 +16,14 @@
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="Enter server address:" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="0"/>
<TextBlock Text="Введите адрес сервера:" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="0"/>
<TextBox x:Name="ServerTextBox" HorizontalAlignment="Stretch" VerticalAlignment="Center" KeyDown="Field_KeyDown" Grid.Row="1"/>
<TextBlock Text="Enter username:" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="2"/>
<TextBlock Text="Введите отображаемое имя:" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="2"/>
<TextBox x:Name="UsernameTextBox" HorizontalAlignment="Stretch" VerticalAlignment="Center" KeyDown="Field_KeyDown" Grid.Row="3"/>
<TextBlock Text="Enter admin password:" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="4"/>
<TextBlock Text="Введите пароль администратора:" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="4"/>
<TextBox x:Name="sResponseTextBox" HorizontalAlignment="Stretch" VerticalAlignment="Center" KeyDown="Field_KeyDown" Grid.Row="5" Visibility="Collapsed"/>
<PasswordBox x:Name="ResponseTextBox" HorizontalAlignment="Stretch" VerticalAlignment="Center" KeyDown="Field_KeyDown" Grid.Row="5"/>
<Button x:Name="AuthButton" Content="OK" HorizontalAlignment="Stretch" VerticalAlignment="Center" Click="OKButton_Click" Grid.Row="6"/>
<CheckBox x:Name="cbShow" Content="Show letters" HorizontalAlignment="Stretch" VerticalAlignment="Center" IsChecked="False" Checked="CheckBox_Checked" Unchecked="CbShow_Unchecked" Grid.Row="7"/>
<CheckBox x:Name="cbShow" Content="Показывать символы" HorizontalAlignment="Stretch" VerticalAlignment="Center" IsChecked="False" Checked="CheckBox_Checked" Unchecked="CbShow_Unchecked" Grid.Row="7"/>
</Grid>
</Window>
3 changes: 0 additions & 3 deletions AMWE Administrator/ConfigurationRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
// You can use & improve this code by keeping this comments
// (or by any other means, with saving authorship by Zerumi and PizhikCoder retained)
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AMWE_Administrator
{
Expand Down
12 changes: 1 addition & 11 deletions AMWE Administrator/DeveloperControlPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,12 @@
using ReportHandler.Version;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace AMWE_Administrator
{
Expand All @@ -30,7 +20,7 @@ namespace AMWE_Administrator
public partial class DeveloperControlPanel : Window
{
readonly string[] FilesPath;
HubConnection connection;
readonly HubConnection connection;

public DeveloperControlPanel()
{
Expand Down
2 changes: 1 addition & 1 deletion AMWE Administrator/Encryption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private static string loadcode()
}
return code;
}
private static string passPhrase = loadcode();
private static readonly string passPhrase = loadcode();

// This constant is used to determine the keysize of the encryption algorithm in bits.
// We divide this by 8 within the code below to get the equivalent number of bytes.
Expand Down
5 changes: 0 additions & 5 deletions AMWE Administrator/ExceptionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
// You can use & improve this code by keeping this comments
// (or by any other means, with saving authorship by Zerumi and PizhikCoder retained)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace AMWE_Administrator
Expand Down
6 changes: 3 additions & 3 deletions AMWE Administrator/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:AMWE_Administrator"
mc:Ignorable="d"
Title="AMWE Server UI by Zerumi" Height="450" Width="420" Closed="Main_Closed">
Title="AMWE Server UI by Zerumi" Height="450" Width="420" Closing="Main_Closing" Closed="Main_Closed">
<Grid ShowGridLines="False" x:Name="Grid" Background="{DynamicResource {x:Static SystemColors.InfoBrushKey}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="160"/>
Expand All @@ -21,12 +21,12 @@
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" HorizontalAlignment="Left" Margin="20,26,0,15" Grid.Row="2" Width="138">
<StackPanel x:Name="ClientList"/>
</ScrollViewer>
<Menu HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,-0.4,31" Grid.ColumnSpan="2" Grid.RowSpan="2">
<Menu x:Name="mwMenu" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,-0.4,31" Grid.ColumnSpan="2" Grid.RowSpan="2">
<MenuItem Header="Управление">
<MenuItem Header="Настройки" Click="MenuManage_Settings_Click"/>
<MenuItem Header="Открыть в проводнике" Click="MenuManage_OpenAtExplorer_Click"/>
<MenuItem Header="Сменить адрес" Click="MenuManage_ChangeServer_Click"/>
<MenuItem x:Name="mWorkday" Header="Получение информации о рабочем дне..." IsEnabled="False" Click="mWorkday_Click"/>
<MenuItem x:Name="mWorkday" Header="Получение информации о рабочем дне..." IsEnabled="False" Click="MWorkday_Click"/>
</MenuItem>
<MenuItem Header="Диагностика">
<MenuItem Header="Посмотреть статусы подключения" Click="MenuDiagnostics_CheckConnectionState"/>
Expand Down
Loading

0 comments on commit 2eee029

Please sign in to comment.