This commit is contained in:
Meik
2025-11-11 11:03:42 +01:00
commit dc3e8a2e4c
582 changed files with 191465 additions and 0 deletions

6
GraphicData/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

13
GraphicData/App.xaml Normal file
View File

@@ -0,0 +1,13 @@
<Application x:Class="GraphicData.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:GraphicData"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ResourcesDarkMode.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

17
GraphicData/App.xaml.cs Normal file
View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace GraphicData
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GraphicData.Class
{
public class cDataModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private List<object[]> data;
public List<object[]> Data
{
get { return data; }
set { data = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Data)));
}
}
private int indexTime;
public int IndexTime
{
get { return indexTime; }
set
{
indexTime = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IndexTime)));
}
}
private int indexValue;
public int IndexValue
{
get { return indexValue; }
set
{
indexValue = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IndexValue)));
}
}
private int indexDuration;
public int IndexDuration
{
get { return indexDuration; }
set
{
indexDuration = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IndexDuration)));
}
}
private int warningThreshold;
public int WarniningThreshold
{
get { return warningThreshold; }
set
{
warningThreshold = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(WarniningThreshold)));
}
}
private int errorThreshold;
public int ErrorThreshold
{
get { return errorThreshold; }
set
{
errorThreshold = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ErrorThreshold)));
}
}
private bool isThresholdActive;
public bool IsThresholdActive
{
get { return isThresholdActive; }
set
{
isThresholdActive = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsThresholdActive)));
}
}
private string graphicTitle;
public string GraphicTitle
{
get { return graphicTitle; }
set
{
graphicTitle = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(GraphicTitle)));
}
}
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GraphicData.Class
{
public class cGraphicData
{
public DateTime DataTime { get; set; }
public double DataValue { get; set; }
public int DataDuration { get; set; }
public cGraphicData() { }
}
}

View File

