From f91aa54259d8b4b2c0f811a190ed0e3f12299752 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 31 Aug 2022 15:04:55 +0200 Subject: [PATCH] Version 1.0.8278 Version 1.0.8278 ----------------------------------------------------------------- First Mayor Release. Note: Earlier *.rfPrj project files are not compatible with this release. Frontend related changes - Feature: Added "Help" -> "About" to display detailed version info - Feature: Added "CheckMifareClassicSecturUnused" Tasktype for MF Classic - Improvement: Changed "TextBlock" to "TextBox" in Datagridcells of type "Content" to easily modify it's content - Improvement: Added "ReadChipPublic" to treeview contextmenu - Improvement: Added "AddNew" to treeview contextmenu - Improvement: Removed Hardcoded strings from ui Backend related changes - Abstraction of ReaderDevice. Ability to add more readers in future releases - DefaultKeys. AppMasterKey and Read/WriteKey become of type AES - Added GenericChip Interface to display more chiptypes without hardcoding their type in HierarchicalDataTemplateViewModel - Added GenericTask Interface to ease access to shared properties (e.g. taskindex...) - Fix: Need to restart Application when changing reader - Fix: Projects were not loaded under some circumstances - Improvement: Detect more different Chiptypes - Improvement: Translation --- RFiDGear.sln | 54 ++--- .../RedCell.Diagnostics.Update/Updater.cs | 2 + .../DataAccessLayer/Local/ResourceLoader.cs | 8 +- .../Remote/FromFile/ReportReaderWriter.cs | 1 + .../Remote/FromIO/ElatecNetProvider.cs | 13 +- .../Remote/FromIO/LibLogicalAccessProvider.cs | 1 + .../Remote/FromIO/ReaderDevice.cs | 12 +- RFiDGear/Resources/Manifest.de.resx | 69 ++++-- RFiDGear/Resources/Manifest.en.resx | 46 +++- RFiDGear/View/MainWindow.xaml | 50 ++++- .../TaskViews/CommonTask/CommonTaskView.xaml | 5 +- .../TabPageLogicTaskView.xaml | 30 ++- .../TabPageReportSettingsView.xaml | 68 ++++-- .../GenericChipTask/GenericChipTaskView.xaml | 2 +- .../RFiDChipParentLayerViewModel.cs | 84 +++++--- RFiDGear/ViewModel/MainWindowViewModel.cs | 203 +++++++----------- RFiDGear/ViewModel/SetupViewModel.cs | 16 +- .../CommonTaskViewModel.cs | 13 +- .../MifareClassicSetupViewModel.cs | 6 +- .../MifareUltralightSetupViewModel.cs | 2 - Setup/Product.wxs | 27 +-- 21 files changed, 422 insertions(+), 290 deletions(-) diff --git a/RFiDGear.sln b/RFiDGear.sln index ce87127..315c461 100644 --- a/RFiDGear.sln +++ b/RFiDGear.sln @@ -9,8 +9,6 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "Setup\Setup.wixpro EndProject Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "RFiDGearBundleSetup", "RFiDGearBundleSetup\RFiDGearBundleSetup.wixproj", "{5A7DF993-C696-4958-B7C9-9396122DFF21}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCNEditor", "..\VCNEditor\VCNEditor.csproj", "{909DB876-4A74-42AC-BACF-C681017D0C77}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ByteArray", "..\ByteArray\ByteArray.csproj", "{BDD5DF8C-6FC1-4882-8151-924820FDBC05}" ProjectSection(ProjectDependencies) = postProject {786D71E7-4D92-43E4-A9EB-4E07FFE36F70} = {786D71E7-4D92-43E4-A9EB-4E07FFE36F70} @@ -20,9 +18,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elatec.NET", "..\Elatec.NET EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Log4CSharp", "..\Log4CSharp\Log4CSharp.csproj", "{786D71E7-4D92-43E4-A9EB-4E07FFE36F70}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginSystem", "..\PluginSystem\PluginSystem.csproj", "{E99B606A-25B8-4113-9E75-5016CCFDB410}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVVMDialogs", "..\MVVMDialogs\MVVMDialogs.csproj", "{EF56252E-257F-41D1-974B-C9015071CE7E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginSystem", "..\PluginSystem\PluginSystem.csproj", "{E99B606A-25B8-4113-9E75-5016CCFDB410}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCNEditor", "..\VCNEditor\VCNEditor.csproj", "{909DB876-4A74-42AC-BACF-C681017D0C77}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -62,18 +62,6 @@ Global {5A7DF993-C696-4958-B7C9-9396122DFF21}.Release|x64.ActiveCfg = Release|x86 {5A7DF993-C696-4958-B7C9-9396122DFF21}.Release|x86.ActiveCfg = Release|x86 {5A7DF993-C696-4958-B7C9-9396122DFF21}.Release|x86.Build.0 = Release|x86 - {909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|Any CPU.Build.0 = Debug|Any CPU - {909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|x64.ActiveCfg = Debug|x64 - {909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|x64.Build.0 = Debug|x64 - {909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|x86.ActiveCfg = Debug|Any CPU - {909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|x86.Build.0 = Debug|Any CPU - {909DB876-4A74-42AC-BACF-C681017D0C77}.Release|Any CPU.ActiveCfg = Release|Any CPU - {909DB876-4A74-42AC-BACF-C681017D0C77}.Release|Any CPU.Build.0 = Release|Any CPU - {909DB876-4A74-42AC-BACF-C681017D0C77}.Release|x64.ActiveCfg = Release|x64 - {909DB876-4A74-42AC-BACF-C681017D0C77}.Release|x64.Build.0 = Release|x64 - {909DB876-4A74-42AC-BACF-C681017D0C77}.Release|x86.ActiveCfg = Release|Any CPU - {909DB876-4A74-42AC-BACF-C681017D0C77}.Release|x86.Build.0 = Release|Any CPU {BDD5DF8C-6FC1-4882-8151-924820FDBC05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BDD5DF8C-6FC1-4882-8151-924820FDBC05}.Debug|Any CPU.Build.0 = Debug|Any CPU {BDD5DF8C-6FC1-4882-8151-924820FDBC05}.Debug|x64.ActiveCfg = Debug|x64 @@ -110,18 +98,6 @@ Global {786D71E7-4D92-43E4-A9EB-4E07FFE36F70}.Release|x64.Build.0 = Release|x64 {786D71E7-4D92-43E4-A9EB-4E07FFE36F70}.Release|x86.ActiveCfg = Release|x86 {786D71E7-4D92-43E4-A9EB-4E07FFE36F70}.Release|x86.Build.0 = Release|x86 - {EF56252E-257F-41D1-974B-C9015071CE7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EF56252E-257F-41D1-974B-C9015071CE7E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EF56252E-257F-41D1-974B-C9015071CE7E}.Debug|x64.ActiveCfg = Debug|x64 - {EF56252E-257F-41D1-974B-C9015071CE7E}.Debug|x64.Build.0 = Debug|x64 - {EF56252E-257F-41D1-974B-C9015071CE7E}.Debug|x86.ActiveCfg = Debug|Any CPU - {EF56252E-257F-41D1-974B-C9015071CE7E}.Debug|x86.Build.0 = Debug|Any CPU - {EF56252E-257F-41D1-974B-C9015071CE7E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EF56252E-257F-41D1-974B-C9015071CE7E}.Release|Any CPU.Build.0 = Release|Any CPU - {EF56252E-257F-41D1-974B-C9015071CE7E}.Release|x64.ActiveCfg = Release|x64 - {EF56252E-257F-41D1-974B-C9015071CE7E}.Release|x64.Build.0 = Release|x64 - {EF56252E-257F-41D1-974B-C9015071CE7E}.Release|x86.ActiveCfg = Release|Any CPU - {EF56252E-257F-41D1-974B-C9015071CE7E}.Release|x86.Build.0 = Release|Any CPU {E99B606A-25B8-4113-9E75-5016CCFDB410}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E99B606A-25B8-4113-9E75-5016CCFDB410}.Debug|Any CPU.Build.0 = Debug|Any CPU {E99B606A-25B8-4113-9E75-5016CCFDB410}.Debug|x64.ActiveCfg = Debug|x64 @@ -134,6 +110,30 @@ Global {E99B606A-25B8-4113-9E75-5016CCFDB410}.Release|x64.Build.0 = Release|x64 {E99B606A-25B8-4113-9E75-5016CCFDB410}.Release|x86.ActiveCfg = Release|Any CPU {E99B606A-25B8-4113-9E75-5016CCFDB410}.Release|x86.Build.0 = Release|Any CPU + {EF56252E-257F-41D1-974B-C9015071CE7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EF56252E-257F-41D1-974B-C9015071CE7E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF56252E-257F-41D1-974B-C9015071CE7E}.Debug|x64.ActiveCfg = Debug|x64 + {EF56252E-257F-41D1-974B-C9015071CE7E}.Debug|x64.Build.0 = Debug|x64 + {EF56252E-257F-41D1-974B-C9015071CE7E}.Debug|x86.ActiveCfg = Debug|Any CPU + {EF56252E-257F-41D1-974B-C9015071CE7E}.Debug|x86.Build.0 = Debug|Any CPU + {EF56252E-257F-41D1-974B-C9015071CE7E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EF56252E-257F-41D1-974B-C9015071CE7E}.Release|Any CPU.Build.0 = Release|Any CPU + {EF56252E-257F-41D1-974B-C9015071CE7E}.Release|x64.ActiveCfg = Release|x64 + {EF56252E-257F-41D1-974B-C9015071CE7E}.Release|x64.Build.0 = Release|x64 + {EF56252E-257F-41D1-974B-C9015071CE7E}.Release|x86.ActiveCfg = Release|Any CPU + {EF56252E-257F-41D1-974B-C9015071CE7E}.Release|x86.Build.0 = Release|Any CPU + {909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|Any CPU.Build.0 = Debug|Any CPU + {909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|x64.ActiveCfg = Debug|x64 + {909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|x64.Build.0 = Debug|x64 + {909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|x86.ActiveCfg = Debug|x86 + {909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|x86.Build.0 = Debug|x86 + {909DB876-4A74-42AC-BACF-C681017D0C77}.Release|Any CPU.ActiveCfg = Release|Any CPU + {909DB876-4A74-42AC-BACF-C681017D0C77}.Release|Any CPU.Build.0 = Release|Any CPU + {909DB876-4A74-42AC-BACF-C681017D0C77}.Release|x64.ActiveCfg = Release|x64 + {909DB876-4A74-42AC-BACF-C681017D0C77}.Release|x64.Build.0 = Release|x64 + {909DB876-4A74-42AC-BACF-C681017D0C77}.Release|x86.ActiveCfg = Release|x86 + {909DB876-4A74-42AC-BACF-C681017D0C77}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/RFiDGear/3rdParty/RedCell/RedCell.Diagnostics.Update/Updater.cs b/RFiDGear/3rdParty/RedCell/RedCell.Diagnostics.Update/Updater.cs index 4dcd256..5df2b71 100644 --- a/RFiDGear/3rdParty/RedCell/RedCell.Diagnostics.Update/Updater.cs +++ b/RFiDGear/3rdParty/RedCell/RedCell.Diagnostics.Update/Updater.cs @@ -114,6 +114,8 @@ public void StartMonitoring() if (_localConfig != null) { Log.Write("Starting monitoring every {0}s.", _localConfig.CheckInterval); + Check(null); + _timer = new Timer(Check, null, 5000, _localConfig.CheckInterval * 1000); } diff --git a/RFiDGear/DataAccessLayer/Local/ResourceLoader.cs b/RFiDGear/DataAccessLayer/Local/ResourceLoader.cs index 3bdabcf..a72aa69 100644 --- a/RFiDGear/DataAccessLayer/Local/ResourceLoader.cs +++ b/RFiDGear/DataAccessLayer/Local/ResourceLoader.cs @@ -150,7 +150,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn } catch (Exception e) { - LogWriter.CreateLogEntry(string.Format("{0}; {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""), FacilityName); + LogWriter.CreateLogEntry(e, FacilityName); throw new ArgumentOutOfRangeException( string.Format("parameter:{0}\nvalue:{1}", @@ -208,14 +208,16 @@ public static string GetResource(string resName) { settings.ReadSettings(); - return new ResourceManager("RFiDGear.Resources.Manifest", System.Reflection.Assembly.GetExecutingAssembly()) + string ressource = new ResourceManager("RFiDGear.Resources.Manifest", System.Reflection.Assembly.GetExecutingAssembly()) .GetString(resName, (settings.DefaultSpecification.DefaultLanguage == "german") ? new CultureInfo("de") : new CultureInfo("en")); + + return ressource.Replace("%NEWLINE", "\n"); } } catch (Exception e) { - LogWriter.CreateLogEntry(string.Format("{0}; {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""), FacilityName); + LogWriter.CreateLogEntry(e, FacilityName); return string.Empty; } } diff --git a/RFiDGear/DataAccessLayer/Remote/FromFile/ReportReaderWriter.cs b/RFiDGear/DataAccessLayer/Remote/FromFile/ReportReaderWriter.cs index 3e08d2f..e0af91f 100644 --- a/RFiDGear/DataAccessLayer/Remote/FromFile/ReportReaderWriter.cs +++ b/RFiDGear/DataAccessLayer/Remote/FromFile/ReportReaderWriter.cs @@ -140,6 +140,7 @@ public void SetReportField(string _field, string _value) { form.GetField(_field).SetBorderWidth(1); form.GetField(_field).SetVisibility(PdfFormField.VISIBLE); + form.GetField(_field).SetReadOnly(false); form.GetField(_field).SetValue(_value); if (form.GetField(_field) is PdfButtonFormField) diff --git a/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs b/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs index 133b9e6..81e7c3d 100644 --- a/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs +++ b/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs @@ -51,17 +51,18 @@ public override ERROR ReadChipPublic() { try { - if (readerDevice.ConnectTWN4()) + if (readerDevice != null) { - readerDevice.Beep(); readerDevice.GreenLED(true); card = readerDevice.GetSingleChip(); - if (card?.ChipIdentifier != null) + if (!string.IsNullOrWhiteSpace(card?.ChipIdentifier)) { try { + readerDevice.Beep(1, 200, 2000, 50); + GenericChip = new GenericChipModel(card.ChipIdentifier, (CARD_TYPE)card.CardType); if ((CARD_TYPE)card.CardType == CARD_TYPE.DESFire || (CARD_TYPE)card.CardType == CARD_TYPE.DESFireEV1) @@ -91,6 +92,9 @@ public override ERROR ReadChipPublic() } else { + readerDevice.Beep(3, 50, 2000, 50); + GenericChip = null; + return ERROR.NotReadyError; } } @@ -226,7 +230,7 @@ protected override void Dispose(bool disposing) { if (disposing) { - TWN4ReaderDevice.Instance?.DisconnectTWN4(); + } _disposed = true; @@ -237,6 +241,7 @@ public override void Dispose() { _disposed = false; Dispose(true); + GC.SuppressFinalize(this); } } } diff --git a/RFiDGear/DataAccessLayer/Remote/FromIO/LibLogicalAccessProvider.cs b/RFiDGear/DataAccessLayer/Remote/FromIO/LibLogicalAccessProvider.cs index d492fbf..9aa24da 100644 --- a/RFiDGear/DataAccessLayer/Remote/FromIO/LibLogicalAccessProvider.cs +++ b/RFiDGear/DataAccessLayer/Remote/FromIO/LibLogicalAccessProvider.cs @@ -2464,6 +2464,7 @@ public override void Dispose() { _disposed = false; Dispose(true); + GC.SuppressFinalize(this); } } } \ No newline at end of file diff --git a/RFiDGear/DataAccessLayer/Remote/FromIO/ReaderDevice.cs b/RFiDGear/DataAccessLayer/Remote/FromIO/ReaderDevice.cs index 39dd6d0..a76ee64 100644 --- a/RFiDGear/DataAccessLayer/Remote/FromIO/ReaderDevice.cs +++ b/RFiDGear/DataAccessLayer/Remote/FromIO/ReaderDevice.cs @@ -20,13 +20,16 @@ public static ReaderDevice Instance instance = new LibLogicalAccessProvider(Reader); return instance; } + else if (instance != null && !(instance is LibLogicalAccessProvider)) + { + instance = new LibLogicalAccessProvider(Reader); + return instance; + } else { return instance; } - } - case ReaderTypes.Elatec: lock (syncRoot) { @@ -35,6 +38,11 @@ public static ReaderDevice Instance instance = new ElatecNetProvider(PortNumber); return instance; } + else if (instance != null && !(instance is ElatecNetProvider)) + { + instance = new ElatecNetProvider(PortNumber); + return instance; + } else { return instance; diff --git a/RFiDGear/Resources/Manifest.de.resx b/RFiDGear/Resources/Manifest.de.resx index 6a48bbb..803517d 100644 --- a/RFiDGear/Resources/Manifest.de.resx +++ b/RFiDGear/Resources/Manifest.de.resx @@ -437,16 +437,16 @@ ein Kartenlesegerät auswählen _Aufgabenstatus zurücksetzen - _Alle Aufgaben automatisch abarbeiten + _Alle Aufgaben automatisch ausführen - _Markierte Aufgabe automatisch abarbeiten + _Markierte Aufgabe automatisch ausführen - Markierte Aufgaben _einmalig abarbeiten + Markierte Aufgaben _einmalig ausführen - Alle A_ufgaben einmalig abarbeiten + Alle A_ufgaben einmalig ausführen Projektdatei _öffnen... @@ -523,10 +523,10 @@ Soll die Aktualisierung jetzt herunter geladen und installiert werden? _RFiD Aufgaben - Mifare + Mifare Aufgabe - Karten entfernen + Alle Karten entfernen Mifare _Ultralight Aufgabe hinzufügen/bearbeiten @@ -854,7 +854,7 @@ Wird benötigt von: PDF Dateien (*.pdf)|*.pdf - _Allgemeine (nicht-RFID) Aufgabe erstellen... + _Allgemeine Aufgabe erstellen / bearbeiten... Testpunkt erstellen / bearbeiten @@ -905,7 +905,7 @@ Wird benötigt von: Kein - Generischen Typ erstellen / bearbeiten.... + Typunabhängige RFiD Aufgabe erstellen / bearbeiten.... Kartentyp @@ -998,7 +998,7 @@ Wird benötigt von: ISONAS - MIFARE + MIFARE (Generisch) ISO14443B @@ -1037,13 +1037,13 @@ Wird benötigt von: Mifare Mini - Mifare 1K + Mifare Classic 1K - Mifare 2K + Mifare Classic 2K - Mifare 4K + Mifare Classic 4K SAM_AV1 @@ -1088,16 +1088,16 @@ Wird benötigt von: Mifare Plus SL3 4K - Desfire EV0 + Mifare Desfire EV0 - Desfire EV1 + Mifare Desfire EV1 - Desfire EV2 + Mifare Desfire EV2 - Desfire EV3 + Mifare Desfire EV3 SmartMX MifareClassic 2K @@ -1145,10 +1145,10 @@ Wird benötigt von: Logische Zustandsprüfung - Soll - Ergebnis + Ziel Aufgabenergebnis - Ziel Taskindex + Ziel Aufgabennummer App Konfiguration lesen @@ -1355,4 +1355,37 @@ https://github.com/c3rebro/rfidgear Sektor-Unbenutzt Prüfung + + Chip erkennen + + + Vergleichs-%NEWLINEausdruck + + + Inhalt + + + Ziel Aufgaben-%NEWLINENummer + + + Ziel Aufgaben-%NEWLINEErgebnis + + + PDF Feldvariablen-%NEWLINEbezeichnung + + + PDF Feldinhalt + + + Prüfpunkteübersicht + + + Knoten löschen + + + Chip Typ: + + + Typunabhängige RFiD Aufgabe erstellen / bearbeiten + \ No newline at end of file diff --git a/RFiDGear/Resources/Manifest.en.resx b/RFiDGear/Resources/Manifest.en.resx index 8f0809c..26dd487 100644 --- a/RFiDGear/Resources/Manifest.en.resx +++ b/RFiDGear/Resources/Manifest.en.resx @@ -988,7 +988,7 @@ Needed by: ISONAS - MIFARE + MIFARE (Generic) ISO14443B @@ -1027,13 +1027,13 @@ Needed by: Mifare Mini - Mifare 1K + Mifare Classic 1K - Mifare 2K + Mifare Classic 2K - Mifare 4K + Mifare Classic 4K SAM_AV1 @@ -1078,16 +1078,16 @@ Needed by: Mifare Plus SL3 4K - Desfire EV0 + Mifare Desfire EV0 - Desfire EV1 + Mifare Desfire EV1 - Desfire EV2 + Mifare Desfire EV2 - Desfire EV3 + Mifare Desfire EV3 SmartMX MifareClassic 2K @@ -1336,4 +1336,34 @@ https://github.com/c3rebro/rfidgear Sector Unused Check + + Read Chip Public + + + Compare Expression + + + Content + + + Targeted Task-%NEWLINEIndex + + + Targeted Error-%NEWLINELevel + + + Template Formfield + + + Formfield Content + + + Delete Node + + + ChipType: + + + Add / Edit Generic RFiD Task + \ No newline at end of file diff --git a/RFiDGear/View/MainWindow.xaml b/RFiDGear/View/MainWindow.xaml index f1a5ca8..1aa7dc4 100644 --- a/RFiDGear/View/MainWindow.xaml +++ b/RFiDGear/View/MainWindow.xaml @@ -125,6 +125,25 @@ + + + + + - + - + - + - + diff --git a/RFiDGear/View/TaskViews/CommonTask/CommonTasksTabPages/TabPageReportSettingsView.xaml b/RFiDGear/View/TaskViews/CommonTask/CommonTasksTabPages/TabPageReportSettingsView.xaml index 7e91d03..f0608b0 100644 --- a/RFiDGear/View/TaskViews/CommonTask/CommonTasksTabPages/TabPageReportSettingsView.xaml +++ b/RFiDGear/View/TaskViews/CommonTask/CommonTasksTabPages/TabPageReportSettingsView.xaml @@ -9,6 +9,7 @@ d:DesignHeight="430" mc:Ignorable="d"> + @@ -89,6 +90,17 @@ VerticalAlignment="Top" Command="{Binding OpenReportTemplateCommand}" Content="{Binding LocalizationResourceSet, ConverterParameter=buttonContentOpenReportTemplateFile, Converter={StaticResource Localization}}" /> + @@ -223,7 +235,7 @@ Margin="8,8,8,8" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" - Header="{Binding LocalizationResourceSet, ConverterParameter=groupBoxHeaderMifareDesfireAppSettingsCurrent, Converter={StaticResource Localization}}" + Header="{Binding LocalizationResourceSet, ConverterParameter=groupBoxHeaderCommonTaskCheckpointSetup, Converter={StaticResource Localization}}" IsEnabled="{Binding IsReportSetupTabEnabled}"> --> - + @@ -257,33 +269,41 @@ Source={StaticResource proxy}} --> - + - + @@ -291,7 +311,11 @@ - + - + - - - - - + + diff --git a/RFiDGear/View/TaskViews/RFIDTasks/GenericChipTask/GenericChipTaskView.xaml b/RFiDGear/View/TaskViews/RFIDTasks/GenericChipTask/GenericChipTaskView.xaml index e261c99..3ddd12f 100644 --- a/RFiDGear/View/TaskViews/RFIDTasks/GenericChipTask/GenericChipTaskView.xaml +++ b/RFiDGear/View/TaskViews/RFIDTasks/GenericChipTask/GenericChipTaskView.xaml @@ -158,7 +158,7 @@ Grid.Row="2" Grid.ColumnSpan="4" Margin="8,0,8,0" - Header="ExecuteCondition"> + Header="{Binding LocalizationResourceSet, ConverterParameter=groupBoxHeaderAllTasksExecuteCondition, Converter={StaticResource Localization}}"> diff --git a/RFiDGear/ViewModel/HirarchicalDataTemplateViewModels/RFiDChipParentLayerViewModel.cs b/RFiDGear/ViewModel/HirarchicalDataTemplateViewModels/RFiDChipParentLayerViewModel.cs index 167f6f8..0f16099 100644 --- a/RFiDGear/ViewModel/HirarchicalDataTemplateViewModels/RFiDChipParentLayerViewModel.cs +++ b/RFiDGear/ViewModel/HirarchicalDataTemplateViewModels/RFiDChipParentLayerViewModel.cs @@ -40,6 +40,7 @@ public class RFiDChipParentLayerViewModel : ViewModelBase private readonly RelayCommand _cmdCreateApp; private readonly RelayCommand _cmdEraseDesfireCard; + private protected GenericChipModel genericChip; private protected MifareClassicChipModel mifareClassicUidModel; private protected MifareDesfireChipModel mifareDesfireUidModel; private protected MifareUltralightChipModel mifareUltralightUidModel; @@ -53,6 +54,8 @@ public RFiDChipParentLayerViewModel() mifareClassicUidModel = new MifareClassicChipModel(); mifareDesfireUidModel = new MifareDesfireChipModel(); + mifareUltralightUidModel = new MifareUltralightChipModel(); + genericChip = new GenericChipModel(); } public RFiDChipParentLayerViewModel(string _text) @@ -63,11 +66,12 @@ public RFiDChipParentLayerViewModel(string _text) mifareClassicUidModel = new MifareClassicChipModel(); mifareDesfireUidModel = new MifareDesfireChipModel(); mifareUltralightUidModel = new MifareUltralightChipModel(); + genericChip = new GenericChipModel(); ParentNodeHeader = _text; } - public RFiDChipParentLayerViewModel(MifareClassicChipModel _uidModel, ObservableCollection _dialogs, bool _isTask = false) + public RFiDChipParentLayerViewModel(ObservableCollection _dialogs, bool _isTask) { ID = new Random().Next(); @@ -78,6 +82,11 @@ public RFiDChipParentLayerViewModel(MifareClassicChipModel _uidModel, Observable isTask = _isTask; settings = new SettingsReaderWriter(); + _children = new ObservableCollection(); + } + + public RFiDChipParentLayerViewModel(MifareClassicChipModel _uidModel, ObservableCollection _dialogs, bool _isTask) : this ( _dialogs, _isTask) + { mifareClassicUidModel = _uidModel; CardType = mifareClassicUidModel.CardType; @@ -97,11 +106,10 @@ public RFiDChipParentLayerViewModel(MifareClassicChipModel _uidModel, Observable ContextMenuItems.Add(new MenuItem() { - Header = "Delete Node", + Header = ResourceLoader.GetResource("hierarchicalDataTemplateParentNodeContextMenuDeleteNode"), Command = _cmdDeleteThisNode }); - _children = new ObservableCollection(); if (!isTask) { @@ -116,18 +124,8 @@ public RFiDChipParentLayerViewModel(MifareClassicChipModel _uidModel, Observable } } - public RFiDChipParentLayerViewModel(MifareDesfireChipModel _uidModel, ObservableCollection _dialogs, bool _isTask = false) + public RFiDChipParentLayerViewModel(MifareDesfireChipModel _uidModel, ObservableCollection _dialogs, bool _isTask) : this(_dialogs, _isTask) { - ID = new Random().Next(); - - if (_dialogs != null) - { - dialogs = _dialogs; - } - - isTask = _isTask; - settings = new SettingsReaderWriter(); - mifareDesfireUidModel = _uidModel; CardType = mifareDesfireUidModel.CardType; @@ -149,8 +147,6 @@ public RFiDChipParentLayerViewModel(MifareDesfireChipModel _uidModel, Observable } }); - _children = new ObservableCollection(); - if (!isTask) { LoadChildren(); @@ -160,21 +156,12 @@ public RFiDChipParentLayerViewModel(MifareDesfireChipModel _uidModel, Observable if (mifareDesfireUidModel != null) { - ParentNodeHeader = String.Format("ChipType: {1}\nUid: {0}", mifareDesfireUidModel.UID, Enum.GetName(typeof(CARD_TYPE), CardType)); + ParentNodeHeader = String.Format(ResourceLoader.GetResource("hirarchicalDataTemplateParentNodeHeaderChipType") + " {1}\nUid: {0}", mifareDesfireUidModel.UID, Enum.GetName(typeof(CARD_TYPE), CardType)); } } - public RFiDChipParentLayerViewModel(MifareUltralightChipModel _uidModel, ObservableCollection _dialogs, bool _isTask = false) + public RFiDChipParentLayerViewModel(MifareUltralightChipModel _uidModel, ObservableCollection _dialogs, bool _isTask) : this(_dialogs, _isTask) { - ID = new Random().Next(); - - if (_dialogs != null) - { - dialogs = _dialogs; - } - - isTask = _isTask; - settings = new SettingsReaderWriter(); mifareUltralightUidModel = _uidModel; CardType = mifareUltralightUidModel.CardType; @@ -198,8 +185,6 @@ public RFiDChipParentLayerViewModel(MifareUltralightChipModel _uidModel, Observa Command = _cmdDeleteThisNode }); - _children = new ObservableCollection(); - if (!isTask) { LoadChildren(); @@ -209,7 +194,29 @@ public RFiDChipParentLayerViewModel(MifareUltralightChipModel _uidModel, Observa if (mifareUltralightUidModel != null) { - ParentNodeHeader = String.Format("ChipType: {1}\nUid: {0}", mifareUltralightUidModel.UID, Enum.GetName(typeof(CARD_TYPE), CardType)); + ParentNodeHeader = String.Format(ResourceLoader.GetResource("hirarchicalDataTemplateParentNodeHeaderChipType") + " {1}\nUid: {0}", mifareUltralightUidModel.UID, Enum.GetName(typeof(CARD_TYPE), CardType)); + } + } + + public RFiDChipParentLayerViewModel(GenericChipModel _chipModel, ObservableCollection _dialogs, bool _isTask) : this(_dialogs, _isTask) + { + genericChip = _chipModel; + CardType = genericChip.CardType; + + _cmdDeleteThisNode = new RelayCommand(DeleteMeCommand); + + ContextMenuItems = new List(); + ContextMenuItems.Add(new MenuItem() + { + Header = "Delete Node", + Command = _cmdDeleteThisNode + }); + + IsSelected = true; + + if (genericChip != null) + { + ParentNodeHeader = String.Format(ResourceLoader.GetResource("hirarchicalDataTemplateParentNodeHeaderChipType") + " {1}\nUid: {0}", genericChip.UID, Enum.GetName(typeof(CARD_TYPE), CardType)); } } @@ -424,9 +431,9 @@ private void MifareUltralightQuickCheck() if (device.ReadMifareUltralightSinglePage(cnVM.PageNumber) == ERROR.NoError) { - string dataToShow = ByteConverter.HexToString(device.MifareUltralightPageData); + string dataToShow = ByteConverter.GetStringFrom(device.MifareUltralightPageData); - for (int i = (ByteConverter.HexToString(device.MifareUltralightPageData).Length) - 2; i > 0; i -= 2) + for (int i = (ByteConverter.GetStringFrom(device.MifareUltralightPageData).Length) - 2; i > 0; i -= 2) { dataToShow = dataToShow.Insert(i, " "); } @@ -579,6 +586,10 @@ public string UID { return mifareUltralightUidModel.UID; } + else if (genericChip != null) + { + return genericChip.UID; + } else { return ""; @@ -594,8 +605,9 @@ public CARD_TYPE CardType { get => mifareClassicUidModel != null ? mifareClassicUidModel.CardType : (mifareDesfireUidModel != null ? mifareDesfireUidModel.CardType : - (mifareUltralightUidModel != null ? mifareUltralightUidModel.CardType : CARD_TYPE.Unspecified) - ); + (mifareUltralightUidModel != null ? mifareUltralightUidModel.CardType : + (genericChip != null ? genericChip.CardType : CARD_TYPE.Unspecified) + )); set { if (mifareClassicUidModel != null) @@ -610,6 +622,10 @@ public CARD_TYPE CardType { mifareUltralightUidModel.CardType = value; } + else if (genericChip != null) + { + genericChip.CardType = value; + } RaisePropertyChanged("CardType"); } diff --git a/RFiDGear/ViewModel/MainWindowViewModel.cs b/RFiDGear/ViewModel/MainWindowViewModel.cs index 8647e9f..c51cf3d 100644 --- a/RFiDGear/ViewModel/MainWindowViewModel.cs +++ b/RFiDGear/ViewModel/MainWindowViewModel.cs @@ -82,10 +82,6 @@ public class MainWindowViewModel : ViewModelBase private protected Mutex mutex; //one reader, one instance - only - #region Plugins - - #endregion - #region Events / Delegates /// @@ -104,6 +100,7 @@ public MainWindowViewModel() bool autoLoadLastUsedDB; string[] args = Environment.GetCommandLineArgs(); + updater = new Updater(); using (SettingsReaderWriter settings = new SettingsReaderWriter()) { @@ -119,6 +116,11 @@ public MainWindowViewModel() autoLoadLastUsedDB = settings.DefaultSpecification.AutoLoadProjectOnStart; + if (settings.DefaultSpecification.AutoCheckForUpdates) + { + updater?.StartMonitoring(); + } + if (args.Length == 2) { if (File.Exists(args[1])) @@ -129,8 +131,6 @@ public MainWindowViewModel() } } - updater = new Updater(); - triggerReadChip = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, 500) @@ -167,6 +167,7 @@ public MainWindowViewModel() rowContextMenuItems = new ObservableCollection(); emptySpaceContextMenuItems = new ObservableCollection(); + emptySpaceTreeViewContextMenu = new ObservableCollection(); emptySpaceContextMenuItems.Add(new MenuItem() { @@ -211,6 +212,12 @@ public MainWindowViewModel() Command = WriteToChipOnceCommand }); + emptySpaceTreeViewContextMenu.Add(new MenuItem() + { + Header = ResourceLoader.GetResource("contextMenuItemReadChipPublic"), + Command = ReadChipCommand + }); + Application.Current.MainWindow.Closing += new CancelEventHandler(CloseThreads); Application.Current.MainWindow.Activated += new EventHandler(LoadCompleted); updater.NewVersionAvailable += new EventHandler(EnableUpdate); @@ -344,26 +351,7 @@ private void UpdateChip(object sender, EventArgs args) } // fill treeview with dummy models and viewmodels - switch (GenericChip.CardType) - { - case CARD_TYPE.Mifare1K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(GenericChip.UID, CARD_TYPE.Mifare1K), Dialogs)); - break; - - case CARD_TYPE.Mifare2K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(GenericChip.UID, CARD_TYPE.Mifare2K), Dialogs)); - break; - - case CARD_TYPE.Mifare4K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(GenericChip.UID, CARD_TYPE.Mifare4K), Dialogs)); - break; - - case CARD_TYPE.DESFire: - case CARD_TYPE.DESFireEV1: - case CARD_TYPE.DESFireEV2: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareDesfireChipModel(GenericChip.UID, GenericChip.CardType), Dialogs)); - break; - } + OnNewReadChipCommand(); OnNewResetTaskStatusCommand(); OnNewWriteToChipOnceCommand(); } @@ -451,6 +439,7 @@ private void OnNewNewAboutDialogCommand() } }); } + /// /// Create a new "Common" Task of Type "Report Creator" /// @@ -472,7 +461,7 @@ private void OnNewCreateGenericChipTaskCommand() { dialogs.Add(new GenericChipTaskViewModel(SelectedSetupViewModel, ChipTasks.TaskCollection, dialogs) { - Caption = ResourceLoader.GetResource("windowCaptionAddEditMifareClassicTask"), + Caption = ResourceLoader.GetResource("windowCaptionAddEditGenericChipTask"), OnOk = (sender) => { @@ -490,16 +479,7 @@ private void OnNewCreateGenericChipTaskCommand() ChipTasks.TaskCollection.Add(sender); - ChipTasks.TaskCollection = new ObservableCollection(ChipTasks.TaskCollection.OrderBy(x => - - (x is CommonTaskViewModel) ? - (x as CommonTaskViewModel).SelectedTaskIndexAsInt : - (x is GenericChipTaskViewModel) ? - (x as GenericChipTaskViewModel).SelectedTaskIndexAsInt : - (x is MifareDesfireSetupViewModel) ? - (x as MifareDesfireSetupViewModel).SelectedTaskIndexAsInt : - (x as MifareClassicSetupViewModel).SelectedTaskIndexAsInt) - ); + ChipTasks.TaskCollection = new ObservableCollection(ChipTasks.TaskCollection.OrderBy(x => (x as IGenericTaskModel).SelectedTaskIndexAsInt)); RaisePropertyChanged("ChipTasks"); } @@ -569,16 +549,7 @@ private void OnNewNewCreateReportTaskCommand() ChipTasks.TaskCollection.Add(sender); - ChipTasks.TaskCollection = new ObservableCollection(ChipTasks.TaskCollection.OrderBy(x => - - (x is CommonTaskViewModel) ? - (x as CommonTaskViewModel).SelectedTaskIndexAsInt : - (x is GenericChipTaskViewModel) ? - (x as GenericChipTaskViewModel).SelectedTaskIndexAsInt : - (x is MifareDesfireSetupViewModel) ? - (x as MifareDesfireSetupViewModel).SelectedTaskIndexAsInt : - (x as MifareClassicSetupViewModel).SelectedTaskIndexAsInt) - ); + ChipTasks.TaskCollection = new ObservableCollection(ChipTasks.TaskCollection.OrderBy(x => (x as IGenericTaskModel).SelectedTaskIndexAsInt)); RaisePropertyChanged("ChipTasks"); } @@ -740,16 +711,7 @@ private void OnNewCreateDesfireTaskCommand() ChipTasks.TaskCollection.Add(sender); - ChipTasks.TaskCollection = new ObservableCollection(ChipTasks.TaskCollection.OrderBy(x => - - (x is CommonTaskViewModel) ? - (x as CommonTaskViewModel).SelectedTaskIndexAsInt : - (x is GenericChipTaskViewModel) ? - (x as GenericChipTaskViewModel).SelectedTaskIndexAsInt : - (x is MifareDesfireSetupViewModel) ? - (x as MifareDesfireSetupViewModel).SelectedTaskIndexAsInt : - (x as MifareClassicSetupViewModel).SelectedTaskIndexAsInt) - ); + ChipTasks.TaskCollection = new ObservableCollection(ChipTasks.TaskCollection.OrderBy(x => (x as IGenericTaskModel).SelectedTaskIndexAsInt)); RaisePropertyChanged("ChipTasks"); @@ -814,16 +776,7 @@ private void OnNewCreateUltralightTaskCommand() ChipTasks.TaskCollection.Add(sender); - ChipTasks.TaskCollection = new ObservableCollection(ChipTasks.TaskCollection.OrderBy(x => - - (x is CommonTaskViewModel) ? - (x as CommonTaskViewModel).SelectedTaskIndexAsInt : - (x is GenericChipTaskViewModel) ? - (x as GenericChipTaskViewModel).SelectedTaskIndexAsInt : - (x is MifareDesfireSetupViewModel) ? - (x as MifareDesfireSetupViewModel).SelectedTaskIndexAsInt : - (x as MifareClassicSetupViewModel).SelectedTaskIndexAsInt) - ); + ChipTasks.TaskCollection = new ObservableCollection(ChipTasks.TaskCollection.OrderBy(x => (x as IGenericTaskModel).SelectedTaskIndexAsInt)); RaisePropertyChanged("ChipTasks"); @@ -921,76 +874,80 @@ private void OnNewReadChipCommand() switch (device.GenericChip.CardType) { case CARD_TYPE.Mifare1K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.Mifare1K), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.Mifare1K), Dialogs, false)); break; case CARD_TYPE.Mifare2K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.Mifare2K), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.Mifare2K), Dialogs, false)); break; case CARD_TYPE.Mifare4K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.Mifare4K), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.Mifare4K), Dialogs, false)); break; case CARD_TYPE.DESFire: case CARD_TYPE.DESFireEV1: case CARD_TYPE.DESFireEV2: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareDesfireChipModel(device.GenericChip.UID, device.GenericChip.CardType), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareDesfireChipModel(device.GenericChip.UID, device.GenericChip.CardType), Dialogs, false)); break; case CARD_TYPE.MifarePlus_SL1_1K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL1_1K), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL1_1K), Dialogs, false)); break; case CARD_TYPE.MifarePlus_SL1_2K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL1_2K), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL1_2K), Dialogs, false)); break; case CARD_TYPE.MifarePlus_SL1_4K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL1_4K), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL1_4K), Dialogs, false)); break; case CARD_TYPE.MifarePlus_SL2_1K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL2_1K), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL2_1K), Dialogs, false)); break; case CARD_TYPE.MifarePlus_SL2_2K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL2_2K), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL2_2K), Dialogs, false)); break; case CARD_TYPE.MifarePlus_SL2_4K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL2_4K), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL2_4K), Dialogs, false)); break; case CARD_TYPE.MifarePlus_SL3_1K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL3_1K), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL3_1K), Dialogs, false)); break; case CARD_TYPE.MifarePlus_SL3_2K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL3_2K), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL3_2K), Dialogs, false)); break; case CARD_TYPE.MifarePlus_SL3_4K: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL3_4K), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareClassicChipModel(device.GenericChip.UID, CARD_TYPE.MifarePlus_SL3_4K), Dialogs, false)); break; case CARD_TYPE.MifareUltralight: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareUltralightChipModel(device.GenericChip.UID, device.GenericChip.CardType), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareUltralightChipModel(device.GenericChip.UID, device.GenericChip.CardType), Dialogs, false)); break; case CARD_TYPE.GENERIC_T_CL_A: - treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareDesfireChipModel(device.GenericChip.UID, device.GenericChip.CardType), Dialogs)); + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new MifareDesfireChipModel(device.GenericChip.UID, device.GenericChip.CardType), Dialogs, false)); break; case CARD_TYPE.ISO15693: break; + + default: + treeViewParentNodes.Add(new RFiDChipParentLayerViewModel(new GenericChipModel(device.GenericChip.UID, device.GenericChip.CardType), Dialogs, false)); + break; } } - else if (treeViewParentNodes.Any(x => x.UID == device.GenericChip.UID)) + else if (treeViewParentNodes.Any(x => x.UID == device?.GenericChip?.UID)) { treeViewParentNodes.First(x => x.UID == device.GenericChip.UID).IsSelected = true; } @@ -1629,6 +1586,11 @@ private void OnNewReaderSetupDialog() sender.Close(); settings.SaveSettings(); + + CurrentReader = Enum.GetName(typeof(ReaderTypes), sender.SelectedReader); + + ReaderDevice.Reader = (ReaderTypes)Enum.Parse(typeof(ReaderTypes), CurrentReader); + }, OnConnect = (sender) => @@ -1758,6 +1720,12 @@ private void OnCloseRequest() #region Dependency Properties + /// + /// expose contextmenu on row click + /// + public ObservableCollection EmptySpaceTreeViewContextMenu => emptySpaceTreeViewContextMenu; + + private readonly ObservableCollection emptySpaceTreeViewContextMenu; /// /// expose contextmenu on row click /// @@ -2015,50 +1983,25 @@ private void CloseThreads(object sender, CancelEventArgs e) private void LoadCompleted(object sender, EventArgs e) { - mw = (MainWindow)Application.Current.MainWindow; - mw.Title = string.Format("RFiDGear {0}.{1}", Version.Major, Version.Minor); - if (updateAvailable) { AskForUpdateNow(); } - Task thread = new Task(() => - { - while (true) - { - for (int i = 0; i <= 10; i++) - { - Thread.Sleep(500); - ReaderStatus = string.Format("{0}", DateTime.Now); - - if (i == 10) - { - //TODO: Update ReaderStatus frequently - //FIXME: Locking LibLogicalAccessProvider Instance in different Threads not working correctly - } - } - - } - }); - - - thread.ContinueWith((x) => - { - }); - - thread.Start(); + mw = (MainWindow)Application.Current.MainWindow; + mw.Title = string.Format("RFiDGear {0}.{1}", Version.Major, Version.Minor); if (firstRun) - { + { + Task loadProjectOnStartThread; + Task refreshStatusBarThread; + firstRun = false; try { var mySplash = new SplashScreenViewModel(); - MefHelper.Instance.Container.ComposeParts(this); - using (SettingsReaderWriter settings = new SettingsReaderWriter()) { CurrentReader = string.IsNullOrWhiteSpace(settings.DefaultSpecification.DefaultReaderName) @@ -2076,7 +2019,7 @@ private void LoadCompleted(object sender, EventArgs e) Dialogs.Add(mySplash); } - thread = new Task(() => + loadProjectOnStartThread = new Task(() => { if (autoLoadLastUsedDB) { @@ -2084,31 +2027,37 @@ private void LoadCompleted(object sender, EventArgs e) } }); + loadProjectOnStartThread.ContinueWith((x) => + { + }); + + + loadProjectOnStartThread.RunSynchronously(); - thread.ContinueWith((x) => + refreshStatusBarThread = new Task(() => { + while(true) + { + Thread.Sleep(500); + ReaderStatus = string.Format("{0}", DateTime.Now); + } }); - thread.RunSynchronously(); + refreshStatusBarThread.ContinueWith((x) => + { + }); - OnNewResetTaskStatusCommand(); + refreshStatusBarThread.Start(); Dialogs.Remove(mySplash); + + OnNewResetTaskStatusCommand(); } } catch (Exception ex) { LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, ex.Message, ex.InnerException != null ? ex.InnerException.Message : ""), FacilityName); } - - using (SettingsReaderWriter settings = new SettingsReaderWriter()) - { - if (settings.DefaultSpecification.AutoCheckForUpdates) - { - updater.StartMonitoring(); - } - } - } #endregion } diff --git a/RFiDGear/ViewModel/SetupViewModel.cs b/RFiDGear/ViewModel/SetupViewModel.cs index 9c98c9d..9abf462 100644 --- a/RFiDGear/ViewModel/SetupViewModel.cs +++ b/RFiDGear/ViewModel/SetupViewModel.cs @@ -58,17 +58,17 @@ private void ReaderSelected() public ICommand ConnectToReaderCommand => new RelayCommand(ConnectToReader); private void ConnectToReader() { - OnConnect?.Invoke(this); + //OnConnect?.Invoke(this); switch (SelectedReader) { case ReaderTypes.PCSC: if (device != null) { - if (device is ElatecNetProvider) + if (!(device is LibLogicalAccessProvider)) { device.Dispose(); - + device = new LibLogicalAccessProvider(SelectedReader); } device.ReadChipPublic(); @@ -82,8 +82,13 @@ private void ConnectToReader() case ReaderTypes.Elatec: if (device != null) { - device.Dispose(); + if (!(device is ElatecNetProvider)) + { + device.Dispose(); + device = new ElatecNetProvider(); + } + device.ReadChipPublic(); } else @@ -106,10 +111,11 @@ private void ConnectToReader() + "UID: {0} " + '\n' + "Type: {1}", device.GenericChip.UID, Enum.GetName(typeof(CARD_TYPE), device.GenericChip.CardType)); + } else { - ReaderStatus = "no Reader detected"; + ReaderStatus = "no Reader / Card detected"; } } diff --git a/RFiDGear/ViewModel/TaskSetupViewModels/CommonTaskViewModel.cs b/RFiDGear/ViewModel/TaskSetupViewModels/CommonTaskViewModel.cs index 8fc2085..ee8de13 100644 --- a/RFiDGear/ViewModel/TaskSetupViewModels/CommonTaskViewModel.cs +++ b/RFiDGear/ViewModel/TaskSetupViewModels/CommonTaskViewModel.cs @@ -613,7 +613,7 @@ public LOGIC_STATE SelectedLogicCondition break; case LOGIC_STATE.COUNT: - IsLogicFuncTaskLogicFuncEnabled = false; + IsLogicFuncTaskLogicFuncEnabled = true; IsLogicFuncTaskCountFuncEnabled = true; IsLogicFuncTaskCompareWithEnabled = false; break; @@ -632,6 +632,7 @@ public LOGIC_STATE SelectedLogicCondition /// /// /// + [XmlIgnore] public bool IsLogicFuncTaskCompareWithEnabled { get => isLogicFuncTaskCompareWithEnabled; @@ -646,6 +647,7 @@ public bool IsLogicFuncTaskCompareWithEnabled /// /// /// + [XmlIgnore] public bool IsLogicFuncTaskCountFuncEnabled { get => isLogicFuncTaskCountFuncEnabled; @@ -660,6 +662,7 @@ public bool IsLogicFuncTaskCountFuncEnabled /// /// /// + [XmlIgnore] public bool IsLogicFuncTaskLogicFuncEnabled { get => isLogicFuncTaskLogicFuncEnabled; @@ -865,7 +868,13 @@ private void OnNewWriteReportCommand(ReportReaderWriter _reportReaderWriter) if (temporaryContent.Contains("%UID")) { - temporaryContent = temporaryContent.Replace("%UID", GenericChip.UID ?? ""); + temporaryContent = temporaryContent.Replace("%UID", GenericChip?.UID ?? ""); + hasVariable = true; + } + + if (temporaryContent.Contains("%CHIPTYPE")) + { + temporaryContent = temporaryContent.Replace("%CHIPTYPE", Enum.GetName(typeof(CARD_TYPE), GenericChip?.CardType) ?? ""); hasVariable = true; } diff --git a/RFiDGear/ViewModel/TaskSetupViewModels/MifareClassicSetupViewModel.cs b/RFiDGear/ViewModel/TaskSetupViewModels/MifareClassicSetupViewModel.cs index 50fc7d5..3a767e0 100644 --- a/RFiDGear/ViewModel/TaskSetupViewModels/MifareClassicSetupViewModel.cs +++ b/RFiDGear/ViewModel/TaskSetupViewModels/MifareClassicSetupViewModel.cs @@ -182,7 +182,7 @@ public class MifareClassicSetupViewModel : ViewModelBase, IUserDialogViewModel, /// public MifareClassicSetupViewModel() { - MefHelper.Instance.Container.ComposeParts(this); //Load Plugins + MefHelper.Instance.Container?.ComposeParts(this); //Load Plugins sectorModel = new MifareClassicSectorModel(4, AccessCondition_MifareClassicSectorTrailer.NotAllowed, @@ -220,8 +220,6 @@ public MifareClassicSetupViewModel(object _selectedSetupViewModel, ObservableCol { try { - MefHelper.Instance.Container.ComposeParts(this); //Load Plugins - sectorModel = new MifareClassicSectorModel(4, AccessCondition_MifareClassicSectorTrailer.NotAllowed, AccessCondition_MifareClassicSectorTrailer.Allowed_With_KeyA, @@ -314,6 +312,8 @@ public MifareClassicSetupViewModel(object _selectedSetupViewModel, ObservableCol dialogs = _dialogs; + MefHelper.Instance.Container?.ComposeParts(this); //Load Plugins + HasPlugins = items != null ? items.Any() : false; if (HasPlugins) diff --git a/RFiDGear/ViewModel/TaskSetupViewModels/MifareUltralightSetupViewModel.cs b/RFiDGear/ViewModel/TaskSetupViewModels/MifareUltralightSetupViewModel.cs index 41cfdff..8c78e8b 100644 --- a/RFiDGear/ViewModel/TaskSetupViewModels/MifareUltralightSetupViewModel.cs +++ b/RFiDGear/ViewModel/TaskSetupViewModels/MifareUltralightSetupViewModel.cs @@ -52,8 +52,6 @@ public class MifareUltralightSetupViewModel : ViewModelBase, IUserDialogViewMode /// public MifareUltralightSetupViewModel() { - MefHelper.Instance.Container.ComposeParts(this); //Load Plugins - chipModel = new MifareUltralightChipModel(string.Format("Task Description: {0}", SelectedTaskDescription), CARD_TYPE.MifareUltralight); childNodeViewModelFromChip = new RFiDChipChildLayerViewModel(pageModel, null, CARD_TYPE.MifareUltralight, null, true); diff --git a/Setup/Product.wxs b/Setup/Product.wxs index b5ff2e8..36be08a 100644 --- a/Setup/Product.wxs +++ b/Setup/Product.wxs @@ -239,6 +239,9 @@ + + + @@ -347,18 +350,6 @@ - - - - - - - - - - - - @@ -368,6 +359,18 @@ + + + + + + + + + + + +