From 81bead50114f4fe3df9ef93c11e5eef6453e526c Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 24 Jul 2023 22:25:51 +0200 Subject: [PATCH] Version 1.5.8605 Version 1.5.8605 ----------------------------------------------------------------- Frontend related changes - Feature: "Help" -> "Changelog" will show up this info. - Improvement: Auto scroll feature. Scrolling down when a tasklist executes now also keep the most left cell in focus. Backend related changes - Feature: Added internal variable + CUSTOMPROJECTFILE="C:\Path\where\project-file\is\placed.rfprj" would load the specified project file. NOTE: When a projectfile gets loaded, its fullpath is memorized. This enables the AUTORUN=1 feature to start all tasks once. If the CUSTOMPROJECTFILE is used instead, the last used project is ignored --- RFiDGear/Properties/AssemblyInfo.cs | 2 +- RFiDGear/RFiDGear.csproj.user | 2 +- RFiDGear/Resources/Manifest.de.resx | 3 + RFiDGear/Resources/Manifest.en.resx | 3 + RFiDGear/View/AboutView.xaml | 2 +- RFiDGear/View/MainWindow.xaml | 1 + RFiDGear/View/MainWindow.xaml.cs | 6 +- RFiDGear/ViewModel/MainWindowViewModel.cs | 302 ++++++++++++---------- 8 files changed, 185 insertions(+), 136 deletions(-) diff --git a/RFiDGear/Properties/AssemblyInfo.cs b/RFiDGear/Properties/AssemblyInfo.cs index 320fc63..8662ea3 100644 --- a/RFiDGear/Properties/AssemblyInfo.cs +++ b/RFiDGear/Properties/AssemblyInfo.cs @@ -25,6 +25,6 @@ // // You can specify all the values or you can use the default the Revision and // Build Numbers by using the '*' as shown below: -[assembly: AssemblyVersion("1.4.*")] +[assembly: AssemblyVersion("1.5.*")] [assembly: Guid("a34bc413-e349-4fd1-8b90-2eb95a333436")] [assembly: NeutralResourcesLanguage("")] diff --git a/RFiDGear/RFiDGear.csproj.user b/RFiDGear/RFiDGear.csproj.user index a1b1725..7177512 100644 --- a/RFiDGear/RFiDGear.csproj.user +++ b/RFiDGear/RFiDGear.csproj.user @@ -1,7 +1,7 @@  - REPORTTARGETPATH="C:\temp\test file-%3f%3f.pdf" AUTORUN=0 %24JobNumber=1234 %24CardType= + REPORTTARGETPATH="C:\temp\test file-%3f%3f.pdf" AUTORUN=0 %24JobNumber=1234 CUSTOMPROJECTFILE="D:\CardCheck_Data\KPruefung_Vorlagen\00_RFID_Gear_Vorlage\CardCheckAssistant.rfPrj" D:\Seafile\Dokumente Privat\Steven\Projekte\Software\Windows\RFIDGear\RFiDGear\bin\Debug\ diff --git a/RFiDGear/Resources/Manifest.de.resx b/RFiDGear/Resources/Manifest.de.resx index c308257..5ab4c22 100644 --- a/RFiDGear/Resources/Manifest.de.resx +++ b/RFiDGear/Resources/Manifest.de.resx @@ -1508,4 +1508,7 @@ https://github.com/c3rebro/rfidgear Prüfung auf Multitechnologiekarte + + Changelog + \ No newline at end of file diff --git a/RFiDGear/Resources/Manifest.en.resx b/RFiDGear/Resources/Manifest.en.resx index 7b0c800..5022ce9 100644 --- a/RFiDGear/Resources/Manifest.en.resx +++ b/RFiDGear/Resources/Manifest.en.resx @@ -1486,4 +1486,7 @@ https://github.com/c3rebro/rfidgear Check Tag Is MultiTag + + Changelog + \ No newline at end of file diff --git a/RFiDGear/View/AboutView.xaml b/RFiDGear/View/AboutView.xaml index 2aaceec..9babd09 100644 --- a/RFiDGear/View/AboutView.xaml +++ b/RFiDGear/View/AboutView.xaml @@ -47,7 +47,7 @@ HorizontalAlignment="Center" VerticalAlignment="Center"> - Changelog + Show on GitHub diff --git a/RFiDGear/View/MainWindow.xaml b/RFiDGear/View/MainWindow.xaml index 73707ca..5b1665b 100644 --- a/RFiDGear/View/MainWindow.xaml +++ b/RFiDGear/View/MainWindow.xaml @@ -569,6 +569,7 @@ Header="{Binding LocalizationResourceSet, Converter={StaticResource Localization}, ConverterParameter='menuItemHelpHeader'}"> + diff --git a/RFiDGear/View/MainWindow.xaml.cs b/RFiDGear/View/MainWindow.xaml.cs index 44c8688..a0be5c3 100644 --- a/RFiDGear/View/MainWindow.xaml.cs +++ b/RFiDGear/View/MainWindow.xaml.cs @@ -6,6 +6,7 @@ using System.Windows.Input; using System.Windows.Media; using System; +using RFiDGear.Model; namespace RFiDGear { @@ -119,7 +120,8 @@ static void OnSelectingItemChanged(DependencyObject sender, DependencyPropertyCh if (grid.SelectedItem != null) { - grid.ScrollIntoView(grid.SelectedItem, null); + grid.ScrollIntoView(grid.SelectedItem, grid.Columns[0]); + } }); @@ -129,7 +131,7 @@ static void OnSelectingItemChanged(DependencyObject sender, DependencyPropertyCh grid.UpdateLayout(); if (grid.SelectedItem != null) { - grid.ScrollIntoView(grid.SelectedItem, null); + grid.ScrollIntoView(grid.SelectedItem, grid.Columns[0]); } })); } diff --git a/RFiDGear/ViewModel/MainWindowViewModel.cs b/RFiDGear/ViewModel/MainWindowViewModel.cs index a8b696a..666bf85 100644 --- a/RFiDGear/ViewModel/MainWindowViewModel.cs +++ b/RFiDGear/ViewModel/MainWindowViewModel.cs @@ -19,21 +19,6 @@ * - */ -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; - -using Log4CSharp; - -using MefMvvm.SharedContracts.ViewModel; - -using MvvmDialogs.ViewModels; - -using RedCell.Diagnostics.Update; - -using RFiDGear.DataAccessLayer; -using RFiDGear.DataAccessLayer.Remote.FromIO; -using RFiDGear.Model; - using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -43,13 +28,21 @@ using System.IO; using System.Linq; using System.Reflection; -using System.Runtime.Remoting.Messaging; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Threading; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using Log4CSharp; +using MefMvvm.SharedContracts.ViewModel; +using MvvmDialogs.ViewModels; +using RedCell.Diagnostics.Update; +using RFiDGear.DataAccessLayer; +using RFiDGear.DataAccessLayer.Remote.FromIO; +using RFiDGear.Model; namespace RFiDGear.ViewModel { @@ -286,11 +279,25 @@ private void OnNewGetAddEditCommand() } private void OpenLastProjectFile() + { + OpenLastProjectFile(string.Empty); + } + + private void OpenLastProjectFile(string projectFileToUse) { using (var settings = new SettingsReaderWriter()) { var autoLoadLastUsedDB = settings.DefaultSpecification.AutoLoadProjectOnStart; - var lastUsedDBPath = settings.DefaultSpecification.LastUsedProjectPath; + string lastUsedDBPath; + + if (string.IsNullOrEmpty(projectFileToUse)) + { + lastUsedDBPath = settings.DefaultSpecification.LastUsedProjectPath; + } + else + { + lastUsedDBPath = projectFileToUse; + } culture = (settings.DefaultSpecification.DefaultLanguage == "german") ? new CultureInfo("de-DE") : new CultureInfo("en-US"); @@ -410,6 +417,15 @@ private void OnNewRemoveChipsFromTreeCommand() TreeViewParentNodes.Clear(); } + /// + /// Show Detailed Version Info + /// + public ICommand ShowChangeLogCommand => new RelayCommand(OnNewShowChangeLogCommand); + private void OnNewShowChangeLogCommand() + { + AskForUpdateNow(true); + } + /// /// Show Detailed Version Info /// @@ -1893,7 +1909,6 @@ private void OnNewCheckUpdateCommand() } } - /// /// /// @@ -2137,19 +2152,27 @@ private void EnableUpdate(object sender, EventArgs e) } private void AskForUpdateNow() + { + AskForUpdateNow(false); + } + + private void AskForUpdateNow(bool updateDisabled) { userIsNotifiedForAvailableUpdate = false; Dialogs.Add(new UpdateNotifierViewModel(updater.UpdateInfoText) { - Caption = "Update Available", + + Caption = updateDisabled ? "Changelog" : "Update Available", OnOk = (updateAction) => { - Mouse.OverrideCursor = Cursors.AppStarting; - updater.Update(); + if (!updateDisabled) + { + Mouse.OverrideCursor = Cursors.AppStarting; + updater.Update(); + } updateAction.Close(); - Mouse.OverrideCursor = null; }, OnCancel = (updateAction) => @@ -2189,168 +2212,185 @@ private void LoadCompleted(object sender, EventArgs e) mw = (MainWindow)Application.Current.MainWindow; mw.Title = string.Format("RFiDGear {0}.{1}", Version.Major, Version.Minor); - if (firstRun) - { - Task refreshStatusBarThread; + if (firstRun) + { + Task refreshStatusBarThread; + + var projectFileToUse = ""; - firstRun = false; + firstRun = false; - try + try + { + using (var settings = new SettingsReaderWriter()) { - using (var settings = new SettingsReaderWriter()) + if (args.Length > 1) { - if (args.Length > 1) + foreach (var arg in args) { - foreach (var arg in args) + switch (arg.Split('=')[0]) { - switch (arg.Split('=')[0]) - { - case "LASTUSEDPROJECTPATH": - if (File.Exists(arg.Split('=')[1])) - { - settings.DefaultSpecification.LastUsedProjectPath = new DirectoryInfo(arg.Split('=')[1]).FullName; - settings.SaveSettings(); - } - break; - default: + case "LASTUSEDPROJECTPATH": + if (File.Exists(arg.Split('=')[1])) + { + settings.DefaultSpecification.LastUsedProjectPath = new DirectoryInfo(arg.Split('=')[1]).FullName; + settings.SaveSettings(); + } + break; + + case "CUSTOMPROJECTFILE": + + if (File.Exists(arg.Split('=')[1])) + { + projectFileToUse = new DirectoryInfo(arg.Split('=')[1]).FullName; + } + break; + + default: break; - } } } + } - CurrentReader = string.IsNullOrWhiteSpace(settings.DefaultSpecification.DefaultReaderName) - ? Enum.GetName(typeof(ReaderTypes), settings.DefaultSpecification.DefaultReaderProvider) - : settings.DefaultSpecification.DefaultReaderName; + CurrentReader = string.IsNullOrWhiteSpace(settings.DefaultSpecification.DefaultReaderName) + ? Enum.GetName(typeof(ReaderTypes), settings.DefaultSpecification.DefaultReaderProvider) + : settings.DefaultSpecification.DefaultReaderName; - if (int.TryParse(settings.DefaultSpecification.LastUsedComPort, out var portNumber)) - { - ReaderDevice.PortNumber = portNumber; - } + if (int.TryParse(settings.DefaultSpecification.LastUsedComPort, out var portNumber)) + { + ReaderDevice.PortNumber = portNumber; + } - else - { - ReaderDevice.PortNumber = 0; - } + else + { + ReaderDevice.PortNumber = 0; + } - culture = (settings.DefaultSpecification.DefaultLanguage == "german") ? new CultureInfo("de-DE") : new CultureInfo("en-US"); + culture = (settings.DefaultSpecification.DefaultLanguage == "german") ? new CultureInfo("de-DE") : new CultureInfo("en-US"); - var autoLoadLastUsedDB = settings.DefaultSpecification.AutoLoadProjectOnStart; + var autoLoadLastUsedDB = settings.DefaultSpecification.AutoLoadProjectOnStart; - var mySplash = new SplashScreenViewModel(); + var mySplash = new SplashScreenViewModel(); - if (autoLoadLastUsedDB) - { - Dialogs.Add(mySplash); - } + if (autoLoadLastUsedDB) + { + Dialogs.Add(mySplash); + } - if (autoLoadLastUsedDB) + if (autoLoadLastUsedDB) + { + if (string.IsNullOrEmpty(projectFileToUse)) { OpenLastProjectFile(); } - - refreshStatusBarThread = new Task(() => + else { - while (true) - { - Thread.Sleep(500); - DateTimeStatusBar = string.Format("{0}", DateTime.Now); - } - }); + OpenLastProjectFile(projectFileToUse); + } + + } - refreshStatusBarThread.ContinueWith((x) => + refreshStatusBarThread = new Task(() => + { + while (true) { - }); + Thread.Sleep(500); + DateTimeStatusBar = string.Format("{0}", DateTime.Now); + } + }); - refreshStatusBarThread.Start(); + refreshStatusBarThread.ContinueWith((x) => + { + }); - + refreshStatusBarThread.Start(); - OnNewResetTaskStatusCommand(); - } + OnNewResetTaskStatusCommand(); + } - using (var settings = new SettingsReaderWriter()) + using (var settings = new SettingsReaderWriter()) + { + if (args.Length > 1) { - if (args.Length > 1) + foreach (var arg in args) { - foreach (var arg in args) + switch (arg.Split('=')[0]) { - switch (arg.Split('=')[0]) - { - case "REPORTTARGETPATH": + case "REPORTTARGETPATH": - variablesFromArgs.Add(arg.Split('=')[0], arg.Split('=')[1]); + variablesFromArgs.Add(arg.Split('=')[0], arg.Split('=')[1]); - if (Directory.Exists(Path.GetDirectoryName(arg.Split('=')[1]))) - { - reportOutputPath = arg.Split('=')[1]; - var numbersInFileNames = new int[Directory.GetFiles(Path.GetDirectoryName(reportOutputPath)).Length]; + if (Directory.Exists(Path.GetDirectoryName(arg.Split('=')[1]))) + { + reportOutputPath = arg.Split('=')[1]; + var numbersInFileNames = new int[Directory.GetFiles(Path.GetDirectoryName(reportOutputPath)).Length]; - if (reportOutputPath.Contains("?")) + if (reportOutputPath.Contains("?")) + { + for (int i = 0; i < numbersInFileNames.Length; i++) { - for (int i = 0; i < numbersInFileNames.Length; i++) - { - var fileName = Directory.GetFiles(Path.GetDirectoryName(reportOutputPath))[i]; + var fileName = Directory.GetFiles(Path.GetDirectoryName(reportOutputPath))[i]; - if (fileName.Replace(".pdf",string.Empty).ToLower().Contains(reportOutputPath.ToLower().Replace("?",string.Empty).Replace(".pdf",string.Empty))) - { - _ = int.TryParse(fileName.ToLower().Replace( - reportOutputPath.ToLower().Replace("?", string.Empty).Replace(".pdf", string.Empty), string.Empty).Replace(".pdf", string.Empty), out int n); - numbersInFileNames[i] = n; - } + if (fileName.Replace(".pdf",string.Empty).ToLower().Contains(reportOutputPath.ToLower().Replace("?",string.Empty).Replace(".pdf",string.Empty))) + { + _ = int.TryParse(fileName.ToLower().Replace( + reportOutputPath.ToLower().Replace("?", string.Empty).Replace(".pdf", string.Empty), string.Empty).Replace(".pdf", string.Empty), out int n); + numbersInFileNames[i] = n; } } + } - if (reportOutputPath.Contains("???")) - { - reportOutputPath = reportOutputPath.Replace("???", string.Format("{0:D3}", numbersInFileNames.Max() + 1)); - } + if (reportOutputPath.Contains("???")) + { + reportOutputPath = reportOutputPath.Replace("???", string.Format("{0:D3}", numbersInFileNames.Max() + 1)); + } - else if (reportOutputPath.Contains("??")) - { - reportOutputPath = reportOutputPath.Replace("??", string.Format("{0:D2}", numbersInFileNames.Max() + 1)); - } + else if (reportOutputPath.Contains("??")) + { + reportOutputPath = reportOutputPath.Replace("??", string.Format("{0:D2}", numbersInFileNames.Max() + 1)); + } - else if (reportOutputPath.Contains("?")) - { - reportOutputPath = reportOutputPath.Replace("?", string.Format("{0:D1}", numbersInFileNames.Max() + 1)); - } + else if (reportOutputPath.Contains("?")) + { + reportOutputPath = reportOutputPath.Replace("?", string.Format("{0:D1}", numbersInFileNames.Max() + 1)); } - break; + } + break; - case "AUTORUN": - if (arg.Split('=')[1] == "1") - { - _isLoadingProject = true; - OnNewWriteToChipOnceCommand(); - } - break; + case "AUTORUN": + if (arg.Split('=')[1] == "1") + { + _isLoadingProject = true; + OnNewWriteToChipOnceCommand(); + } + break; - default: - if (arg.Split('=')[0].Contains("$")) - { - variablesFromArgs.Add(arg.Split('=')[0], arg.Split('=')[1]); - } - break; - } + default: + if (arg.Split('=')[0].Contains("$")) + { + variablesFromArgs.Add(arg.Split('=')[0], arg.Split('=')[1]); + } + break; } } } } - catch (Exception ex) - { - LogWriter.CreateLogEntry(ex, FacilityName); - } + } + catch (Exception ex) + { + LogWriter.CreateLogEntry(ex, FacilityName); + } - using (var settings = new SettingsReaderWriter()) + using (var settings = new SettingsReaderWriter()) + { + if (settings.DefaultSpecification.AutoCheckForUpdates) { - if (settings.DefaultSpecification.AutoCheckForUpdates) - { - updater?.StartMonitoring(); - } + updater?.StartMonitoring(); } } + }