Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AboutWindow.axaml.cs « Windows « UVtools.WPF - github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b8c5f8ade433c24687ee9d4d88d6d11e793b0dab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using Avalonia;
using Avalonia.Markup.Xaml;
using Emgu.CV;
using Emgu.CV.Stitching;
using UVtools.Core;
using UVtools.WPF.Controls;

namespace UVtools.WPF.Windows
{
    public class AboutWindow : WindowEx
    {
        public string Software => About.Software;
        public string Version => $"Version: {App.VersionStr} {RuntimeInformation.ProcessArchitecture}";
        public string Copyright => App.AssemblyCopyright;
        public string Company => App.AssemblyCompany;
        public string Description => App.AssemblyDescription;

        public string OSDescription => $"{RuntimeInformation.OSDescription} {RuntimeInformation.OSArchitecture}";

        public string RuntimeDescription => RuntimeInformation.RuntimeIdentifier;

        public string FrameworkDescription => RuntimeInformation.FrameworkDescription;

        public string OpenCVDescription
        {
            get
            {
                var match = Regex.Match(CvInvoke.BuildInformation, @"(?:Version control:\s*)(\S*)");
                if (!match.Success) return "Not found!";
                return match.Groups[1].Value;
            }
        }
        public int ProcessorCount => Environment.ProcessorCount;
        public int ScreenCount => Screens.ScreenCount;
        //public string ScreenResolution => $"{Screens.Primary.Bounds.Width} x {Screens.Primary.Bounds.Height} @ {Screens.Primary.PixelDensity*100}%";
        //public string WorkingArea => $"{Screens.Primary.WorkingArea.Width} x {Screens.Primary.WorkingArea.Height}";
        //public string RealWorkingArea => $"{App.MaxWindowSize.Width} x {App.MaxWindowSize.Height}";

        public string ScreensDescription
        {
            get
            {
                var result = new StringBuilder();
                for (int i = 0; i < Screens.All.Count; i++)
                {
                    var onScreen = Screens.ScreenFromVisual(App.MainWindow);
                    var screen = Screens.All[i];
                    result.AppendLine($"{i+1}: {screen.Bounds.Width} x {screen.Bounds.Height} @ {screen.PixelDensity * 100}%" + 
                        (screen.Primary ? " (Primary)" : string.Empty) +
                        (onScreen == screen ? " (On this)" : string.Empty)                        
                        );
                    result.AppendLine($"    WA: {screen.WorkingArea.Width} x {screen.WorkingArea.Height}    UA: {Math.Round(screen.WorkingArea.Width / screen.PixelDensity)} x {Math.Round(screen.WorkingArea.Height / screen.PixelDensity)}");
                }
                return result.ToString().TrimEnd();
            }
        }

        public AboutWindow()
        {
            InitializeComponent();
            DataContext = this;
            Environment.OSVersion.Version.ToString();
        }

        private void InitializeComponent()
        {
            AvaloniaXamlLoader.Load(this);
        }

        public void SetOpenCVInformationToClipboard()
        {
            Application.Current.Clipboard.SetTextAsync(CvInvoke.BuildInformation);
        } 
    }
}