add resharper and hover effect for modules; change navigation bar

This commit is contained in:
Rene Schwarz
2021-08-10 02:03:11 +02:00
parent cdb86331e5
commit 910383775b
64 changed files with 792 additions and 832 deletions

Binary file not shown.

View File

@@ -6,13 +6,14 @@ using System.Text;
using System.Threading.Tasks;
namespace Server_Dashboard_Socket {
/// <summary>
/// Client Socket
/// </summary>
/// <typeparam name="TProtocol">The Protocol type, either JsonMessageProtocol or XmlMessageProtocol</typeparam>
/// <typeparam name="TMessageType">The message type, either JObject or XDocument</typeparam>
public class ClientChannel<TProtocol, TMessageType> : SocketChannel<TProtocol, TMessageType>
where TProtocol : Protocol<TMessageType>, new(){
where TProtocol : Protocol<TMessageType>, new() {
/// <summary>
/// Connect to the socket async

View File

@@ -6,6 +6,7 @@ using System.Threading;
using System.Threading.Tasks;
namespace Server_Dashboard_Socket {
/// <summary>
/// Generic Channel class that handles the connection and message sending / receiving
/// Inherits IDisposable to correctly cut the connection to the server
@@ -14,13 +15,12 @@ namespace Server_Dashboard_Socket {
/// <typeparam name="TMessageType">The message type, either JObject or XDocument</typeparam>
public abstract class SocketChannel<TProtocol, TMessageType> : IDisposable
where TProtocol : Protocol<TMessageType>, new() {
protected bool isDisposable = false;
NetworkStream networkStream;
readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
readonly TProtocol protocol = new TProtocol();
private NetworkStream networkStream;
private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
private readonly TProtocol protocol = new TProtocol();
Func<TMessageType, Task> messageCallback;
private Func<TMessageType, Task> messageCallback;
/// <summary>
/// Attaches the socket to a network stream that owns the socket
@@ -69,10 +69,12 @@ namespace Server_Dashboard_Socket {
/// Deconstructor sets Dispose to false
/// </summary>
~SocketChannel() => Dispose(false);
/// <summary>
/// Sets dispose to true
/// </summary>
public void Dispose() => Dispose(true);
/// <summary>
/// Disposes open sockets
/// </summary>
@@ -86,7 +88,7 @@ namespace Server_Dashboard_Socket {
Close();
//If its closed, dispose it
networkStream?.Dispose();
//Wait with the garbage collection untill the disposing is done
//Wait with the garbage collection until the disposing is done
if (isDisposing)
GC.SuppressFinalize(this);
}

View File

@@ -11,6 +11,7 @@ using Newtonsoft.Json.Linq;
using System.Xml.Linq;
namespace Server_Dashboard_Socket {
public class SocketClient {
public SocketClient() {
@@ -22,7 +23,7 @@ namespace Server_Dashboard_Socket {
}
private async void Start() {
//Creates a new endpoint with the IP adress and port
//Creates a new endpoint with the IP address and port
var endpoint = new IPEndPoint(IPAddress.Loopback, 9000);
//Creates a new Channel for the Json protocol
@@ -50,16 +51,17 @@ namespace Server_Dashboard_Socket {
/// </summary>
/// <param name="jobject">The json to be converted back</param>
/// <returns>Task completed</returns>
static Task OnMessage(JObject jobject) {
private static Task OnMessage(JObject jobject) {
Console.WriteLine(Convert(jobject));
return Task.CompletedTask;
}
/// <summary>
/// When it receives a message it gets converted from XDocument back to MyMessage
/// </summary>
/// <param name="xDocument">The xml to be converted back</param>
/// <returns>Task completed</returns>
static Task OnMessage(XDocument xDocument) {
private static Task OnMessage(XDocument xDocument) {
Console.WriteLine(Convert(xDocument));
return Task.CompletedTask;
}
@@ -69,14 +71,14 @@ namespace Server_Dashboard_Socket {
/// </summary>
/// <param name="jObject">The json to be converted</param>
/// <returns>MyMessage object</returns>
static MyMessage Convert(JObject jObject) => jObject.ToObject(typeof(MyMessage)) as MyMessage;
private static MyMessage Convert(JObject jObject) => jObject.ToObject(typeof(MyMessage)) as MyMessage;
/// <summary>
/// Converts XDocument to MyMessage
/// </summary>
/// <param name="xmlDocument">The xml to be converted</param>
/// <returns>MyMessage object</returns>
static MyMessage Convert(XDocument xmlDocument) => new XmlSerializer(typeof(MyMessage)).Deserialize(new StringReader(xmlDocument.ToString())) as MyMessage;
private static MyMessage Convert(XDocument xmlDocument) => new XmlSerializer(typeof(MyMessage)).Deserialize(new StringReader(xmlDocument.ToString())) as MyMessage;
}
/// <summary>

View File

@@ -4,10 +4,12 @@ using System.Net.Sockets;
using System.Threading.Tasks;
namespace Server_Dashboard_Socket {
/// <summary>
/// Basic echo server to test the socket connection
/// </summary>
public class EchoServer {
/// <summary>
/// Start the socket on 127.0.0.1:9000
/// </summary>
@@ -32,25 +34,24 @@ namespace Server_Dashboard_Socket {
/// <returns>poop</returns>
private async Task DoEcho(Socket socket) {
while (true) {
//Listen for incomming connection requests and accept them
//Listen for incoming connection requests and accept them
Socket clientSocket = await Task.Factory.FromAsync(
new Func<AsyncCallback, object, IAsyncResult>(socket.BeginAccept),
new Func<IAsyncResult, Socket>(socket.EndAccept),
null).ConfigureAwait(false);
//Create a network stream and make it the owner of the socket
//This will close the socket if the stream is closed and vice verca
using(NetworkStream stream = new NetworkStream(clientSocket, true)) {
//New buffer for the message in bytes
byte[] buffer = new byte[1024];
while (true) {
//Read everything that somes in
int bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false);
//If its 0 just leave since its a obscolete connection
if (bytesRead == 0)
break;
//Send it back to the sender
await stream.WriteAsync(buffer, 0, bytesRead).ConfigureAwait(false);
}
await using NetworkStream stream = new NetworkStream(clientSocket, true);
//New buffer for the message in bytes
byte[] buffer = new byte[1024];
while (true) {
//Read everything that comes in
int bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false);
//If its 0 just leave since its a obsolete connection
if (bytesRead == 0)
break;
//Send it back to the sender
await stream.WriteAsync(buffer, 0, bytesRead).ConfigureAwait(false);
}
}
}

View File

@@ -7,21 +7,21 @@ using System.IO;
using System.Text;
namespace Server_Dashboard_Socket.Protocol {
/// <summary>
/// Json serializer class
/// </summary>
public class JsonMessageProtocol : Protocol<JObject> {
//The Json serializer and the settings
static readonly JsonSerializer serializer;
static readonly JsonSerializerSettings settings;
private static readonly JsonSerializer serializer;
/// <summary>
/// Settings for the Json Serializer
/// </summary>
static JsonMessageProtocol() {
//Set the settings
settings = new JsonSerializerSettings {
JsonSerializerSettings settings = new JsonSerializerSettings {
Formatting = Formatting.Indented,
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
ContractResolver = new DefaultContractResolver {
@@ -34,6 +34,7 @@ namespace Server_Dashboard_Socket.Protocol {
//Creates the serializer with the settings
serializer = JsonSerializer.Create(settings);
}
//Decode the message, to Json
protected override JObject Decode(byte[] message) => JObject.Parse(Encoding.UTF8.GetString(message));

View File

@@ -6,13 +6,15 @@ using System.Text;
using System.Threading.Tasks;
namespace Server_Dashboard_Socket {
/// <summary>
/// Generic Protocol class for Json and Xml serialization
/// </summary>
/// <typeparam name="TMessageType">JsonMessageProtocol or XmlMessageProtocol</typeparam>
public abstract class Protocol<TMessageType> {
//Header size is always 4
const int HEADER_SIZE = 4;
private const int HeaderSize = 4;
/// <summary>
/// Gets the message and checks with the header if the message is valid or not
@@ -26,7 +28,7 @@ namespace Server_Dashboard_Socket {
//Validates the length
AssertValidMessageLength(bodyLength);
//Returns the body message type
return await Readbody(networkStream, bodyLength).ConfigureAwait(false);
return await ReadBody(networkStream, bodyLength).ConfigureAwait(false);
}
/// <summary>
@@ -50,8 +52,8 @@ namespace Server_Dashboard_Socket {
/// </summary>
/// <param name="networkStream">A network stream</param>
/// <returns>Header as Integer</returns>
async Task<int> ReadHeader(NetworkStream networkStream) {
byte[] headerBytes = await ReadAsync(networkStream, HEADER_SIZE).ConfigureAwait(false);
private async Task<int> ReadHeader(NetworkStream networkStream) {
byte[] headerBytes = await ReadAsync(networkStream, HeaderSize).ConfigureAwait(false);
return IPAddress.HostToNetworkOrder(BitConverter.ToInt32(headerBytes));
}
@@ -61,7 +63,7 @@ namespace Server_Dashboard_Socket {
/// <param name="networkStream">A network stream</param>
/// <param name="bodyLength">Length of the body</param>
/// <returns>Decoded body</returns>
async Task<TMessageType> Readbody(NetworkStream networkStream, int bodyLength) {
private async Task<TMessageType> ReadBody(NetworkStream networkStream, int bodyLength) {
//Reads the bytes from the stream into an array
byte[] bodyBytes = await ReadAsync(networkStream, bodyLength).ConfigureAwait(false);
//Decodes it and returns the string
@@ -74,13 +76,13 @@ namespace Server_Dashboard_Socket {
/// <param name="networkStream">A network stream</param>
/// <param name="bytesToRead">how many bytes there are to read</param>
/// <returns>Every byte from the Stream</returns>
async Task<byte[]> ReadAsync(NetworkStream networkStream, int bytesToRead) {
private async Task<byte[]> ReadAsync(NetworkStream networkStream, int bytesToRead) {
//new buffer that is as big as the content(watch out for buffer overflows)
byte[] buffer = new byte[bytesToRead];
//keep acount of the bytes that are already read
//keep account of the bytes that are already read
int bytesRead = 0;
//White we still have something to read
while(bytesRead < bytesToRead){
while (bytesRead < bytesToRead) {
//Read it from the stream
var bytesReceived = await networkStream.ReadAsync(buffer, bytesRead, (bytesToRead - bytesRead)).ConfigureAwait(false);
//If it happens to be 0 close the socket
@@ -94,7 +96,7 @@ namespace Server_Dashboard_Socket {
/// <summary>
/// Encode the message from human readable to bytes for the stream
/// </summary>
/// <typeparam name="T">The message as anything e.g. object or strng</typeparam>
/// <typeparam name="T">The message as anything e.g. object or string</typeparam>
/// <param name="message">The message to be send</param>
/// <returns>The Header and Body as bytes[]</returns>
protected (byte[] header, byte[] body) Encode<T>(T message) {
@@ -121,12 +123,13 @@ namespace Server_Dashboard_Socket {
if (messageLength < 1)
throw new ArgumentOutOfRangeException("Invalid message length");
}
/// <summary>
/// Encode the message so it can be send via the network stream
/// </summary>
/// <typeparam name="T">Message type e.g. object or string</typeparam>
/// <param name="message">The message to be send</param>
/// <returns></returns>
protected abstract byte[] EncodeBody<T> (T message);
protected abstract byte[] EncodeBody<T>(T message);
}
}

View File

@@ -9,15 +9,15 @@
<!--View Templates-->
<DataTemplate x:Key="MainDashboardView" DataType="{x:Type local:DashboardViewModel}">
<views:MainDashboardPage/>
<views:MainDashboardPage />
</DataTemplate>
<DataTemplate x:Key="CreateModuleView" DataType="{x:Type local:DashboardViewModel}">
<modulescrud:CreateModulePopup/>
<modulescrud:CreateModulePopup />
</DataTemplate>
<!--Visibility converter for the login inputs-->
<BooleanToVisibilityConverter x:Key="UserNameVisibillity"/>
<BooleanToVisibilityConverter x:Key="PasswordVisibillity"/>
<BooleanToVisibilityConverter x:Key="UserNameVisibillity" />
<BooleanToVisibilityConverter x:Key="PasswordVisibillity" />
<!--Fonts-->
<FontFamily x:Key="Fontstyle" >Open Sans</FontFamily>
@@ -41,87 +41,94 @@
Dragged = Overlay 8% + Shadow 08dp
-->
<!--Material Colors-->
<SolidColorBrush x:Key="BackgroundSurface_00dp" Color="#121212"/>
<SolidColorBrush x:Key="BackgroundSurface_01dp" Color="#1D1D1D"/>
<SolidColorBrush x:Key="BackgroundSurface_02dp" Color="#202020"/>
<SolidColorBrush x:Key="BackgroundSurface_03dp" Color="#252525"/>
<SolidColorBrush x:Key="BackgroundSurface_04dp" Color="#262626"/>
<SolidColorBrush x:Key="BackgroundSurface_06dp" Color="#2C2C2C"/>
<SolidColorBrush x:Key="BackgroundSurface_08dp" Color="#2D2D2D"/>
<SolidColorBrush x:Key="BackgroundSurface_12dp" Color="#323232"/>
<SolidColorBrush x:Key="BackgroundSurface_16dp" Color="#343434"/>
<SolidColorBrush x:Key="BackgroundSurface_24dp" Color="#363636"/>
<SolidColorBrush x:Key="OnPrimarySecondaryError" Color="#000000"/>
<SolidColorBrush x:Key="White" Color="#FFFFFFFF"/><!--0%-->
<SolidColorBrush x:Key="White12" Color="#1EFFFFFF"/><!--12%-->
<SolidColorBrush x:Key="White38" Color="#60FFFFFF"/><!--38%-->
<SolidColorBrush x:Key="White60" Color="#99FFFFFF"/><!--60%-->
<SolidColorBrush x:Key="White87" Color="#DEFFFFFF"/><!--87%-->
<SolidColorBrush x:Key="ErrorRed" Color="#CF6679"/>
<SolidColorBrush x:Key="BackgroundSurface_00dp" Color="#121212" />
<SolidColorBrush x:Key="BackgroundSurface_01dp" Color="#1D1D1D" />
<SolidColorBrush x:Key="BackgroundSurface_02dp" Color="#202020" />
<SolidColorBrush x:Key="BackgroundSurface_03dp" Color="#252525" />
<SolidColorBrush x:Key="BackgroundSurface_04dp" Color="#262626" />
<SolidColorBrush x:Key="BackgroundSurface_06dp" Color="#2C2C2C" />
<SolidColorBrush x:Key="BackgroundSurface_08dp" Color="#2D2D2D" />
<SolidColorBrush x:Key="BackgroundSurface_12dp" Color="#323232" />
<SolidColorBrush x:Key="BackgroundSurface_16dp" Color="#343434" />
<SolidColorBrush x:Key="BackgroundSurface_24dp" Color="#363636" />
<SolidColorBrush x:Key="OnPrimarySecondaryError" Color="#000000" />
<SolidColorBrush x:Key="White" Color="#FFFFFFFF" />
<!--0%-->
<SolidColorBrush x:Key="White12" Color="#1EFFFFFF" />
<!--12%-->
<SolidColorBrush x:Key="White38" Color="#60FFFFFF" />
<!--38%-->
<SolidColorBrush x:Key="White60" Color="#99FFFFFF" />
<!--60%-->
<SolidColorBrush x:Key="White87" Color="#DEFFFFFF" />
<!--87%-->
<SolidColorBrush x:Key="ErrorRed" Color="#CF6679" />
<!--Indigo-->
<SolidColorBrush x:Key="Indigo_50 " Color="#E8EAF6"/>
<SolidColorBrush x:Key="Indigo_100" Color="#C5CAE9"/>
<SolidColorBrush x:Key="Indigo_200" Color="#9FA8DA"/>
<SolidColorBrush x:Key="Indigo_300" Color="#7986CB"/>
<SolidColorBrush x:Key="Indigo_400" Color="#5C6BC0"/>
<SolidColorBrush x:Key="Indigo_500" Color="#3F51B5"/>
<SolidColorBrush x:Key="Indigo_600" Color="#3949AB"/>
<SolidColorBrush x:Key="Indigo_700" Color="#303F9F"/>
<SolidColorBrush x:Key="Indigo_800" Color="#283593"/>
<SolidColorBrush x:Key="Indigo_900" Color="#1A237E"/>
<SolidColorBrush x:Key="Indigo_A100" Color="#8C9EFF"/>
<SolidColorBrush x:Key="Indigo_A200" Color="#536DFE"/>
<SolidColorBrush x:Key="Indigo_A400" Color="#3D5AFE"/>
<SolidColorBrush x:Key="Indigo_A700" Color="#304FFE"/>
<SolidColorBrush x:Key="Indigo_50 " Color="#E8EAF6" />
<SolidColorBrush x:Key="Indigo_100" Color="#C5CAE9" />
<SolidColorBrush x:Key="Indigo_200" Color="#9FA8DA" />
<SolidColorBrush x:Key="Indigo_300" Color="#7986CB" />
<SolidColorBrush x:Key="Indigo_400" Color="#5C6BC0" />
<SolidColorBrush x:Key="Indigo_500" Color="#3F51B5" />
<SolidColorBrush x:Key="Indigo_600" Color="#3949AB" />
<SolidColorBrush x:Key="Indigo_700" Color="#303F9F" />
<SolidColorBrush x:Key="Indigo_800" Color="#283593" />
<SolidColorBrush x:Key="Indigo_900" Color="#1A237E" />
<SolidColorBrush x:Key="Indigo_A100" Color="#8C9EFF" />
<SolidColorBrush x:Key="Indigo_A200" Color="#536DFE" />
<SolidColorBrush x:Key="Indigo_A400" Color="#3D5AFE" />
<SolidColorBrush x:Key="Indigo_A700" Color="#304FFE" />
<!--Yellow-->
<SolidColorBrush x:Key="Yellow_50 " Color="#FFFDE7"/>
<SolidColorBrush x:Key="Yellow_100" Color="#FFF9C4"/>
<SolidColorBrush x:Key="Yellow_200" Color="#FFF59D"/>
<SolidColorBrush x:Key="Yellow_300" Color="#FFF176"/>
<SolidColorBrush x:Key="Yellow_400" Color="#FFEE58"/>
<SolidColorBrush x:Key="Yellow_500" Color="#FFEB3B"/>
<SolidColorBrush x:Key="Yellow_600" Color="#FDD835"/>
<SolidColorBrush x:Key="Yellow_700" Color="#FBC02D"/>
<SolidColorBrush x:Key="Yellow_800" Color="#F9A825"/>
<SolidColorBrush x:Key="Yellow_900" Color="#F57F17"/>
<SolidColorBrush x:Key="Yellow_A100" Color="#FFFF8D"/>
<SolidColorBrush x:Key="Yellow_A200" Color="#FFFF00"/>
<SolidColorBrush x:Key="Yellow_A400" Color="#FFEA00"/>
<SolidColorBrush x:Key="Yellow_A700" Color="#FFD600"/>
<SolidColorBrush x:Key="Yellow_50 " Color="#FFFDE7" />
<SolidColorBrush x:Key="Yellow_100" Color="#FFF9C4" />
<SolidColorBrush x:Key="Yellow_200" Color="#FFF59D" />
<SolidColorBrush x:Key="Yellow_300" Color="#FFF176" />
<SolidColorBrush x:Key="Yellow_400" Color="#FFEE58" />
<SolidColorBrush x:Key="Yellow_500" Color="#FFEB3B" />
<SolidColorBrush x:Key="Yellow_600" Color="#FDD835" />
<SolidColorBrush x:Key="Yellow_700" Color="#FBC02D" />
<SolidColorBrush x:Key="Yellow_800" Color="#F9A825" />
<SolidColorBrush x:Key="Yellow_900" Color="#F57F17" />
<SolidColorBrush x:Key="Yellow_A100" Color="#FFFF8D" />
<SolidColorBrush x:Key="Yellow_A200" Color="#FFFF00" />
<SolidColorBrush x:Key="Yellow_A400" Color="#FFEA00" />
<SolidColorBrush x:Key="Yellow_A700" Color="#FFD600" />
<!--Deep Purple-->
<SolidColorBrush x:Key="DeepPurple_50 " Color="#EDE7F6"/>
<SolidColorBrush x:Key="DeepPurple_100" Color="#D1C4E9"/>
<SolidColorBrush x:Key="DeepPurple_200" Color="#B39DDB"/><!--Primary-->
<SolidColorBrush x:Key="DeepPurple_300" Color="#9575CD"/>
<SolidColorBrush x:Key="DeepPurple_400" Color="#7E57C2"/>
<SolidColorBrush x:Key="DeepPurple_500" Color="#673AB7"/><!--Primary Variant-->
<SolidColorBrush x:Key="DeepPurple_600" Color="#5E35B1"/>
<SolidColorBrush x:Key="DeepPurple_700" Color="#512DA8"/>
<SolidColorBrush x:Key="DeepPurple_800" Color="#4527A0"/>
<SolidColorBrush x:Key="DeepPurple_900" Color="#311B92"/>
<SolidColorBrush x:Key="DeepPurple_A100" Color="#B388FF"/>
<SolidColorBrush x:Key="DeepPurple_A200" Color="#7C4DFF"/>
<SolidColorBrush x:Key="DeepPurple_A400" Color="#651FFF"/>
<SolidColorBrush x:Key="DeepPurple_A700" Color="#6200EA"/>
<SolidColorBrush x:Key="DeepPurple_50 " Color="#EDE7F6" />
<SolidColorBrush x:Key="DeepPurple_100" Color="#D1C4E9" />
<SolidColorBrush x:Key="DeepPurple_200" Color="#B39DDB" />
<!--Primary-->
<SolidColorBrush x:Key="DeepPurple_300" Color="#9575CD" />
<SolidColorBrush x:Key="DeepPurple_400" Color="#7E57C2" />
<SolidColorBrush x:Key="DeepPurple_500" Color="#673AB7" />
<!--Primary Variant-->
<SolidColorBrush x:Key="DeepPurple_600" Color="#5E35B1" />
<SolidColorBrush x:Key="DeepPurple_700" Color="#512DA8" />
<SolidColorBrush x:Key="DeepPurple_800" Color="#4527A0" />
<SolidColorBrush x:Key="DeepPurple_900" Color="#311B92" />
<SolidColorBrush x:Key="DeepPurple_A100" Color="#B388FF" />
<SolidColorBrush x:Key="DeepPurple_A200" Color="#7C4DFF" />
<SolidColorBrush x:Key="DeepPurple_A400" Color="#651FFF" />
<SolidColorBrush x:Key="DeepPurple_A700" Color="#6200EA" />
<!--Deep Purple-->
<SolidColorBrush x:Key="Teal_50 " Color="#E0F2F1"/>
<SolidColorBrush x:Key="Teal_100" Color="#B2DFDB"/>
<SolidColorBrush x:Key="Teal_200" Color="#80CBC4"/>
<SolidColorBrush x:Key="Teal_300" Color="#4DB6AC"/>
<SolidColorBrush x:Key="Teal_400" Color="#26A69A"/>
<SolidColorBrush x:Key="Teal_500" Color="#009688"/>
<SolidColorBrush x:Key="Teal_600" Color="#00897B"/>
<SolidColorBrush x:Key="Teal_700" Color="#00796B"/>
<SolidColorBrush x:Key="Teal_800" Color="#00695C"/>
<SolidColorBrush x:Key="Teal_900" Color="#004D40"/>
<SolidColorBrush x:Key="Teal_A100" Color="#A7FFEB"/>
<SolidColorBrush x:Key="Teal_A200" Color="#64FFDA"/>
<SolidColorBrush x:Key="Teal_A400" Color="#1DE9B6"/>
<SolidColorBrush x:Key="Teal_A700" Color="#00BFA5"/>
<SolidColorBrush x:Key="Teal_50 " Color="#E0F2F1" />
<SolidColorBrush x:Key="Teal_100" Color="#B2DFDB" />
<SolidColorBrush x:Key="Teal_200" Color="#80CBC4" />
<SolidColorBrush x:Key="Teal_300" Color="#4DB6AC" />
<SolidColorBrush x:Key="Teal_400" Color="#26A69A" />
<SolidColorBrush x:Key="Teal_500" Color="#009688" />
<SolidColorBrush x:Key="Teal_600" Color="#00897B" />
<SolidColorBrush x:Key="Teal_700" Color="#00796B" />
<SolidColorBrush x:Key="Teal_800" Color="#00695C" />
<SolidColorBrush x:Key="Teal_900" Color="#004D40" />
<SolidColorBrush x:Key="Teal_A100" Color="#A7FFEB" />
<SolidColorBrush x:Key="Teal_A200" Color="#64FFDA" />
<SolidColorBrush x:Key="Teal_A400" Color="#1DE9B6" />
<SolidColorBrush x:Key="Teal_A700" Color="#00BFA5" />
<!--#endregion-->
<!--=================-->
@@ -130,40 +137,40 @@
<!--Textblock default design-->
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="20"/>
<Setter Property="Foreground" Value="{StaticResource White}"/>
<Setter Property="FontFamily" Value="{StaticResource Fontstyle}"/>
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="{StaticResource White}" />
<Setter Property="FontFamily" Value="{StaticResource Fontstyle}" />
</Style>
<!--Button default design-->
<Style TargetType="{x:Type Button}">
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Background" Value="{StaticResource BackgroundSurface_01dp}"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontFamily" Value="{StaticResource Fontstyle}"/>
<Setter Property="Foreground" Value="{StaticResource DeepPurple_A100}"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="{StaticResource BackgroundSurface_01dp}" />
<Setter Property="FontSize" Value="20" />
<Setter Property="FontFamily" Value="{StaticResource Fontstyle}" />
<Setter Property="Foreground" Value="{StaticResource DeepPurple_A100}" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Border" CornerRadius="5" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0">
<Border.Effect>
<DropShadowEffect Direction="0" ShadowDepth="0" BlurRadius="5"/>
<DropShadowEffect Direction="0" ShadowDepth="0" BlurRadius="5" />
</Border.Effect>
<Border x:Name="BackgroundOverlay" CornerRadius="4" Background="Transparent" BorderThickness="{TemplateBinding BorderThickness}">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12"/>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock FontSize="{TemplateBinding FontSize}" TextAlignment="Center" Padding="0" TextWrapping="Wrap" Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock FontSize="{TemplateBinding FontSize}" TextAlignment="Center" Padding="0" TextWrapping="Wrap" Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Border>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="BackgroundOverlay" Property="Background">
<Setter.Value>
<SolidColorBrush Color="#B388FF" Opacity="0.04"/>
<SolidColorBrush Color="#B388FF" Opacity="0.04" />
</Setter.Value>
</Setter>
</Trigger>
@@ -172,12 +179,12 @@
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="BackgroundOverlay" Property="Background">
<Setter.Value>
<SolidColorBrush Color="#B388FF" Opacity="0.12"/>
<SolidColorBrush Color="#B388FF" Opacity="0.12" />
</Setter.Value>
</Setter>
<Setter TargetName="BackgroundOverlay" Property="BorderBrush">
<Setter.Value>
<SolidColorBrush Color="#B388FF" Opacity=".87"/>
<SolidColorBrush Color="#B388FF" Opacity=".87" />
</Setter.Value>
</Setter>
</Trigger>
@@ -191,61 +198,61 @@
<Style TargetType="{x:Type TextBox}">
<Setter Property="CaretBrush">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.64"/>
<SolidColorBrush Color="White" Opacity="0.64" />
</Setter.Value>
</Setter>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FontFamily" Value="{StaticResource Fontstyle}"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontFamily" Value="{StaticResource Fontstyle}" />
<Setter Property="FontSize" Value="20" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.64"/>
<SolidColorBrush Color="White" Opacity="0.64" />
</Setter.Value>
</Setter>
<Setter Property="Background" Value="{StaticResource BackgroundSurface_01dp}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="{StaticResource BackgroundSurface_01dp}" />
<Setter Property="BorderThickness" Value="0" />
</Style>
<!--Passwordbox default design-->
<Style TargetType="{x:Type PasswordBox}">
<Setter Property="PasswordChar" Value="*"/>
<Setter Property="PasswordChar" Value="*" />
<Setter Property="CaretBrush">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.64"/>
<SolidColorBrush Color="White" Opacity="0.64" />
</Setter.Value>
</Setter>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="FontSize" Value="20" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.64"/>
<SolidColorBrush Color="White" Opacity="0.64" />
</Setter.Value>
</Setter>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="BorderBrush">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.12"/>
<SolidColorBrush Color="White" Opacity="0.12" />
</Setter.Value>
</Setter>
<Setter Property="Background" Value="{StaticResource BackgroundSurface_01dp}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="{StaticResource BackgroundSurface_01dp}" />
<Setter Property="BorderThickness" Value="0" />
</Style>
<!--Checkbox default design-->
<Style TargetType="{x:Type CheckBox}">
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Foreground" Value="White" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Direction="0" ShadowDepth="0" BlurRadius="5"/>
<DropShadowEffect Direction="0" ShadowDepth="0" BlurRadius="5" />
</Setter.Value>
</Setter>
<Setter Property="Template">
@@ -259,11 +266,11 @@
</Border>
</Border>
</BulletDecorator.Bullet>
<ContentPresenter Margin="4,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" RecognizesAccessKey="True"/>
<ContentPresenter Margin="4,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" RecognizesAccessKey="True" />
</BulletDecorator>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="false">
<Setter TargetName="CheckMark" Property="Visibility" Value="Collapsed"/>
<Setter TargetName="CheckMark" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsChecked" Value="{x:Null}">
<Setter TargetName="CheckMark" Property="Data" Value="M 0 20 L 20 0" />
@@ -271,18 +278,18 @@
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="Background">
<Setter.Value>
<SolidColorBrush Color="#B388FF" Opacity="0.04"/>
<SolidColorBrush Color="#B388FF" Opacity="0.04" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="CheckMark" Property="Stroke" Value="#FF6C6C6C"/>
<Setter Property="Foreground" Value="Gray"/>
<Setter TargetName="CheckMark" Property="Stroke" Value="#FF6C6C6C" />
<Setter Property="Foreground" Value="Gray" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Border" Property="Background">
<Setter.Value>
<SolidColorBrush Color="#B388FF" Opacity="0.12"/>
<SolidColorBrush Color="#B388FF" Opacity="0.12" />
</Setter.Value>
</Setter>
</Trigger>
@@ -294,18 +301,18 @@
<!--Hyperlink default design-->
<Style TargetType="{x:Type Hyperlink}">
<Setter Property="TextDecorations" Value="None"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="TextDecorations" Value="None" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="#64FFDA" Opacity="0.64"/>
<SolidColorBrush Color="#64FFDA" Opacity="0.64" />
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="#64FFDA" Opacity="0.87"/>
<SolidColorBrush Color="#64FFDA" Opacity="0.87" />
</Setter.Value>
</Setter>
</Trigger>
@@ -314,14 +321,14 @@
<!--Border default design (Makes text rendering in it crystal clear)-->
<Style TargetType="Border">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="UseLayoutRounding" Value="True" />
</Style>
<!--Grid default design (Makes text rendering in it crystal clear)-->
<Style TargetType="Grid">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="UseLayoutRounding" Value="True" />
</Style>
<!--================-->
@@ -330,26 +337,26 @@
<!--Close button design-->
<Style x:Key="CloseButton" TargetType="{x:Type Button}">
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="White" Opacity="0.12"/>
<SolidColorBrush Color="White" Opacity="0.12" />
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<TextBlock TextAlignment="Center" Padding="0" TextWrapping="Wrap" Text="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock TextAlignment="Center" Padding="0" TextWrapping="Wrap" Text="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="{StaticResource BackgroundSurface_00dp}"/>
<Setter Property="Background" Value="Red" />
<Setter Property="Foreground" Value="{StaticResource BackgroundSurface_00dp}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>

View File

@@ -4,22 +4,30 @@ using System.Text;
using System.Windows;
namespace Server_Dashboard {
/// <summary>
/// Attached property base class
/// </summary>
/// <typeparam name="Parent"></typeparam>
/// <typeparam name="Property"></typeparam>
public abstract class BaseAttachedProperty<Parent, Property>
where Parent : BaseAttachedProperty<Parent, Property>, new() {
/// <typeparam name="TParent"></typeparam>
/// <typeparam name="TProperty"></typeparam>
public abstract class BaseAttachedProperty<TParent, TProperty>
where TParent : BaseAttachedProperty<TParent, TProperty>, new() {
public event Action<DependencyObject, DependencyPropertyChangedEventArgs> ValueChanged = (sender, e) => { };
public static Parent Instance { get; private set; } = new Parent();
public static readonly DependencyProperty ValueProperty = DependencyProperty.RegisterAttached("Value", typeof(Property), typeof(BaseAttachedProperty<Parent, Property>), new PropertyMetadata(new PropertyChangedCallback(OnValuePropertyChanged)));
public static TParent Instance { get; private set; } = new TParent();
public static readonly DependencyProperty ValueProperty = DependencyProperty.RegisterAttached("Value", typeof(TProperty), typeof(BaseAttachedProperty<TParent, TProperty>), new PropertyMetadata(new PropertyChangedCallback(OnValuePropertyChanged)));
private static void OnValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
Instance.OnValueChanged(d, e);
Instance.ValueChanged(d, e);
}
public static Property GetValue(DependencyObject d) => (Property)d.GetValue(ValueProperty);
public static void SetValue(DependencyObject d, Property value) => d.SetValue(ValueProperty, value);
public virtual void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { }
public static TProperty GetValue(DependencyObject d) => (TProperty)d.GetValue(ValueProperty);
public static void SetValue(DependencyObject d, TProperty value) => d.SetValue(ValueProperty, value);
public virtual void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) {
}
}
}

View File

@@ -6,7 +6,9 @@ using System.Windows;
using System.Windows.Documents;
namespace Server_Dashboard {
public static class HyperlinkExtensions {
public static bool GetIsExternal(DependencyObject obj) {
return (bool)obj.GetValue(IsExternalProperty);
}
@@ -14,22 +16,24 @@ namespace Server_Dashboard {
public static void SetIsExternal(DependencyObject obj, bool value) {
obj.SetValue(IsExternalProperty, value);
}
public static readonly DependencyProperty IsExternalProperty =
DependencyProperty.RegisterAttached("IsExternal", typeof(bool), typeof(HyperlinkExtensions), new UIPropertyMetadata(false, OnIsExternalChanged));
private static void OnIsExternalChanged(object sender, DependencyPropertyChangedEventArgs args) {
var hyperlink = sender as Hyperlink;
if ((bool)args.NewValue)
hyperlink.RequestNavigate += Hyperlink_RequestNavigate;
else
if ((bool)args.NewValue) {
if (hyperlink != null)
hyperlink.RequestNavigate += Hyperlink_RequestNavigate;
} else if (hyperlink != null)
hyperlink.RequestNavigate -= Hyperlink_RequestNavigate;
}
private static void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e) {
try {
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri) { UseShellExecute = true });
} catch { }
} catch (Exception) { }
e.Handled = true;
}
}

View File

@@ -2,17 +2,18 @@
using System.Windows.Controls;
namespace Server_Dashboard {
public class MonitorPasswordProperty : BaseAttachedProperty<MonitorPasswordProperty, bool> {
public override void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) {
var passwordBox = sender as PasswordBox;
if (passwordBox == null)
if (!(sender is PasswordBox passwordBox))
return;
passwordBox.PasswordChanged -= PasswordBox_PasswordChanged;
if ((bool)e.NewValue) {
HasTextProperty.SetValue(passwordBox);
passwordBox.PasswordChanged += PasswordBox_PasswordChanged;
}
if (!(bool)e.NewValue)
return;
HasTextProperty.SetValue(passwordBox);
passwordBox.PasswordChanged += PasswordBox_PasswordChanged;
}
private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e) {
@@ -21,6 +22,7 @@ namespace Server_Dashboard {
}
public class HasTextProperty : BaseAttachedProperty<HasTextProperty, bool> {
public static void SetValue(DependencyObject sender) {
SetValue(sender, ((PasswordBox)sender).SecurePassword.Length < 1);
}

View File

@@ -1,7 +1,9 @@
using System.Windows;
namespace Server_Dashboard {
public class CloseProperty : BaseAttachedProperty<CloseProperty, bool> {
public override void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) {
if (sender is Window window) {
window.Loaded += (s, e) => {

View File

@@ -12,7 +12,7 @@
<UserControl.Resources>
<root:ValueToAngleConverter x:Key="valueToAngle" />
</UserControl.Resources>
<!--Circular Prograss bar-->
<!--Circular Progress bar-->
<Grid>
<Ellipse x:Name="Background" Fill="{Binding ElementName=_this, Path=BackgroundBrush}" Margin="0" Stroke="{Binding ElementName=_this, Path=BackgroundBrush}" />
<ed:Arc ArcThickness="8" ArcThicknessUnit="Pixel" EndAngle="{Binding Converter={StaticResource valueToAngle}, ElementName=_this, Path=ValueRead}" Fill="{Binding ElementName=_this, Path=ReadIndicatorBrush}" Stretch="None" StartAngle="0" />

View File

@@ -1,16 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows;
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.Navigation;
using System.Windows.Shapes;
namespace Server_Dashboard.Controls.DoubleRoundProgressBar {
@@ -20,51 +10,51 @@ namespace Server_Dashboard.Controls.DoubleRoundProgressBar {
public partial class DoubleRoundProgressBar : UserControl {
//Property for the ReadIndicatorBrush
public static DependencyProperty ReadIndicatorBrushProperty = DependencyProperty.Register("ReadIndicatorBrush", typeof(Brush), typeof(DoubleRoundProgressBar));
public static readonly DependencyProperty ReadIndicatorBrushProperty = DependencyProperty.Register("ReadIndicatorBrush", typeof(Brush), typeof(DoubleRoundProgressBar));
public Brush ReadIndicatorBrush {
get { return (Brush)GetValue(ReadIndicatorBrushProperty); }
set { SetValue(ReadIndicatorBrushProperty, value); }
get => (Brush)GetValue(ReadIndicatorBrushProperty);
set => SetValue(ReadIndicatorBrushProperty, value);
}
//Property for the WriteIndicatorBrush
public static DependencyProperty WriteIndicatorBrushProperty = DependencyProperty.Register("WriteIndicatorBrush", typeof(Brush), typeof(DoubleRoundProgressBar));
public static readonly DependencyProperty WriteIndicatorBrushProperty = DependencyProperty.Register("WriteIndicatorBrush", typeof(Brush), typeof(DoubleRoundProgressBar));
public Brush WriteIndicatorBrush {
get { return (Brush)GetValue(WriteIndicatorBrushProperty); }
set { SetValue(WriteIndicatorBrushProperty, value); }
get => (Brush)GetValue(WriteIndicatorBrushProperty);
set => SetValue(WriteIndicatorBrushProperty, value);
}
//Property for the BackgroundBrush
public static DependencyProperty BackgroundBrushProperty = DependencyProperty.Register("BackgroundBrush", typeof(Brush), typeof(DoubleRoundProgressBar));
public static readonly DependencyProperty BackgroundBrushProperty = DependencyProperty.Register("BackgroundBrush", typeof(Brush), typeof(DoubleRoundProgressBar));
public Brush BackgroundBrush {
get { return (Brush)GetValue(BackgroundBrushProperty); }
set { SetValue(BackgroundBrushProperty, value); }
get => (Brush)GetValue(BackgroundBrushProperty);
set => SetValue(BackgroundBrushProperty, value);
}
//Property for the ProgressBorderBrush
public static DependencyProperty ProgressBorderBrushProperty = DependencyProperty.Register("ProgressBorderBrush", typeof(Brush), typeof(DoubleRoundProgressBar));
public static readonly DependencyProperty ProgressBorderBrushProperty = DependencyProperty.Register("ProgressBorderBrush", typeof(Brush), typeof(DoubleRoundProgressBar));
public Brush ProgressBorderBrush {
get { return (Brush)GetValue(ProgressBorderBrushProperty); }
set { SetValue(ProgressBorderBrushProperty, value); }
get => (Brush)GetValue(ProgressBorderBrushProperty);
set => SetValue(ProgressBorderBrushProperty, value);
}
//Property for the Value Write
public static DependencyProperty ValueWriteProperty = DependencyProperty.Register("ValueWrite", typeof(int), typeof(DoubleRoundProgressBar));
public static readonly DependencyProperty ValueWriteProperty = DependencyProperty.Register("ValueWrite", typeof(int), typeof(DoubleRoundProgressBar));
public int ValueWrite {
get { return (int)GetValue(ValueWriteProperty); }
set { SetValue(ValueWriteProperty, value); }
get => (int)GetValue(ValueWriteProperty);
set => SetValue(ValueWriteProperty, value);
}
//Property for the Value Read
public static DependencyProperty ValueReadProperty = DependencyProperty.Register("ValueRead", typeof(int), typeof(DoubleRoundProgressBar));
public static readonly DependencyProperty ValueReadProperty = DependencyProperty.Register("ValueRead", typeof(int), typeof(DoubleRoundProgressBar));
public int ValueRead {
get { return (int)GetValue(ValueReadProperty); }
set { SetValue(ValueReadProperty, value); }
get => (int)GetValue(ValueReadProperty);
set => SetValue(ValueReadProperty, value);
}
public DoubleRoundProgressBar() {

View File

@@ -1,54 +1,44 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows;
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.Navigation;
using System.Windows.Shapes;
namespace Server_Dashboard.Controls.HalfRoundProgressBar {
/// <summary>
/// Dependency Properties
/// Dependency Properties
/// </summary>
public partial class HalfRoundProgressBar : UserControl {
//Indicator Brush Property
public static DependencyProperty IndicatorBrushProperty = DependencyProperty.Register("IndicatorBrush", typeof(Brush), typeof(HalfRoundProgressBar));
public static readonly DependencyProperty IndicatorBrushProperty = DependencyProperty.Register("IndicatorBrush", typeof(Brush), typeof(HalfRoundProgressBar));
public Brush IndicatorBrush {
get { return (Brush)GetValue(IndicatorBrushProperty); }
set { SetValue(IndicatorBrushProperty, value); }
get => (Brush)GetValue(IndicatorBrushProperty);
set => SetValue(IndicatorBrushProperty, value);
}
//Background Brush Property
public static DependencyProperty BackgroundBrushProperty = DependencyProperty.Register("BackgroundBrush", typeof(Brush), typeof(HalfRoundProgressBar));
public static readonly DependencyProperty BackgroundBrushProperty = DependencyProperty.Register("BackgroundBrush", typeof(Brush), typeof(HalfRoundProgressBar));
public Brush BackgroundBrush {
get { return (Brush)GetValue(BackgroundBrushProperty); }
set { SetValue(BackgroundBrushProperty, value); }
get => (Brush)GetValue(BackgroundBrushProperty);
set => SetValue(BackgroundBrushProperty, value);
}
//ProgressBorder Property
public static DependencyProperty ProgressBorderBrushProperty = DependencyProperty.Register("ProgressBorderBrush", typeof(Brush), typeof(HalfRoundProgressBar));
public static readonly DependencyProperty ProgressBorderBrushProperty = DependencyProperty.Register("ProgressBorderBrush", typeof(Brush), typeof(HalfRoundProgressBar));
public Brush ProgressBorderBrush {
get { return (Brush)GetValue(ProgressBorderBrushProperty); }
set { SetValue(ProgressBorderBrushProperty, value); }
get => (Brush)GetValue(ProgressBorderBrushProperty);
set => SetValue(ProgressBorderBrushProperty, value);
}
//Value
public static DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(int), typeof(HalfRoundProgressBar));
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(int), typeof(HalfRoundProgressBar));
public int Value {
get { return (int)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
get => (int)GetValue(ValueProperty);
set => SetValue(ValueProperty, value);
}
public HalfRoundProgressBar() {

View File

@@ -7,165 +7,264 @@
xmlns:halfroundprogressbar="clr-namespace:Server_Dashboard.Controls.HalfRoundProgressBar"
xmlns:doubleroundprogressbar="clr-namespace:Server_Dashboard.Controls.DoubleRoundProgressBar" mc:Ignorable="d">
<!--Module-->
<Border Background="{StaticResource BackgroundSurface_02dp}" MinHeight="100" MinWidth="300" Width="Auto" Height="Auto" Margin="10" CornerRadius="5">
<Border.Effect>
<DropShadowEffect BlurRadius="5" ShadowDepth="0" />
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!--Top Bar-->
<Border CornerRadius="5 5 0 0" Grid.Row="0" Background="{StaticResource BackgroundSurface_08dp}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Margin="7.5 0 7.5 0" Height="25" Width="25" Source="{Binding ModuleIcon}" />
<TextBlock Foreground="{StaticResource DeepPurple_A100}" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{Binding ModuleName}" />
<Border CornerRadius="0 5 0 0" Background="{Binding StatusIndicator}" Grid.Column="3">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Margin="7 0 30 0" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0" FontSize="24" Text="Status">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.87" />
</TextBlock.Foreground>
</TextBlock>
<Border CornerRadius="0 5 0 0" Grid.Column="1" HorizontalAlignment="Right" Background="{Binding StatusIndicatorBG}" Padding="6">
<Ellipse Fill="{Binding StatusIndicator}" StrokeThickness="0" Width="25" Height="25" />
<Button>
<Button.Style>
<Style TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Border" Background="{StaticResource BackgroundSurface_02dp}" BorderThickness="2" MinHeight="300" MinWidth="400" Width="Auto" Height="Auto" Margin="10" CornerRadius="5">
<Border.Effect>
<DropShadowEffect BlurRadius="5" ShadowDepth="0" />
</Border.Effect>
<Border x:Name="BorderBackground" Background="{StaticResource BackgroundSurface_02dp}" CornerRadius="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!--Top Bar-->
<Border CornerRadius="4 4 0 0" Grid.Row="0" Background="{StaticResource BackgroundSurface_08dp}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Margin="7.5 0 7.5 0" Height="25" Width="25" Source="{Binding ModuleIcon}" />
<TextBlock Foreground="{StaticResource DeepPurple_A100}" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{Binding ModuleName}" />
<Border CornerRadius="0 5 0 0" Background="{Binding StatusIndicator}" Grid.Column="3">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Margin="7 0 30 0" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0" FontSize="24" Text="Status">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.87" />
</TextBlock.Foreground>
</TextBlock>
<Border CornerRadius="0 4 0 0" Grid.Column="1" HorizontalAlignment="Right" Background="{Binding StatusIndicatorBG}" Padding="6">
<Ellipse Fill="{Binding StatusIndicator}" StrokeThickness="0" Width="25" Height="25" />
</Border>
</Grid>
</Border>
</Grid>
</Border>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Server" FontSize="20" Margin="10 5 0 5">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.87" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Grid.Column="1" Text="{Binding ServerInformation.ServerName}" FontSize="20" Margin="10 5 0 5">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.87" />
</TextBlock.Foreground>
</TextBlock>
</Grid>
<!--Main Content-->
<Grid Grid.Row="2" Margin="20" Width="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.5*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!--Information panel, left-->
<Grid Margin="0 0 25 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<Border BorderThickness="0 0 0 1" Padding="0 0 0 5">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock Text="User" FontSize="16">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</Border>
<Border BorderThickness="0 1 0 1" Padding="0 5 0 5">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock Text="Public IP" FontSize="16">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</Border>
<Border BorderThickness="0 1 0 1" Padding="0 5 0 5">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock Text="Private IP" FontSize="16">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</Border>
<Border BorderThickness="0 1 0 1" Padding="0 5 0 5">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock Text="Uptime" FontSize="16">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</Border>
<Border BorderThickness="0 1 0 1" Padding="0 5 0 5">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock Text="Creation Date" FontSize="16">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</Border>
<Border BorderThickness="0 1 0 0" Padding="0 5 0 0">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock Text="Creator" FontSize="16">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</Border>
</StackPanel>
<StackPanel Grid.Column="1">
<Border BorderThickness="0 0 0 1" Padding="0 0 0 5">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock Text="{Binding ServerInformation.OsUserName}" FontSize="16" Padding="15 0 0 0">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</Border>
<Border BorderThickness="0 1 0 1" Padding="0 5 0 5">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock Text="{Binding ServerInformation.PublicIpAddress}" FontSize="16" Padding="15 0 0 0">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</Border>
<Border BorderThickness="0 1 0 1" Padding="0 5 0 5">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock Text="{Binding ServerInformation.PrivateIpAddress}" FontSize="16" Padding="15 0 0 0">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</Border>
<Border BorderThickness="0 1 0 1" Padding="0 5 0 5">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock Text="{Binding ServerInformation.Uptime}" FontSize="16" Padding="15 0 0 0">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</Border>
<Border BorderThickness="0 1 0 1" Padding="0 5 0 5">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock Text="{Binding CreationDate}" FontSize="16" Padding="15 0 0 0">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</Border>
<Border BorderThickness="0 1 0 0" Padding="0 5 0 0">
<Border.BorderBrush>
<SolidColorBrush Color="White" Opacity="0.12" />
</Border.BorderBrush>
<TextBlock Text="{Binding Creator}" FontSize="16" Padding="15 0 0 0">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</Border>
</StackPanel>
</Grid>
<!--Graphical Indicators Right-->
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<halfroundprogressbar:HalfRoundProgressBar Margin="5" Grid.Row="0" ProgressBorderBrush="{StaticResource BackgroundSurface_02dp}" BackgroundBrush="{StaticResource BackgroundSurface_08dp}" Height="100" Width="100" Value="{Binding ServerInfo.CpuUsage}" IndicatorBrush="{StaticResource Teal_A100}" />
<TextBlock Foreground="{StaticResource Teal_A100}" Grid.Row="0" Text="CPU" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" />
<halfroundprogressbar:HalfRoundProgressBar Margin="5" Grid.Row="1" ProgressBorderBrush="{StaticResource BackgroundSurface_02dp}" BackgroundBrush="{StaticResource BackgroundSurface_08dp}" Height="100" Width="100" Value="{Binding ServerInfo.GpuUsage}" IndicatorBrush="{StaticResource Teal_A100}" />
<TextBlock Foreground="{StaticResource Teal_A100}" Grid.Row="1" Text="GPU" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" />
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<doubleroundprogressbar:DoubleRoundProgressBar ValueRead="70" ValueWrite="60" ReadIndicatorBrush="{StaticResource DeepPurple_A100}" WriteIndicatorBrush="{StaticResource Teal_A100}" Margin="5" Grid.Row="0" ProgressBorderBrush="{StaticResource BackgroundSurface_02dp}" BackgroundBrush="{StaticResource BackgroundSurface_08dp}" Height="100" Width="100" />
<StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" TextAlignment="Center" Text="Read" Foreground="{StaticResource DeepPurple_A100}" />
<TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" TextAlignment="Center" Text="Write" Foreground="{StaticResource Teal_A100}" />
</StackPanel>
<doubleroundprogressbar:DoubleRoundProgressBar ValueRead="70" ValueWrite="60" ReadIndicatorBrush="{StaticResource DeepPurple_A100}" WriteIndicatorBrush="{StaticResource Teal_A100}" Margin="5" Grid.Row="1" ProgressBorderBrush="{StaticResource BackgroundSurface_02dp}" BackgroundBrush="{StaticResource BackgroundSurface_08dp}" Height="100" Width="100" />
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" TextAlignment="Center" Text="UP" Foreground="{StaticResource DeepPurple_A100}" />
<TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" TextAlignment="Center" Text="DOWN" Foreground="{StaticResource Teal_A100}" />
</StackPanel>
</Grid>
</Grid>
</Grid>
</Grid>
</Border>
</Border>
</Grid>
</Border>
</Grid>
</Border>
<!--Main Content-->
<Grid Grid.Row="2" Margin="20" Width="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.5*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!--Information pannel, left-->
<Grid Grid.Row="1" Margin="0 0 25 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Text="Servername" FontSize="16" Margin="2 2 5 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="User" FontSize="16" Margin="2 2 5 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="Public IP" FontSize="16" Margin="2 2 5 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="Private IP" FontSize="16" Margin="2 2 5 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="Uptime" FontSize="16" Margin="2 2 5 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="Creation Date" FontSize="16" Margin="2 2 5 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="Creator" FontSize="16" Margin="2 2 5 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1">
<TextBlock Text="{Binding ServerInfo.ServerName}" FontSize="16" Margin="5 2 2 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="{Binding ServerInfo.OSUserName}" FontSize="16" Margin="5 2 2 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="{Binding ServerInfo.PublicIpAdress}" FontSize="16" Margin="5 2 2 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="{Binding ServerInfo.PrivateIpAdress}" FontSize="16" Margin="5 2 2 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="{Binding ServerInfo.Uptime}" FontSize="16" Margin="5 2 2 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="{Binding CreationDate}" FontSize="16" Margin="5 2 2 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="{Binding Creator}" FontSize="16" Margin="5 2 2 10">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.60" />
</TextBlock.Foreground>
</TextBlock>
</StackPanel>
</Grid>
<!--Graphical Indicators Right-->
<Grid Grid.Row="1" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<halfroundprogressbar:HalfRoundProgressBar Margin="5" Grid.Row="0" ProgressBorderBrush="{StaticResource BackgroundSurface_02dp}" BackgroundBrush="{StaticResource BackgroundSurface_08dp}" Height="100" Width="100" Value="{Binding ServerInfo.CpuUsage}" IndicatorBrush="{StaticResource Teal_A100}" />
<TextBlock Foreground="{StaticResource Teal_A100}" Grid.Row="0" Text="CPU" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" />
<halfroundprogressbar:HalfRoundProgressBar Margin="5" Grid.Row="1" ProgressBorderBrush="{StaticResource BackgroundSurface_02dp}" BackgroundBrush="{StaticResource BackgroundSurface_08dp}" Height="100" Width="100" Value="{Binding ServerInfo.GpuUsage}" IndicatorBrush="{StaticResource Teal_A100}" />
<TextBlock Foreground="{StaticResource Teal_A100}" Grid.Row="1" Text="GPU" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" />
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<doubleroundprogressbar:DoubleRoundProgressBar ValueRead="70" ValueWrite="60" ReadIndicatorBrush="{StaticResource DeepPurple_A100}" WriteIndicatorBrush="{StaticResource Teal_A100}" Margin="5" Grid.Row="0" ProgressBorderBrush="{StaticResource BackgroundSurface_02dp}" BackgroundBrush="{StaticResource BackgroundSurface_08dp}" Height="100" Width="100" />
<StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" TextAlignment="Center" Text="Read" Foreground="{StaticResource DeepPurple_A100}" />
<TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" TextAlignment="Center" Text="Write" Foreground="{StaticResource Teal_A100}" />
</StackPanel>
<doubleroundprogressbar:DoubleRoundProgressBar ValueRead="70" ValueWrite="60" ReadIndicatorBrush="{StaticResource DeepPurple_A100}" WriteIndicatorBrush="{StaticResource Teal_A100}" Margin="5" Grid.Row="1" ProgressBorderBrush="{StaticResource BackgroundSurface_02dp}" BackgroundBrush="{StaticResource BackgroundSurface_08dp}" Height="100" Width="100" />
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" TextAlignment="Center" Text="UP" Foreground="{StaticResource DeepPurple_A100}" />
<TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" TextAlignment="Center" Text="DOWN" Foreground="{StaticResource Teal_A100}" />
</StackPanel>
</Grid>
</Grid>
</Grid>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="BorderBrush">
<Setter.Value>
<SolidColorBrush Color="#B388FF" Opacity=".37" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsFocused" Value="True">
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Border" Property="BorderBrush">
<Setter.Value>
<SolidColorBrush Color="#B388FF" Opacity=".87" />
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
</Button>
</UserControl>

View File

@@ -1,12 +1,7 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
namespace Server_Dashboard {
@@ -39,17 +34,11 @@ namespace Server_Dashboard {
com.Parameters.Add("@valid", SqlDbType.NVarChar, 250);
com.Parameters["@valid"].Direction = ParameterDirection.Output;
//Execute query and return number of rows affected
int sqlResponse = com.ExecuteNonQuery();
com.ExecuteNonQuery();
//Checks if there are any rows successful
//If the query returns 0 the query wasn't successful
//if its any number above 0 it was successfull
if (Convert.ToInt32(com.Parameters["@Valid"].Value) == 0) {
//Error, not successful
return 1;
} else {
//Successful
return 0;
}
//if its any number above 0 it was successful
return Convert.ToInt32(com.Parameters["@Valid"].Value) == 0 ? 1 : 0;
//Catch any error
} catch (SqlException ex) {
return ex.Number;
@@ -66,7 +55,7 @@ namespace Server_Dashboard {
//Open the connection
con.Open();
//SQL Query
string query = "SELECT ID, Username, Email, RegistrationDate FROM UserData WHERE Username = @username";
const string query = "SELECT ID, Username, Email, RegistrationDate FROM UserData WHERE Username = @username";
//Creates a new command
using SqlCommand com = new SqlCommand(query, con);//For security reasons the values are added with this function
//this will avoid SQL Injections
@@ -78,9 +67,9 @@ namespace Server_Dashboard {
return resultTable;
//Checks if there are any rows successful
//If the query returns 0 the query wasn't successful
//if its any number above 0 it was successfull
//if its any number above 0 it was successful
//Catch any error
} catch (SqlException ex) {
} catch (SqlException) {
return null;
} finally {
//Always close the connection
@@ -95,7 +84,7 @@ namespace Server_Dashboard {
//Open the connection
con.Open();
//SQL Query
string query = "SELECT Creator, CreationTime, ModuleName, MI.Image FROM ModuleData LEFT JOIN ModuleIcon MI on ModuleData.ID = MI.Module WHERE UserID = @userID";
const string query = "SELECT Creator, CreationTime, ModuleName, MI.Image, ModuleData.ID FROM ModuleData LEFT JOIN ModuleIcon MI on ModuleData.ID = MI.Module WHERE UserID = @userID";
//Creates a new command
using SqlCommand com = new SqlCommand(query, con);//For security reasons the values are added with this function
//this will avoid SQL Injections
@@ -107,9 +96,9 @@ namespace Server_Dashboard {
return resultTable;
//Checks if there are any rows successful
//If the query returns 0 the query wasn't successful
//if its any number above 0 it was successfull
//if its any number above 0 it was successful
//Catch any error
} catch (SqlException ex) {
} catch (SqlException) {
return null;
} finally {
//Always close the connection
@@ -118,20 +107,20 @@ namespace Server_Dashboard {
}
/// <summary>
/// This function will fetch every Serverdata for each module
/// This function will fetch every server data for each module
/// This will need some optimization, for now we just asynchronously
/// fetch the serverdata for each module
/// fetch the server data for each module
/// </summary>
/// <param name="mid">ModuleID to fetch the data from</param>
/// <returns></returns>
public static DataTable GetServerData(string mid) {
public static DataTable GetServerData(int mid) {
//Creates the database connection
using SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ServerDashboardDB"].ConnectionString);
try {
//Open the connection
con.Open();
//SQL Query
string query = "SELECT * FROM ServerData WHERE ModuleID = @mid";
const string query = "SELECT * FROM ServerData WHERE ModuleID = @mid";
//Creates a new command
using SqlCommand com = new SqlCommand(query, con);//For security reasons the values are added with this function
//this will avoid SQL Injections
@@ -143,9 +132,9 @@ namespace Server_Dashboard {
return resultTable;
//Checks if there are any rows successful
//If the query returns 0 the query wasn't successful
//if its any number above 0 it was successfull
//if its any number above 0 it was successful
//Catch any error
} catch (SqlException ex) {
} catch (SqlException) {
return null;
} finally {
//Always close the connection
@@ -156,21 +145,21 @@ namespace Server_Dashboard {
/// <summary>
/// Creates a new Module for the current user
/// </summary>
/// <param name="ipAdress">Server IP Address</param>
/// <param name="ipAddress">Server IP Address</param>
/// <param name="moduleName">Module name, default is Module</param>
/// <param name="serverName">Server name, default is Server</param>
/// <param name="username">Username of the current user</param>
/// <param name="moduleIcon">module icon as byte[]</param>
/// <param name="port">port, defalt ist 22</param>
/// <param name="port">port, default ist 22</param>
/// <returns></returns>
public static int CreateNewModule(string ipAdress, string moduleName, string serverName, string username, byte[] moduleIcon, string port = "22") {
public static int CreateNewModule(string ipAddress, string moduleName, string serverName, string username, byte[] moduleIcon, string port = "22") {
//Creates the database connection
using SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ServerDashboardDB"].ConnectionString);
try {
//Open the connection
con.Open();
//SQL Query
string query = "EXEC AddNewModuleToUser @UserName = @username, @DateTime = @time, @ModuleName = @moduleName, @ServerName = @serverName, @ModuleIcon = @moduleIcon, @IPAddress = @ipAdress, @Port = @port";
const string query = "EXEC AddNewModuleToUser @UserName = @username, @DateTime = @time, @ModuleName = @moduleName, @ServerName = @serverName, @ModuleIcon = @moduleIcon, @IPAddress = @ipAddress, @Port = @port";
//Creates a new command
using SqlCommand com = new SqlCommand(query, con);
//For security reasons the values are added with this function
@@ -183,20 +172,14 @@ namespace Server_Dashboard {
if (moduleIcon == null)
com.Parameters["@moduleIcon"].Value = DBNull.Value;
//com.Parameters.AddWithValue("@moduleIcon", moduleIcon);
com.Parameters.AddWithValue("@ipAdress", ipAdress);
com.Parameters.AddWithValue("@ipAddress", ipAddress);
com.Parameters.AddWithValue("@port", port);
//Execute query and return number of rows affected
int sqlResponse = com.ExecuteNonQuery();
//Checks if there are any rows successful
//If the query returns 0 the query wasn't successful
//if its any number above 0 it was successfull
if (sqlResponse == 0) {
//Error, not successful
return 1;
} else {
//Successful
return 0;
}
//if its any number above 0 it was successful
return sqlResponse == 0 ? 1 : 0;
//Catch any error
} catch (SqlException ex) {
return ex.Number;
@@ -207,7 +190,7 @@ namespace Server_Dashboard {
}
/// <summary>
/// Currently obscolete, would check the Username and Cookie
/// Currently obsolete, would check the Username and Cookie
/// </summary>
/// <param name="cookie">Locally stored user cookie</param>
/// <param name="username">Locally stored username</param>
@@ -219,7 +202,7 @@ namespace Server_Dashboard {
//Open the connection
con.Open();
//SQL Query
string query = "((SELECT Cookie FROM UserData WHERE Username = @username) = @cookie)";
const string query = "((SELECT Cookie FROM UserData WHERE Username = @username) = @cookie)";
//Creates a new command
using SqlCommand com = new SqlCommand(query, con);
//For security reasons the values are added with this function
@@ -231,13 +214,7 @@ namespace Server_Dashboard {
//Checks if there are any rows successful
//If the query returns 0 the query wasn't successful
//if its any number above 0 it was successfull
if (sqlResponse == 0) {
//Error, not successful
return 1;
} else {
//Successful
return 0;
}
return sqlResponse == 0 ? 1 : 0;
//Catch any error
} catch (SqlException ex) {
return ex.Number;
@@ -258,7 +235,7 @@ namespace Server_Dashboard {
//Open the connection
con.Open();
//SQL Query
string query = "UPDATE UserData SET Cookie = null WHERE Username = @username";
const string query = "UPDATE UserData SET Cookie = null WHERE Username = @username";
//Creates a new command
using SqlCommand com = new SqlCommand(query, con);
//For security reasons the values are added with this function
@@ -268,14 +245,8 @@ namespace Server_Dashboard {
int sqlResponse = com.ExecuteNonQuery();
//Checks if there are any rows successful
//If the query returns 0 the query wasn't successful
//if its any number above 0 it was successfull
if (sqlResponse == 0) {
//Error, not successful
return 1;
} else {
//Successful
return 0;
}
//if its any number above 0 it was successful
return sqlResponse == 0 ? 1 : 0;
//Catch any error
} catch (SqlException ex) {
return ex.Number;
@@ -293,30 +264,31 @@ namespace Server_Dashboard {
/// <returns>[0] is false, [1] is true, [2] connection error</returns>
public static int AddCookie(string username, string cookie) {
//Creates the database connection
using SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ServerDashboardDB"].ConnectionString);
using SqlConnection con =
new SqlConnection(ConfigurationManager.ConnectionStrings["ServerDashboardDB"].ConnectionString);
try {
//Open the connection
con.Open();
//SQL Query
string query = "UPDATE UserData SET Cookie = @cookie WHERE Username = @username";
const string query = "UPDATE UserData SET Cookie = @cookie WHERE Username = @username";
//Creates a new command
using SqlCommand com = new SqlCommand(query, con);
//For security reasons the values are added with this function
//this will avoid SQL Injections
com.Parameters.Add("@cookie", SqlDbType.NVarChar, -1).Value = cookie;
com.Parameters.AddWithValue("@username", username);
//Execute query and return number of rows affected
int sqlResponse = com.ExecuteNonQuery();
//Checks if there are any rows successful
//If the query returns 0 the query wasn't successful
//if its any number above 0 it was successfull
if (sqlResponse == 0) {
//Error, not successful
return 1;
} else {
//Successful
return 0;
}
//if its any number above 0 it was successful
return sqlResponse == 0 ? 1 : 0;
//Catch any error
} catch (SqlException ex) {
return ex.Number;
@@ -324,8 +296,8 @@ namespace Server_Dashboard {
//Always close the connection
con.Close();
}
#endregion Public Methods
}
#endregion Public Methods
}
}

View File

@@ -4,6 +4,7 @@ using System.Security;
using System.Text;
namespace Server_Dashboard {
/// <summary>
/// Interface that makes a SecurePassword go one way
/// </summary>

View File

@@ -3,10 +3,11 @@ using System.Collections.Generic;
using System.Text;
namespace Server_Dashboard {
/// <summary>
/// Interface to help close a window with a button
/// </summary>
interface IWindowHelper {
internal interface IWindowHelper {
Action Close { get; set; }
}
}

View File

@@ -5,10 +5,12 @@ using System.Security;
using System.Text;
namespace Server_Dashboard {
/// <summary>
/// Secure string helper class to unsecure the Password b4 it goes to the database
/// </summary>
public static class SecureStringHelpers {
//Unsecures a given password
public static string Unsecure(this SecureString secureString) {
//If empty return nothing

View File

@@ -29,7 +29,7 @@ namespace Server_Dashboard {
public DateTime CreationDate { get; set; }
//List that contains all the serverinformation over a period of time(lifespan of the module)
public List<ServerInformation> ServerInformation { get; set; }
public ServerInformation ServerInformation { get; set; }
/// <summary>
/// This will set the Module status indicator red or green if the server is available or not

View File

@@ -11,13 +11,13 @@ namespace Server_Dashboard {
/// </summary>
internal class ServerInformation {
public string ServerName { get; set; }
public string OSUserName { get; set; }
public string OsUserName { get; set; }
public double CpuTemp { get; set; }
public double GpuTemp { get; set; }
public DateTime Uptime { get; set; }
public TimeSpan Uptime { get; set; }
public DateTime DeployDate { get; set; }
public string PublicIpAdress { get; set; }
public string PrivateIpAdress { get; set; }
public string PublicIpAddress { get; set; }
public string PrivateIpAddress { get; set; }
public int GpuUsage { get; set; }
public int CpuUsage { get; set; }
public double NetworkUP { get; set; }

View File

@@ -5,11 +5,13 @@ using System.Text;
using System.Windows.Data;
namespace Server_Dashboard {
/// <summary>
/// Value to angle converter
/// </summary>
[ValueConversion(typeof(int), typeof(double))]
public class ValueToAngleConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => (int)value * 0.01 * 360;
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => (int)((double)value / 360);

View File

@@ -1,14 +1,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.ComponentModel;
namespace Server_Dashboard {
/// <summary>
/// Base View Model all the other view models inherit from
/// Makes me write the INotifyPropertyChanged only once
/// </summary>
public class BaseViewModel : INotifyPropertyChanged {
public event PropertyChangedEventHandler PropertyChanged = (sender, e) => { };
protected void OnPropertyChanged(string prop) {

View File

@@ -16,37 +16,49 @@ namespace Server_Dashboard {
//List with all Modules inside
public ObservableCollection<ModuleData> Modules { get; set; }
//Creates Default Modules, remove before release and when implementing the actual data comming from the socket
//Creates Default Modules, remove before release and when implementing the actual data coming from the socket
public DashboardModuleViewModel(DataTable moduleData) {
Modules = new ObservableCollection<ModuleData>();
foreach (DataRow row in moduleData.Rows) {
if (row[0] != null) {
byte[] iconBytes = row[3] == DBNull.Value ? null : (byte[])row[3];
Modules.Add(new ModuleData(true) {
ModuleName = (string)row?[2],
Creator = (string)row?[0],
ModuleIcon = ConvertByteToBitmapImage(iconBytes),
CreationDate = (DateTime)row?[1],
ServerInformation = null
});
if (row[0] == null)
return;
byte[] iconBytes = row[3] == DBNull.Value ? null : (byte[])row[3];
DataTable serverData = DatabaseHandler.GetServerData((int)row[4]);
ServerInformation serverInformation = null;
if (serverData.Rows.Count != 0) {
DataRow serverRow = serverData.Rows[0];
serverInformation = new ServerInformation {
ServerName = (string)serverRow[4] ?? "",
PublicIpAddress = (string)serverRow[6] ?? "",
PrivateIpAddress = (string)serverRow[5] ?? "",
Uptime = (TimeSpan)serverRow[7],
OsUserName = (string)serverRow[3] ?? ""
};
}
Modules.Add(new ModuleData(false) {
ModuleName = (string)row[2] ?? "",
Creator = (string)row[0] ?? "",
ModuleIcon = ConvertByteToBitmapImage(iconBytes),
CreationDate = (DateTime)row[1],
ServerInformation = serverInformation
});
}
}
private BitmapImage ConvertByteToBitmapImage(byte[] icon) {
if (icon != null) {
try {
using MemoryStream ms = new MemoryStream(icon);
BitmapImage moduleIcon = new BitmapImage();
moduleIcon.BeginInit();
moduleIcon.StreamSource = ms;
moduleIcon.CreateOptions = BitmapCreateOptions.PreservePixelFormat;
moduleIcon.CacheOption = BitmapCacheOption.OnLoad;
moduleIcon.EndInit();
moduleIcon.Freeze();
return moduleIcon;
} catch { }
}
private static BitmapImage ConvertByteToBitmapImage(byte[] icon) {
if (icon == null)
return null;
try {
using MemoryStream ms = new MemoryStream(icon);
BitmapImage moduleIcon = new BitmapImage();
moduleIcon.BeginInit();
moduleIcon.StreamSource = ms;
moduleIcon.CreateOptions = BitmapCreateOptions.PreservePixelFormat;
moduleIcon.CacheOption = BitmapCacheOption.OnLoad;
moduleIcon.EndInit();
moduleIcon.Freeze();
return moduleIcon;
} catch { }
return null;
}
}

View File

@@ -1,13 +1,9 @@
using Server_Dashboard.Views.DashboardPages.ModuleCRUD;
using System.Collections.ObjectModel;
using System.Data;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using Server_Dashboard_Socket;
using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
namespace Server_Dashboard {
@@ -53,7 +49,7 @@ namespace Server_Dashboard {
#region Constructor
public DashboardViewModel(string username) {
//Command inits
//Command init
OpenLinkCommand = new RelayCommand(OpenLink);
OpenNewModuleWindowCommand = new RelayCommand(OpenNewModuleWindow);
@@ -77,16 +73,14 @@ namespace Server_Dashboard {
/// Opens a given link in the default browser
/// </summary>
/// <param name="param">The Link to be opened e.g. https://github.com/Crylia/Server-Dashboard </param>
private void OpenLink(object param) {
Process.Start(new ProcessStartInfo((string)param) { UseShellExecute = true });
}
private static void OpenLink(object param) => Process.Start(new ProcessStartInfo((string)param) { UseShellExecute = true });
/// <summary>
/// Creates a new window to create a new Module
/// </summary>
/// <param name="param">Nothing</param>
private void OpenNewModuleWindow(object param) {
//Creates a new CreateModulePopup and sets this view model as datacontext
//Creates a new CreateModulePopup and sets this view model as data context
CreateModulePopup cmp = new CreateModulePopup {
DataContext = new CreateModuleViewModel(User.UserName)
};
@@ -98,9 +92,8 @@ namespace Server_Dashboard {
}
private void GetModules() {
DataTable moduleData = DatabaseHandler.GetUserModuleData(User.UID);
dmvm = new DashboardModuleViewModel(moduleData);
//Sets the local module to the dashboardviewmodule modules
dmvm = new DashboardModuleViewModel(DatabaseHandler.GetUserModuleData(User.UID));
//Sets the local module to the dashboard view module modules
Modules = dmvm.Modules;
}

View File

@@ -17,7 +17,7 @@ namespace Server_Dashboard {
private string serverName;
public string ServerName {
get { return serverName; }
get => serverName;
set {
if (serverName != value)
serverName = value;
@@ -28,7 +28,7 @@ namespace Server_Dashboard {
private string moduleName;
public string ModuleName {
get { return moduleName; }
get => moduleName;
set {
if (moduleName != value)
moduleName = value;
@@ -36,21 +36,21 @@ namespace Server_Dashboard {
}
}
private string ipAdress;
private string ipAddress;
public string IPAdress {
get { return ipAdress; }
public string IpAddress {
get => ipAddress;
set {
if (ipAdress != value)
ipAdress = value;
OnPropertyChanged(nameof(ipAdress));
if (ipAddress != value)
ipAddress = value;
OnPropertyChanged(nameof(ipAddress));
}
}
private string port;
public string Port {
get { return port; }
get => port;
set {
if (port != value)
port = value;
@@ -61,7 +61,7 @@ namespace Server_Dashboard {
private BitmapImage moduleIcon;
public BitmapImage ModuleIcon {
get { return moduleIcon; }
get => moduleIcon;
set {
if (moduleIcon != value)
moduleIcon = value;
@@ -72,7 +72,7 @@ namespace Server_Dashboard {
private string userInformationMessage;
public string UserInformationMessage {
get { return userInformationMessage; }
get => userInformationMessage;
set {
if (userInformationMessage != value)
userInformationMessage = value;
@@ -108,39 +108,39 @@ namespace Server_Dashboard {
/// <param name="param">Nothing</param>
private async void CreateModuleAsync(object param) {
//Checks if the IP field is not empty and valid
if (!String.IsNullOrWhiteSpace(ipAdress) && ipFilter.IsMatch(ipAdress)) {
//Gives the Module a default name if the user doesnt name it
if (String.IsNullOrWhiteSpace(moduleName))
if (!string.IsNullOrWhiteSpace(ipAddress) && ipFilter.IsMatch(ipAddress)) {
//Gives the Module a default name if the user doesn't name it
if (string.IsNullOrWhiteSpace(moduleName))
moduleName = "Module";
//Gives the Server a default name is the user doesnt name it
if (String.IsNullOrWhiteSpace(serverName))
//Gives the Server a default name is the user doesn't name it
if (string.IsNullOrWhiteSpace(serverName))
serverName = "Server";
//Makes sure the name isnt any longer than characters
//Makes sure the name isn't any longer than characters
if (moduleName.Length >= 20) {
UserInformationMessage = "The Module Name is too long";
return;
}
//Makes sure the name isnt any longer than characters
//Makes sure the name isn't any longer than characters
if (serverName.Length >= 20) {
UserInformationMessage = "The Server Name is too long";
return;
}
//Clears the error message if there isnt any error
//Clears the error message if there isn't any error
UserInformationMessage = "";
byte[] moduleIconStream = null;
if (moduleIcon != null) {
try {
JpegBitmapEncoder encoder = new JpegBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(moduleIcon));
using MemoryStream ms = new MemoryStream();
await using MemoryStream ms = new MemoryStream();
encoder.Save(ms);
moduleIconStream = ms.ToArray();
} catch { }
} catch (Exception) { }
}
if (await Task.Run(() => DatabaseHandler.CreateNewModule(ipAdress, moduleName, serverName, username, moduleIconStream, port)) == 0) {
if (await Task.Run(() => DatabaseHandler.CreateNewModule(ipAddress, moduleName, serverName, username, moduleIconStream, port)) == 0) {
Close?.Invoke();
} else {
UserInformationMessage = "Unknown error occured, please try again later";
UserInformationMessage = "Unknown error occurred, please try again later";
}
} else {
UserInformationMessage = "The IP Address is invalid";
@@ -156,7 +156,7 @@ namespace Server_Dashboard {
Title = "Choose an Image",
Filter = "Supported format|*.jpg;*.jpeg;*.png"
};
if ((bool)ofd.ShowDialog()) {
if (Convert.ToBoolean(ofd.ShowDialog())) {
ModuleIcon = new BitmapImage(new Uri(ofd.FileName));
}
}

View File

@@ -81,11 +81,11 @@ namespace Server_Dashboard {
LoginCommand = new RelayCommand(LoginAsync);
//Checks if the Username and Cookie is saved in the Settings.settings
if (!String.IsNullOrEmpty(Settings.Default.Username) && !String.IsNullOrEmpty(Settings.Default.Cookies)) {
//Takes the saved Username and Remember me button status and prefills the username and checks the Remember me button
//Takes the saved Username and Remember me button status and pre fills the username and checks the Remember me button
Username = Settings.Default.Username;
RememberUser = Settings.Default.RememberMe;
}
//TODO: Autologin
//TODO: Auto login
//AutoLoginAsync();
}
@@ -108,7 +108,7 @@ namespace Server_Dashboard {
if (!String.IsNullOrWhiteSpace(Username) && !String.IsNullOrWhiteSpace((parameter as IHavePassword).SecurePassword.Unsecure())) {
//Sets loading to true to show the loading icon
Loading = "Visible";
//Sends the Username and Password to the database and saved the result, 1 successfull, 0 wrong username or password
//Sends the Username and Password to the database and saved the result, 1 successful, 0 wrong username or password
int result = await Task.Run(() => DatabaseHandler.CheckLogin(Username, (parameter as IHavePassword).SecurePassword.Unsecure()));
//hides the loading again
Loading = "Hidden";
@@ -142,7 +142,7 @@ namespace Server_Dashboard {
//If the remember user option is checked and the cookie is not set save everything locally
if (RememberUser && Settings.Default.Username != Username) {
//Creates a new GUID with the username at the end, this is the cookie
var cookie = $"{Guid.NewGuid().ToString()}+user:{Username}";
var cookie = $"{Guid.NewGuid()}+user:{Username}";
//Saves cookie, Username Remember me option to the local storage (Settings.settings)
Settings.Default.Cookies = cookie;
Settings.Default.Username = Username;
@@ -197,7 +197,7 @@ namespace Server_Dashboard {
#region private functions
//TODO: Add autologin function that locks the UI untill the user hits the abort button or the login completes
//TODO: Add auto login function that locks the UI until the user hits the abort button or the login completes
/*private async void AutoLoginAsync() {
if (Settings.Default.RememberMe && !String.IsNullOrEmpty(Settings.Default.Username) && !String.IsNullOrEmpty(Settings.Default.Cookies)) {
Loading = "Visible";

View File

@@ -9,35 +9,35 @@
d:DataContext="{d:DesignInstance Type=root:DashboardModuleViewModel}"
mc:Ignorable="d" ResizeMode="NoResize" Height="700" Width="500" d:WindowStyle="None" ap:CloseProperty.Value="True">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" ResizeBorderThickness="0"/>
<WindowChrome CaptionHeight="0" ResizeBorderThickness="0" />
</WindowChrome.WindowChrome>
<!--Create new Server Form-->
<Border Width="500" Height="700">
<Border.Background>
<SolidColorBrush Color="#2D2D2D" Opacity="1"/>
<SolidColorBrush Color="#2D2D2D" Opacity="1" />
</Border.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!--Title Bar-->
<Grid Background="{StaticResource BackgroundSurface_04dp}" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="40"/>
<ColumnDefinition />
<ColumnDefinition Width="40" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Create a new Server" Margin="5 0 0 0" Foreground="{StaticResource DeepPurple_A100}" VerticalAlignment="Center">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonDown">
<i:CallMethodAction MethodName="DragMove" TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"/>
<i:CallMethodAction MethodName="DragMove" TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBlock>
<Button Style="{StaticResource CloseButton}" Grid.Column="2" Content="✕" Cursor="Hand">
<Button Style="{StaticResource CloseButton}" Grid.Column="1" Content="✕">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:CallMethodAction MethodName="Close" TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"/>
<i:CallMethodAction MethodName="Close" TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
@@ -45,34 +45,34 @@
<!--Main Content-->
<Grid Background="{StaticResource BackgroundSurface_04dp}" Grid.Row="1" Margin="20">
<Grid.Effect>
<DropShadowEffect Direction="0" BlurRadius="5" ShadowDepth="0"/>
<DropShadowEffect Direction="0" BlurRadius="5" ShadowDepth="0" />
</Grid.Effect>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="30"/>
<RowDefinition/>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<!--Server Name-->
<StackPanel VerticalAlignment="Center" Grid.Row="0" Margin="20 0 20 0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Module Name" FontSize="24" Margin="0 0 0 5">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.87"/>
<SolidColorBrush Color="White" Opacity="0.87" />
</TextBlock.Foreground>
</TextBlock>
</StackPanel>
<Grid>
<Grid.Effect>
<DropShadowEffect Direction="0" BlurRadius="5" ShadowDepth="0"/>
<DropShadowEffect Direction="0" BlurRadius="5" ShadowDepth="0" />
</Grid.Effect>
<TextBox Text="{Binding ModuleName}" Grid.Column="1" Height="40" FontSize="20" x:Name="ServerName"/>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="My Awesome Server" FontSize="20" Visibility="{Binding ElementName=ServerName, Path=Text.IsEmpty, Converter={StaticResource UserNameVisibillity}}" Grid.Column="1" IsHitTestVisible="False" Margin="5 0 0 0">
<TextBox Text="{Binding ModuleName}" Height="40" FontSize="20" x:Name="ServerName" />
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="My Awesome Server" FontSize="20" Visibility="{Binding ElementName=ServerName, PresentationTraceSources.TraceLevel=High, Path=Text.IsEmpty, Converter={StaticResource UserNameVisibillity}}" IsHitTestVisible="False" Margin="5 0 0 0">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.12"/>
<SolidColorBrush Color="White" Opacity="0.12" />
</TextBlock.Foreground>
</TextBlock>
</Grid>
@@ -82,18 +82,18 @@
<StackPanel Orientation="Horizontal">
<TextBlock Text="Server Name" FontSize="24" Margin="0 0 0 5">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.87"/>
<SolidColorBrush Color="White" Opacity="0.87" />
</TextBlock.Foreground>
</TextBlock>
</StackPanel>
<Grid>
<Grid.Effect>
<DropShadowEffect Direction="0" BlurRadius="5" ShadowDepth="0"/>
<DropShadowEffect Direction="0" BlurRadius="5" ShadowDepth="0" />
</Grid.Effect>
<TextBox Text="{Binding ServerName}" Grid.Column="1" Height="40" FontSize="20" x:Name="UserName"/>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="Name" FontSize="20" Visibility="{Binding ElementName=UserName, Path=Text.IsEmpty, Converter={StaticResource UserNameVisibillity}}" Grid.Column="1" IsHitTestVisible="False" Margin="5 0 0 0">
<TextBox Text="{Binding ServerName}" Height="40" FontSize="20" x:Name="UserName" />
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="Name" FontSize="20" Visibility="{Binding ElementName=UserName, Path=Text.IsEmpty, Converter={StaticResource UserNameVisibillity}}" IsHitTestVisible="False" Margin="5 0 0 0">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.12"/>
<SolidColorBrush Color="White" Opacity="0.12" />
</TextBlock.Foreground>
</TextBlock>
</Grid>
@@ -101,21 +101,21 @@
<!--IP Adress-->
<StackPanel VerticalAlignment="Center" Grid.Row="2" Margin="20 0 20 0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="IP Adress" FontSize="24" Margin="0 0 0 5">
<TextBlock Text="IP Address" FontSize="24" Margin="0 0 0 5">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.87"/>
<SolidColorBrush Color="White" Opacity="0.87" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="*" Foreground="{StaticResource ErrorRed}" FontSize="16"/>
<TextBlock Text="*" Foreground="{StaticResource ErrorRed}" FontSize="16" />
</StackPanel>
<Grid>
<Grid.Effect>
<DropShadowEffect Direction="0" BlurRadius="5" ShadowDepth="0"/>
<DropShadowEffect Direction="0" BlurRadius="5" ShadowDepth="0" />
</Grid.Effect>
<TextBox Text="{Binding IPAdress}" Grid.Column="1" Height="40" FontSize="20" x:Name="IPAdress"/>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="sample.ssh.com" FontSize="20" Visibility="{Binding ElementName=IPAdress, Path=Text.IsEmpty, Converter={StaticResource UserNameVisibillity}}" Grid.Column="1" IsHitTestVisible="False" Margin="5 0 0 0">
<TextBox Text="{Binding IpAddress}" Height="40" FontSize="20" />
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="sample.ssh.com" FontSize="20" Visibility="{Binding ElementName=IpAddress, Path=Text.IsEmpty, Converter={StaticResource UserNameVisibillity}}" IsHitTestVisible="False" Margin="5 0 0 0">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.12"/>
<SolidColorBrush Color="White" Opacity="0.12" />
</TextBlock.Foreground>
</TextBlock>
</Grid>
@@ -124,17 +124,17 @@
<StackPanel VerticalAlignment="Center" Grid.Row="3" Margin="20 0 20 0">
<TextBlock Text="Port" FontSize="24" Margin="0 0 0 5">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.87"/>
<SolidColorBrush Color="White" Opacity="0.87" />
</TextBlock.Foreground>
</TextBlock>
<Grid>
<Grid.Effect>
<DropShadowEffect Direction="0" BlurRadius="5" ShadowDepth="0"/>
<DropShadowEffect Direction="0" BlurRadius="5" ShadowDepth="0" />
</Grid.Effect>
<TextBox Text="{Binding Port}" Grid.Column="1" Height="40" FontSize="20" x:Name="Port"/>
<TextBox Text="{Binding Port}" Height="40" FontSize="20" x:Name="Port" />
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="22" FontSize="20" Visibility="{Binding ElementName=Port, Path=Text.IsEmpty, Converter={StaticResource UserNameVisibillity}}" Grid.Column="1" IsHitTestVisible="False" Margin="5 0 0 0">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.12"/>
<SolidColorBrush Color="White" Opacity="0.12" />
</TextBlock.Foreground>
</TextBlock>
</Grid>
@@ -142,8 +142,8 @@
<!--Module Icon-->
<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="102"/>
<ColumnDefinition/>
<ColumnDefinition Width="102" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Cursor="Hand" Command="{Binding SelectIconCommand}" HorizontalAlignment="Left" Margin="20 0 20 0" Height="62" Width="62">
<Button.Style>
@@ -153,21 +153,20 @@
<ControlTemplate TargetType="{x:Type Button}">
<Border CornerRadius="4" x:Name="Border" Background="{StaticResource BackgroundSurface_04dp}" BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}">
<Border.Effect>
<DropShadowEffect Direction="0" ShadowDepth="0" BlurRadius="5"/>
<DropShadowEffect Direction="0" ShadowDepth="0" BlurRadius="5" />
</Border.Effect>
<Grid>
<Rectangle RadiusX="4" RadiusY="4">
<Rectangle.Fill>
<ImageBrush ImageSource="{Binding ModuleIcon}"/>
<ImageBrush ImageSource="{Binding ModuleIcon}" />
</Rectangle.Fill>
</Rectangle>
<Border CornerRadius="100" Background="{StaticResource BackgroundSurface_04dp}" Width="20" Height="20" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="2">
<svgc:SvgViewbox IsHitTestVisible="False" Source="../../../Assets/Images/AddIcon.svg" Opacity="1"/>
<svgc:SvgViewbox IsHitTestVisible="False" Source="../../../Assets/Images/AddIcon.svg" Opacity="1" />
</Border>
</Grid>
</Border>
<ControlTemplate.Triggers>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
@@ -175,22 +174,22 @@
</Style>
</Button.Style>
</Button>
<Button Command="{Binding RemoveIconCommand}" HorizontalAlignment="Left" Grid.Column="1" Content="Remove Icon" Height="40" Width="150"/>
<Button Command="{Binding RemoveIconCommand}" HorizontalAlignment="Left" Grid.Column="1" Content="Remove Icon" Height="40" Width="150" />
</Grid>
<!--Error Text / Test Connection Result-->
<TextBlock Text="{Binding UserInformationMessage}" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="5" FontSize="14">
<TextBlock.Foreground>
<SolidColorBrush Color="#64FFDA" Opacity="0.64"/>
<SolidColorBrush Color="#64FFDA" Opacity="0.64" />
</TextBlock.Foreground>
</TextBlock>
<!--Create Module button-->
<Grid Grid.Row="6">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Margin="20 0 10 0" Height="60" Width="Auto" Command="{Binding CreateModuleCommand}" CommandParameter="{Binding ElementName=CREATE_MODULE}" Content="CREATE MODULE" Grid.Column="0"/>
<Button Margin="10 0 20 0" Height="60" Width="Auto" Command="{Binding TestConnectionCommand}" Content="TEST CONNECTION" Grid.Column="1"/>
<Button Margin="20 0 10 0" Height="60" Width="Auto" Command="{Binding CreateModuleCommand}" CommandParameter="{Binding ElementName=CREATE_MODULE}" Content="CREATE MODULE" Grid.Column="0" />
<Button Margin="10 0 20 0" Height="60" Width="Auto" Command="{Binding TestConnectionCommand}" Content="TEST CONNECTION" Grid.Column="1" />
</Grid>
</Grid>
</Grid>

View File

@@ -3,8 +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:Server_Dashboard.Views"
xmlns:root="clr-namespace:Server_Dashboard"
xmlns:views="clr-namespace:Server_Dashboard.Views.DashboardPages"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
@@ -32,7 +30,7 @@
</i:EventTrigger>
</i:Interaction.Triggers>
</Label>
<Button Style="{StaticResource CloseButton}" Grid.Column="2" Content="✕" Cursor="Hand">
<Button Style="{StaticResource CloseButton}" Grid.Column="1" Content="✕">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:CallMethodAction MethodName="Close" TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" />
@@ -41,7 +39,7 @@
</Button>
</Grid>
<!--Settings, Docs, User, links etc-->
<Grid Background="{StaticResource BackgroundSurface_04dp}" Grid.Row="1" x:Name="TopBarGrid">
<Grid Background="{StaticResource BackgroundSurface_04dp}" Grid.Row="1">
<Grid.Effect>
<DropShadowEffect Direction="270" BlurRadius="5" />
</Grid.Effect>
@@ -198,7 +196,7 @@
</Button>
</Grid>
<!--UserControl Container for the Dashboard pages-->
<UserControl Grid.Row="3">
<UserControl Grid.Row="2">
<views:MainDashboardPage />
</UserControl>
</Grid>

View File

@@ -3,46 +3,69 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:Server_Dashboard"
xmlns:local="clr-namespace:Server_Dashboard.Views.DashboardPages"
xmlns:modulescrud="clr-namespace:Server_Dashboard.Views.DashboardPages.ModuleCRUD"
xmlns:root="clr-namespace:Server_Dashboard"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:controls="clr-namespace:Server_Dashboard.Controls.ServerModules"
mc:Ignorable="d" d:DesignHeight="920" d:DesignWidth="1600">
<Grid Background="{StaticResource BackgroundSurface_00dp}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!--Dashboard and Options-->
<Grid Grid.Row="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="200" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Background="{StaticResource BackgroundSurface_02dp}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="80" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Grid.Row="0" Command="{Binding OpenNewModuleWindowCommand}" Content="New Module" Height="50" Margin="5 10 5 0" Cursor="Hand" x:Name="CreateModule"/>
<Button Grid.Row="1" Command="{Binding OpenDeleteModuleWindowCommand}" Content="Remove Module" Height="50" Margin="5 10 5 0" Cursor="Hand" x:Name="RemoveModule"/>
<Button Grid.Row="2" Command="{Binding OpenUpdateModuleWindowCommand}" Content="Change Module" Height="50" Margin="5 10 5 0" Cursor="Hand" x:Name="ChangeModule"/>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="Navigation" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10 0 0 0">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.67" />
</TextBlock.Foreground>
</TextBlock>
<Button Grid.Row="1" Content="PLACEHOLDER" Height="50" Margin="5 10 5 0" Cursor="Hand" />
<Button Grid.Row="2" Content="PLACEHOLDER" Height="50" Margin="5 10 5 0" Cursor="Hand" />
<Button Grid.Row="3" Content="PLACEHOLDER" Height="50" Margin="5 10 5 0" Cursor="Hand" />
</Grid>
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="Module" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10 0 0 0">
<TextBlock.Foreground>
<SolidColorBrush Color="White" Opacity="0.67" />
</TextBlock.Foreground>
</TextBlock>
<Button Grid.Row="1" Command="{Binding OpenNewModuleWindowCommand}" Content="New Module" Height="50" Margin="5 10 5 0" Cursor="Hand" />
<Button Grid.Row="2" Command="{Binding OpenDeleteModuleWindowCommand}" Content="Remove Module" Height="50" Margin="5 10 5 0" Cursor="Hand" />
<Button Grid.Row="3" Command="{Binding OpenUpdateModuleWindowCommand}" Content="Change Module" Height="50" Margin="5 10 5 0" Cursor="Hand" />
</Grid>
</Grid>
<!--ItemsControl list for the Dashboardmodules-->
<!--ItemsControl list for the Dashboard modules-->
<Grid Grid.Column="1">
<ScrollViewer VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Modules}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel HorizontalAlignment="Center"/>
<WrapPanel VerticalAlignment="Top" HorizontalAlignment="Left" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:ServerModule/>
<controls:ServerModule />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

View File

@@ -12,10 +12,12 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Server_Dashboard.Views.DashboardPages {
/// <summary>
/// Interaktionslogik für MainDashboardPage.xaml
/// </summary>
public partial class MainDashboardPage : UserControl {
public MainDashboardPage() {
InitializeComponent();
}

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\App.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "FA6871C28C6B96CD3932405F6C88CE357B9CAC41"
#pragma checksum "..\..\..\App.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "89671BCD36227E8CA37EFCBD47B7D56B75748C0B"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\App.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "FA6871C28C6B96CD3932405F6C88CE357B9CAC41"
#pragma checksum "..\..\..\App.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "89671BCD36227E8CA37EFCBD47B7D56B75748C0B"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\..\Controls\DoubleRoundProgressBar\DoubleRoundProgressBar.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "086FBA685C865D0623D9F28DA3FE76C1340ED6A4"
#pragma checksum "..\..\..\..\..\Controls\DoubleRoundProgressBar\DoubleRoundProgressBar.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "74BED8DF4E986CFA6EFDD59B3915D539092EE365"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\..\Controls\DoubleRoundProgressBar\DoubleRoundProgressBar.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "086FBA685C865D0623D9F28DA3FE76C1340ED6A4"
#pragma checksum "..\..\..\..\..\Controls\DoubleRoundProgressBar\DoubleRoundProgressBar.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "74BED8DF4E986CFA6EFDD59B3915D539092EE365"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\..\Controls\ServerModules\ServerModule.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6F9DB4C5946CBF25B6E68335E790A78274B363A2"
#pragma checksum "..\..\..\..\..\Controls\ServerModules\ServerModule.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8948CA51F35EA3D65C0627B41D6C20A9C63FAE8A"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@@ -64,13 +64,6 @@ namespace Server_Dashboard.Controls.ServerModules {
#line hidden
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "5.0.4.0")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal System.Delegate _CreateDelegate(System.Type delegateType, string handler) {
return System.Delegate.CreateDelegate(delegateType, this, handler);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "5.0.4.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\..\Controls\ServerModules\ServerModule.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6F9DB4C5946CBF25B6E68335E790A78274B363A2"
#pragma checksum "..\..\..\..\..\Controls\ServerModules\ServerModule.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8948CA51F35EA3D65C0627B41D6C20A9C63FAE8A"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@@ -64,13 +64,6 @@ namespace Server_Dashboard.Controls.ServerModules {
#line hidden
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "5.0.4.0")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal System.Delegate _CreateDelegate(System.Type delegateType, string handler) {
return System.Delegate.CreateDelegate(delegateType, this, handler);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "5.0.4.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\..\..\Views\Dashboard\CRUD Popup\CreateModulePopup.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "9622FD4ED1908727106706E3ADC79DA4E6BAF4FC"
#pragma checksum "..\..\..\..\..\..\Views\Dashboard\CRUD Popup\CreateModulePopup.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "DD12D199E41C2A2DD246D632627FFEDEF260FE3A"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@@ -65,14 +65,6 @@ namespace Server_Dashboard.Views.DashboardPages.ModuleCRUD {
#line hidden
#line 115 "..\..\..\..\..\..\Views\Dashboard\CRUD Popup\CreateModulePopup.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox IPAdress;
#line default
#line hidden
#line 134 "..\..\..\..\..\..\Views\Dashboard\CRUD Popup\CreateModulePopup.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox Port;
@@ -124,9 +116,6 @@ namespace Server_Dashboard.Views.DashboardPages.ModuleCRUD {
this.UserName = ((System.Windows.Controls.TextBox)(target));
return;
case 3:
this.IPAdress = ((System.Windows.Controls.TextBox)(target));
return;
case 4:
this.Port = ((System.Windows.Controls.TextBox)(target));
return;
}

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\..\..\Views\Dashboard\CRUD Popup\CreateModulePopup.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "9622FD4ED1908727106706E3ADC79DA4E6BAF4FC"
#pragma checksum "..\..\..\..\..\..\Views\Dashboard\CRUD Popup\CreateModulePopup.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "DD12D199E41C2A2DD246D632627FFEDEF260FE3A"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@@ -65,14 +65,6 @@ namespace Server_Dashboard.Views.DashboardPages.ModuleCRUD {
#line hidden
#line 115 "..\..\..\..\..\..\Views\Dashboard\CRUD Popup\CreateModulePopup.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox IPAdress;
#line default
#line hidden
#line 134 "..\..\..\..\..\..\Views\Dashboard\CRUD Popup\CreateModulePopup.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox Port;
@@ -124,9 +116,6 @@ namespace Server_Dashboard.Views.DashboardPages.ModuleCRUD {
this.UserName = ((System.Windows.Controls.TextBox)(target));
return;
case 3:
this.IPAdress = ((System.Windows.Controls.TextBox)(target));
return;
case 4:
this.Port = ((System.Windows.Controls.TextBox)(target));
return;
}

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\Views\DashboardWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3593041613773C511381544197463CBAC4FA5B88"
#pragma checksum "..\..\..\..\Views\DashboardWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "7D684497049C84ED9B984ABA13FB98FAA7EC8050"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@@ -14,8 +14,6 @@ using Microsoft.Xaml.Behaviors.Core;
using Microsoft.Xaml.Behaviors.Input;
using Microsoft.Xaml.Behaviors.Layout;
using Microsoft.Xaml.Behaviors.Media;
using Server_Dashboard;
using Server_Dashboard.Views;
using Server_Dashboard.Views.DashboardPages;
using SharpVectors.Converters;
using System;
@@ -49,14 +47,6 @@ namespace Server_Dashboard.Views {
/// </summary>
public partial class DashboardWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
#line 44 "..\..\..\..\Views\DashboardWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Grid TopBarGrid;
#line default
#line hidden
private bool _contentLoaded;
/// <summary>
@@ -85,12 +75,6 @@ namespace Server_Dashboard.Views {
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.TopBarGrid = ((System.Windows.Controls.Grid)(target));
return;
}
this._contentLoaded = true;
}
}

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\Views\DashboardWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3593041613773C511381544197463CBAC4FA5B88"
#pragma checksum "..\..\..\..\Views\DashboardWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "7D684497049C84ED9B984ABA13FB98FAA7EC8050"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@@ -14,8 +14,6 @@ using Microsoft.Xaml.Behaviors.Core;
using Microsoft.Xaml.Behaviors.Input;
using Microsoft.Xaml.Behaviors.Layout;
using Microsoft.Xaml.Behaviors.Media;
using Server_Dashboard;
using Server_Dashboard.Views;
using Server_Dashboard.Views.DashboardPages;
using SharpVectors.Converters;
using System;
@@ -49,14 +47,6 @@ namespace Server_Dashboard.Views {
/// </summary>
public partial class DashboardWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
#line 44 "..\..\..\..\Views\DashboardWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Grid TopBarGrid;
#line default
#line hidden
private bool _contentLoaded;
/// <summary>
@@ -85,12 +75,6 @@ namespace Server_Dashboard.Views {
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.TopBarGrid = ((System.Windows.Controls.Grid)(target));
return;
}
this._contentLoaded = true;
}
}

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\..\Views\Pages\MainDashboardPage.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "47F667437FD33C591010E2D8FB596082CE45DAC4"
#pragma checksum "..\..\..\..\..\Views\Pages\MainDashboardPage.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "17174C7675263D17294DBE843DB6C895C1BCC3FF"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@@ -9,15 +9,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
using Microsoft.Xaml.Behaviors;
using Microsoft.Xaml.Behaviors.Core;
using Microsoft.Xaml.Behaviors.Input;
using Microsoft.Xaml.Behaviors.Layout;
using Microsoft.Xaml.Behaviors.Media;
using Server_Dashboard;
using Server_Dashboard.Controls.ServerModules;
using Server_Dashboard.Views.DashboardPages;
using Server_Dashboard.Views.DashboardPages.ModuleCRUD;
using System;
using System.Diagnostics;
using System.Windows;
@@ -49,30 +41,6 @@ namespace Server_Dashboard.Views.DashboardPages {
/// </summary>
public partial class MainDashboardPage : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {
#line 30 "..\..\..\..\..\Views\Pages\MainDashboardPage.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button CreateModule;
#line default
#line hidden
#line 31 "..\..\..\..\..\Views\Pages\MainDashboardPage.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button RemoveModule;
#line default
#line hidden
#line 32 "..\..\..\..\..\Views\Pages\MainDashboardPage.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button ChangeModule;
#line default
#line hidden
private bool _contentLoaded;
/// <summary>
@@ -101,18 +69,6 @@ namespace Server_Dashboard.Views.DashboardPages {
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.CreateModule = ((System.Windows.Controls.Button)(target));
return;
case 2:
this.RemoveModule = ((System.Windows.Controls.Button)(target));
return;
case 3:
this.ChangeModule = ((System.Windows.Controls.Button)(target));
return;
}
this._contentLoaded = true;
}
}

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\..\Views\Pages\MainDashboardPage.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "47F667437FD33C591010E2D8FB596082CE45DAC4"
#pragma checksum "..\..\..\..\..\Views\Pages\MainDashboardPage.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "17174C7675263D17294DBE843DB6C895C1BCC3FF"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@@ -9,15 +9,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
using Microsoft.Xaml.Behaviors;
using Microsoft.Xaml.Behaviors.Core;
using Microsoft.Xaml.Behaviors.Input;
using Microsoft.Xaml.Behaviors.Layout;
using Microsoft.Xaml.Behaviors.Media;
using Server_Dashboard;
using Server_Dashboard.Controls.ServerModules;
using Server_Dashboard.Views.DashboardPages;
using Server_Dashboard.Views.DashboardPages.ModuleCRUD;
using System;
using System.Diagnostics;
using System.Windows;
@@ -49,30 +41,6 @@ namespace Server_Dashboard.Views.DashboardPages {
/// </summary>
public partial class MainDashboardPage : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {
#line 30 "..\..\..\..\..\Views\Pages\MainDashboardPage.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button CreateModule;
#line default
#line hidden
#line 31 "..\..\..\..\..\Views\Pages\MainDashboardPage.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button RemoveModule;
#line default
#line hidden
#line 32 "..\..\..\..\..\Views\Pages\MainDashboardPage.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button ChangeModule;
#line default
#line hidden
private bool _contentLoaded;
/// <summary>
@@ -101,18 +69,6 @@ namespace Server_Dashboard.Views.DashboardPages {
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.CreateModule = ((System.Windows.Controls.Button)(target));
return;
case 2:
this.RemoveModule = ((System.Windows.Controls.Button)(target));
return;
case 3:
this.ChangeModule = ((System.Windows.Controls.Button)(target));
return;
}
this._contentLoaded = true;
}
}