@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D19798E6-F03E-41FA-8B75-80A2169107C9}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>GraphicData</RootNamespace>
<AssemblyName>GraphicData</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Class\cDataModel.cs" />
<Compile Include="Class\cGraphicData.cs" />
<Compile Include="User Control\uDataGraph.xaml.cs">
<DependentUpon>uDataGraph.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="ResourcesCloseButton.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ResourcesDarkMode.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ResourcesLightMode.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="User Control\uDataGraph.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\F4SD-AdaptableIcon\F4SD-AdaptableIcon.csproj">
<Project>{bab63a6a-1524-435d-9f96-7a30b6ee0624}</Project>
<Name>F4SD-AdaptableIcon</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,96 @@
<Window x:Class="GraphicData.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:uc="clr-namespace:GraphicData.User_Control"
xmlns:local="clr-namespace:GraphicData"
mc:Ignorable="d"
Title="MainWindow" x:Name="MyWindow" Height="500" Width="900">
<Grid Background="{DynamicResource color363636}">
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{DynamicResource color272727}" Margin="10" CornerRadius="10" Padding="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Text="Person auswählen:" FontFamily="Calibri" FontSize="14" FontWeight="Bold" Foreground="{DynamicResource color9B9B9B}">
</TextBlock>
<ComboBox x:Name="PersonComboBox" Grid.Column="1" SelectionChanged="PersonComboBox_SelectionChanged" Height="30">
</ComboBox>
</Grid>
</Border>
<Border Grid.Column="1" Background="{DynamicResource color272727}" Margin="10" CornerRadius="10" Padding="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Text="Datum auswählen:" FontFamily="Calibri" FontSize="14" FontWeight="Bold" Foreground="{DynamicResource color9B9B9B}">
</TextBlock>
<ComboBox x:Name="DateComboBox" Grid.Column="1" SelectionChanged="DateComboBox_SelectionChanged" Height="30">
</ComboBox>
</Grid>
</Border>
<Border Grid.Column="2" Background="{DynamicResource color272727}" Margin="10" CornerRadius="10" Padding="5" MouseLeftButtonUp="Border_MouseLeftButtonUp">
<TextBlock Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Zufällige Daten" FontFamily="Calibri" FontSize="14" FontWeight="Bold" Foreground="{DynamicResource color9B9B9B}">
</TextBlock>
</Border>
<Border Grid.Column="3" Background="{DynamicResource color272727}" Margin="10" CornerRadius="10" Padding="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<ComboBox x:Name="WarningBox" Grid.Row="0" Margin="5" Foreground="{DynamicResource colorFB9D28}" SelectionChanged="WarningBox_SelectionChanged">
</ComboBox>
<ComboBox x:Name="ErrorBox" Grid.Row="1" Margin="5" Foreground="{DynamicResource colorCE3D36}" SelectionChanged="ErrorBox_SelectionChanged">
</ComboBox>
<CheckBox x:Name="ThresholdButton" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Checked="ThresholdButton_StatusChanged" Unchecked="ThresholdButton_StatusChanged">
</CheckBox>
</Grid>
</Border>
</Grid>
<Grid x:Name="UCGrid" Grid.Row="2" Height="320" Width="620">
<uc:uDataGraph JsonData="{Binding ElementName=MyWindow, Path=DataModel.Data}" IndexTime="{Binding ElementName=MyWindow, Path=DataModel.IndexTime}" IndexValue="{Binding ElementName=MyWindow, Path=DataModel.IndexValue}" IndexDuration="{Binding ElementName=MyWindow, Path=DataModel.IndexDuration}" WarningThreshold="{Binding ElementName=MyWindow, Path=DataModel.WarniningThreshold}" ErrorThreshold="{Binding ElementName=MyWindow, Path=DataModel.ErrorThreshold}" IsThresholdActive="{Binding ElementName=MyWindow, Path=DataModel.IsThresholdActive}"/>
</Grid>
</Grid>
</Window>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GraphicData")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GraphicData")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GraphicData.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GraphicData.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GraphicData.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,30 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="CloseButtonBorder"
TargetType="{x:Type Border}">
<Setter Property="Height" Value="32"/>
<Setter Property="Background" Value="{DynamicResource color272727}"/>
<Setter Property="CornerRadius" Value="0,10,0,0"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="TextBlock.Foreground" Value="{DynamicResource color009DDD}"/>
</Trigger>
</Style.Triggers>
</Style>
<ControlTemplate x:Key="CloseButton"
TargetType="{x:Type Border}">
<Border>
<TextBlock Text="X" FontFamily="Calibri" FontSize="15" Foreground="{DynamicResource color9B9B9B}">
</TextBlock>
</Border>
</ControlTemplate>
</ResourceDictionary>

View File

@@ -0,0 +1,14 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="color9B9B9B" Color="#9B9B9B"/>
<SolidColorBrush x:Key="color009DDD" Color="#009DDD"/>
<SolidColorBrush x:Key="color363636" Color="#363636"/>
<SolidColorBrush x:Key="color414141" Color="#414141"/>
<SolidColorBrush x:Key="color272727" Color="#272727"/>
<SolidColorBrush x:Key="color1A1A1A" Color="#1A1A1A"/>
<SolidColorBrush x:Key="color75B159" Color="#75B159"/>
<SolidColorBrush x:Key="colorFB9D28" Color="#FB9D28"/>
<SolidColorBrush x:Key="colorCE3D36" Color="#CE3D36"/>
</ResourceDictionary>

View File

@@ -0,0 +1,15 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="color9B9B9B" Color="#3D3C3C"/>
<SolidColorBrush x:Key="color009DDD" Color="#009DDD"/>
<SolidColorBrush x:Key="color363636" Color="#E9E9E9"/>
<SolidColorBrush x:Key="color414141" Color="#414141"/>
<SolidColorBrush x:Key="color272727" Color="#F2F2F2"/>
<SolidColorBrush x:Key="color1A1A1A" Color="#F7FAFA"/>
<SolidColorBrush x:Key="color75B159" Color="#75B159"/>
<SolidColorBrush x:Key="colorFB9D28" Color="#FB9D28"/>
<SolidColorBrush x:Key="colorCE3D36" Color="#CE3D36"/>
</ResourceDictionary>

View File

@@ -0,0 +1,207 @@
<UserControl x:Class="GraphicData.User_Control.uDataGraph"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
mc:Ignorable="d"
d:DesignHeight="320" d:DesignWidth="620">
<Border CornerRadius="10" Background="{DynamicResource color272727}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="42"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="32"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Background="{DynamicResource color272727}" CornerRadius="10,0,0,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" x:Name="TitleBlock" HorizontalAlignment="Center" Margin="0,5,-42,0" FontFamily="Calibri" FontSize="14" FontWeight="Bold" Foreground="{DynamicResource color9B9B9B}">
</TextBlock>
<TextBlock Grid.Row="1" x:Name="DateBlock" HorizontalAlignment="Center" Margin="0,0,-42,0" FontFamily="Calibri" FontSize="13" FontWeight="Regular" Foreground="{DynamicResource color9B9B9B}">
</TextBlock>
</Grid>
</Border>
<Border Grid.Column="2" Height="32" Background="{DynamicResource color272727}" CornerRadius="0,10,0,0" Padding="0,5,5,0" VerticalAlignment="Top" MouseEnter="Border_MouseEnter" MouseLeave="Border_MouseLeave" MouseLeftButtonUp="Border_MouseLeftButtonUp" TouchDown="Border_TouchDown">
<ico:AdaptableIcon x:Name="CloseButton" SelectedInternIcon="window_close" PrimaryIconColor="{DynamicResource color9B9B9B}" VerticalAlignment="Center" HorizontalAlignment="Center" BorderThickness="0" BorderPadding="0" IconHeight="10" IconWidth="10" Visibility="Visible">
</ico:AdaptableIcon>
</Border>
</Grid>
<Grid Grid.Row="1" Margin="10,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="32"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>
<Grid Grid.Column="0" Grid.Row="0" Background="{DynamicResource color272727}">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Grid.RowSpan="5" x:Name="GraphicBorder" Panel.ZIndex="1">
<Border x:Name="CanvasBorder">
<Canvas x:Name="GraphicCanvas" Panel.ZIndex="1"/>
</Border>
</Border>
<Border Grid.Row="0" BorderThickness="1" Height="1" Margin="5,0,5,0">
<Border.BorderBrush>
<DrawingBrush Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="{DynamicResource color414141}">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,50,50" />
<RectangleGeometry Rect="50,50,50,0" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Border.BorderBrush>
</Border>
<Border Grid.Row="1" BorderThickness="1" Height="1" Margin="5,0,5,0">
<Border.BorderBrush>
<DrawingBrush Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="{DynamicResource color414141}">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,50,50" />
<RectangleGeometry Rect="50,50,50,0" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Border.BorderBrush>
</Border>
<Border Grid.Row="2" BorderThickness="1" Height="1" Margin="5,0,5,0">
<Border.BorderBrush>
<DrawingBrush Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="{DynamicResource color414141}">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,50,50" />
<RectangleGeometry Rect="50,50,50,0" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Border.BorderBrush>
</Border>
<Border Grid.Row="3" BorderThickness="1" Height="1" Margin="5,0,5,0">
<Border.BorderBrush>
<DrawingBrush Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="{DynamicResource color414141}">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,50,50" />
<RectangleGeometry Rect="50,50,50,0" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Border.BorderBrush>
</Border>
<Border Grid.Row="4" BorderThickness="1" Height="1" Margin="5,0,5,0">
<Border.BorderBrush>
<DrawingBrush Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="{DynamicResource color414141}">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,50,50" />
<RectangleGeometry Rect="50,50,50,0" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Border.BorderBrush>
</Border>
</Grid>
<Border Name="PercentBorder" Grid.Column="2" Grid.Row="0" Background="{DynamicResource color272727}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="100%" VerticalAlignment="Center" FontFamily="Calibri" FontSize="11" Foreground="{DynamicResource color9B9B9B}">
</TextBlock>
<TextBlock Grid.Row="1" Text="75%" VerticalAlignment="Center" FontFamily="Calibri" FontSize="11" Foreground="{DynamicResource color9B9B9B}">
</TextBlock>
<TextBlock Grid.Row="2" Text="50%" VerticalAlignment="Center" FontFamily="Calibri" FontSize="11" Foreground="{DynamicResource color9B9B9B}">
</TextBlock>
<TextBlock Grid.Row="3" Text="25%" VerticalAlignment="Center" FontFamily="Calibri" FontSize="11" Foreground="{DynamicResource color9B9B9B}">
</TextBlock>
<TextBlock Grid.Row="4" Text="0%" VerticalAlignment="Center" FontFamily="Calibri" FontSize="11" Foreground="{DynamicResource color9B9B9B}">
</TextBlock>
</Grid>
</Border>
<Grid x:Name="TimeStampGrid" Grid.Column="0" Grid.Row="1" Background="{DynamicResource color272727}" Margin="0,0,0,15">
</Grid>
</Grid>
</Grid>
</Border>
</UserControl>

View File

@@ -0,0 +1,401 @@
using GraphicData.Class;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace GraphicData.User_Control
{
public partial class uDataGraph : UserControl
{
public uDataGraph()
{
InitializeComponent();
}
#region Variables
int DataDurationStart = 0;
int DataDurationEnd = 0;
int DataDurationTotal = 0;
bool ReducedTimeStamps = false;
DateTime firstTime;
#endregion
#region Properties
public List<object[]> JsonData
{
get { return (List<object[]>)GetValue(JsonDataProperty); }
set { SetValue(JsonDataProperty, value); }
}
// Using a DependencyProperty as the backing store for JsonData. This enables animation, styling, binding, etc...
public static readonly DependencyProperty JsonDataProperty =
DependencyProperty.Register("JsonData", typeof(List<object[]>), typeof(uDataGraph), new PropertyMetadata(new List<object[]>(), new PropertyChangedCallback(HandleDependancyPropertyChanged)));
public int IndexTime
{
get { return (int)GetValue(IndexTimeProperty); }
set { SetValue(IndexTimeProperty, value); }
}
// Using a DependencyProperty as the backing store for IndexTime. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IndexTimeProperty =
DependencyProperty.Register("IndexTime", typeof(int), typeof(uDataGraph), new PropertyMetadata(0, new PropertyChangedCallback(HandleDependancyPropertyChanged)));
public int IndexValue
{
get { return (int)GetValue(IndexValueProperty); }
set { SetValue(IndexValueProperty, value); }
}
// Using a DependencyProperty as the backing store for IndexValue. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IndexValueProperty =
DependencyProperty.Register("IndexValue", typeof(int), typeof(uDataGraph), new PropertyMetadata(1, new PropertyChangedCallback(HandleDependancyPropertyChanged)));
public int IndexDuration
{
get { return (int)GetValue(IndexDurationProperty); }
set { SetValue(IndexDurationProperty, value); }
}
// Using a DependencyProperty as the backing store for IndexDuration. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IndexDurationProperty =
DependencyProperty.Register("IndexDuration", typeof(int), typeof(uDataGraph), new PropertyMetadata(2, new PropertyChangedCallback(HandleDependancyPropertyChanged)));
public int WarningThreshold
{
get { return (int)GetValue(WarningThresholdProperty); }
set { SetValue(WarningThresholdProperty, value); }
}
// Using a DependencyProperty as the backing store for WarningThreshold. This enables animation, styling, binding, etc...
public static readonly DependencyProperty WarningThresholdProperty =
DependencyProperty.Register("WarningThreshold", typeof(int), typeof(uDataGraph), new PropertyMetadata(40, new PropertyChangedCallback(HandleDependancyPropertyChanged)));
public int ErrorThreshold
{
get { return (int)GetValue(ErrorThresholdProperty); }
set { SetValue(ErrorThresholdProperty, value); }
}
// Using a DependencyProperty as the backing store for ErrorThreshold. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ErrorThresholdProperty =
DependencyProperty.Register("ErrorThreshold", typeof(int), typeof(uDataGraph), new PropertyMetadata(60, new PropertyChangedCallback(HandleDependancyPropertyChanged)));
public bool IsThresholdActive
{
get { return (bool)GetValue(IsThresholdActiveProperty); }
set { SetValue(IsThresholdActiveProperty, value); }
}
// Using a DependencyProperty as the backing store for IsThresholdActive. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IsThresholdActiveProperty =
DependencyProperty.Register("IsThresholdActive", typeof(bool), typeof(uDataGraph), new PropertyMetadata(false, new PropertyChangedCallback(HandleDependancyPropertyChanged)));
public string GraphicTitle
{
get { return (string)GetValue(GraphicTitleProperty); }
set { SetValue(GraphicTitleProperty, value); }
}
// Using a DependencyProperty as the backing store for GraphicTitle. This enables animation, styling, binding, etc...
public static readonly DependencyProperty GraphicTitleProperty =
DependencyProperty.Register("GraphicTitle", typeof(string), typeof(uDataGraph), new PropertyMetadata("CPU-Auslastung", new PropertyChangedCallback(HandleDependancyPropertyChanged)));
private static void HandleDependancyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if(!(d is uDataGraph me)) return;
me.BindingValueChange();
}
#endregion
#region Binding
public void BindingValueChange()
{
if (JsonData == null || JsonData.Count <= 0) return;
GraphicCanvas.Children.Clear();
TimeStampGrid.Children.Clear();
TimeStampGrid.ColumnDefinitions.Clear();
GraphicDataProperty.Clear();
ReducedTimeStamps = false;
FillGraphicDataProperty();
FillVariables();
CreateDateTitle();
SetCanvasBorderPadding();
CreateTimeStamps();
DrawGraphicData();
}
#endregion
#region GraphicDataProperty
public List<cGraphicData> GraphicDataProperty { get; set; } = new List<cGraphicData>();
public void FillGraphicDataProperty()
{
var reverseData = JsonData.ToList();
reverseData.Reverse();
if ((DateTime)reverseData[0][IndexTime] < (DateTime)reverseData[reverseData.Count() - 1][IndexTime])
{
foreach (var item in reverseData)
{
cGraphicData data = new cGraphicData();
data.DataValue = (double)item[IndexValue];
data.DataDuration = int.Parse(item[IndexDuration].ToString());
data.DataTime = (DateTime)item[IndexTime];
data.DataTime = data.DataTime.AddHours(2);
GraphicDataProperty.Add(data);
}
}
else if ((DateTime)JsonData[0][IndexTime] < (DateTime)JsonData[JsonData.Count() - 1][IndexTime])
{
foreach (var item in JsonData)
{
cGraphicData data = new cGraphicData();
data.DataValue = (double)item[IndexValue];
data.DataDuration = int.Parse(item[IndexDuration].ToString());
data.DataTime = (DateTime)item[IndexTime];
data.DataTime = data.DataTime.AddHours(2);
GraphicDataProperty.Add(data);
}
}
}
#endregion
#region FillVariables
public void FillVariables()
{
firstTime = GraphicDataProperty.First<cGraphicData>().DataTime;
DateTime lastTime = GraphicDataProperty.Last<cGraphicData>().DataTime;
int lastDuration = GraphicDataProperty.Last<cGraphicData>().DataDuration;
lastTime = lastTime.AddMilliseconds(lastDuration);
DataDurationStart = firstTime.Hour;
if(lastTime.Minute != 0)
{
lastTime = lastTime.AddMinutes(60 - (lastDuration/60000));
}
DataDurationEnd = lastTime.Hour;
DataDurationTotal = DataDurationEnd - DataDurationStart;
if (firstTime.Day < lastTime.Day)
{
if (DataDurationTotal < 2)
{
DataDurationTotal = (24 - DataDurationStart) + DataDurationEnd;
}
}
if(DataDurationTotal > 10)
{
ReducedTimeStamps = true;
if(DataDurationTotal % 2 == 1)
{
DataDurationTotal += 1;
}
}
}
#endregion
#region Create Date Title
public void CreateDateTitle()
{
DateTime dataDate = GraphicDataProperty.First<cGraphicData>().DataTime;
dataDate = dataDate.Date;
DateBlock.Text = dataDate.ToString("dddd, dd.MM.yyyy");
TitleBlock.Text = GraphicTitle;
}
#endregion
#region SetCanvasBorderPadding
public void SetCanvasBorderPadding()
{
double borderWidth = GraphicBorder.ActualWidth;
double paddingWidth = borderWidth / (((double)DataDurationTotal + 1)* 2.0);
double borderHeight = GraphicBorder.ActualHeight;
double paddingHeight = borderHeight / 10.0;
GraphicBorder.Padding = new Thickness(0);
GraphicBorder.Padding = new Thickness(paddingWidth, paddingHeight - 4, paddingWidth, paddingHeight - 4);
GraphicBorder.UpdateLayout();
CanvasBorder.UpdateLayout();
}
#endregion
#region Time Stamps
public void CreateTimeStamps()
{
SolidColorBrush customBrush = (SolidColorBrush)Application.Current.Resources["color9B9B9B"];
for (int i = 0; i <= DataDurationTotal; i++)
{
ColumnDefinition timeStamp = new ColumnDefinition();
timeStamp.Width = new GridLength(1, GridUnitType.Star);
TimeStampGrid.ColumnDefinitions.Add(timeStamp);
if (ReducedTimeStamps == true && i % 2 == 1)
{
continue;
}
TextBlock TimeStampText = new TextBlock()
{
Text = (firstTime.AddHours(i)).Hour.ToString() + ":00",
FontFamily = new FontFamily("Calibri"),
FontSize = 11,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Foreground = customBrush,
TextAlignment = TextAlignment.Center,
TextTrimming = TextTrimming.None,
};
if(DataDurationTotal > 20)
{
TimeStampText.Margin = new Thickness(-2,0,-2,0);
}
Grid.SetColumn(TimeStampText, i);
TimeStampGrid.Children.Add(TimeStampText);
}
}
#endregion
#region Draw Data
public double CalculateSetLeft(DateTime dataTime)
{
double setLeft = (double)dataTime.Hour + ((double)dataTime.Minute / 60.0);
setLeft = (setLeft - (double)DataDurationStart) * ((double)CanvasBorder.ActualWidth / ((double)DataDurationTotal));
return setLeft;
}
public void DrawGraphicData()
{
double setLeft = 0.0;
double setFactor = 0.0;
setFactor = (GraphicCanvas.ActualHeight - 8.0) / 100.0;
foreach (var data in GraphicDataProperty)
{
DateTime dataTime = data.DataTime;
double dataValue = data.DataValue;
int dataDuration = data.DataDuration;
Border border = new Border
{
Height = 8.0,
Width = (double)dataDuration * ((double)CanvasBorder.ActualWidth / ((double)DataDurationTotal)) / 3600000.0,
CornerRadius = new CornerRadius(4.0),
ToolTip = dataTime.ToShortTimeString() + " - " + dataTime.AddMilliseconds(dataDuration).ToShortTimeString() + " | " + (int)dataValue + "%"
};
if(border.Width < 8)
{
border.Width = 8;
}
if(IsThresholdActive == false)
{
border.Background = new SolidColorBrush(Color.FromRgb(0, 157, 221));
}
else if(dataValue >= ErrorThreshold)
{
border.Background = new SolidColorBrush(Color.FromRgb(206, 61, 54));
}
else if(dataValue >= WarningThreshold)
{
border.Background = new SolidColorBrush(Color.FromRgb(251, 157, 40));
}
else
{
border.Background = new SolidColorBrush(Color.FromRgb(117, 177, 89));
}
setLeft = CalculateSetLeft(dataTime);
Canvas.SetBottom(border, dataValue * setFactor);
Canvas.SetLeft(border, setLeft);
GraphicCanvas.Children.Add(border);
}
}
#endregion
#region Close Button
private void Border_MouseEnter(object sender, MouseEventArgs e)
{
SolidColorBrush customBrush = (SolidColorBrush)Application.Current.Resources["color009DDD"];
CloseButton.PrimaryIconColor = customBrush;
}
private void Border_MouseLeave(object sender, MouseEventArgs e)
{
SolidColorBrush customBrush = (SolidColorBrush)Application.Current.Resources["color9B9B9B"];
CloseButton.PrimaryIconColor = customBrush;
}
private void Border_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
Close_Window();
}
private void Border_TouchDown(object sender, TouchEventArgs e)
{
Close_Window();
}
private Window GetMainWindow()
{
DependencyObject parent = VisualTreeHelper.GetParent(this);
while (parent != null && !(parent is Window))
{
parent = VisualTreeHelper.GetParent(parent);
}
return parent as Window;
}
private void Close_Window()
{
Window mainWindow = Window.GetWindow(this);
if (mainWindow != null)
{
mainWindow.Close();
}
}
#endregion
}
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
</packages>