-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add: new ERROR Levels: AlreadyExist, NotAllowed
- add: tooltips for better understanding - add: more translations - fix: check security settings when creating / deleting apps - fix: check security settings when creating / deleting files - fix: set security settings correctly when creating applications
- Loading branch information
c3rebro
committed
Mar 13, 2021
1 parent
36cf2c0
commit 0f26e3c
Showing
47 changed files
with
2,622 additions
and
912 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,27 @@ | ||
/VCNEditor | ||
/VCNEditor | ||
/18-01_SMARTINTEGO-VCN_DEVKIT | ||
/docs | ||
/packages | ||
/PluginSystem/bin | ||
/.vs | ||
/MVVMDialogs/bin | ||
/MVVMDialogs/obj | ||
/PluginSystem/obj | ||
/RFiDGear/3rdParty/RedCell/RedCell.Diagnostics.Update/Update.cd | ||
/RFiDGear/bin | ||
/RFiDGear/obj | ||
/RFiDGear/__obj | ||
/RFiDGear/Mifare_4k_1_57.jpg | ||
/RFiDGear/mvvmdialogsample.txt | ||
/RFiDGearBundleSetup | ||
/Setup/bin | ||
/Setup/obj | ||
/key.pub | ||
/key | ||
/idFile.hex | ||
/database.xml | ||
/accessFile_neu.hex | ||
/UpgradeLog2.htm | ||
/UpgradeLog.htm | ||
/taskdatabase.xml | ||
/setup example.wxs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
/* | ||
* Created by SharpDevelop. | ||
* User: C3rebro | ||
* Date: 14.11.2017 | ||
* Time: 22:24 | ||
* | ||
* Based on the article: Patterns for Asynchronous MVVM Applications: Commands | ||
* http://msdn.microsoft.com/en-us/magazine/dn630647.aspx | ||
* | ||
* Modified by Scott Chamberlain 11-19-2014 | ||
* - Added parameter support | ||
* - Added the ability to shut off the single invocation restriction. | ||
* - Made a non-generic version of the class that called the generic version with a <object> return type. | ||
*/ | ||
using GalaSoft.MvvmLight; | ||
|
||
using System; | ||
using System.ComponentModel; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using System.Windows.Input; | ||
|
||
namespace RFiDGear.DataAccessLayer | ||
{ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using System.Windows.Input; | ||
|
||
public class AsyncCommand<TResult> : AsyncCommandBase, INotifyPropertyChanged | ||
{ | ||
private readonly Func<CancellationToken, Task<TResult>> _command; | ||
private readonly CancelAsyncCommand _cancelCommand; | ||
private NotifyTaskCompletion<TResult> _execution; | ||
|
||
public AsyncCommand(Func<CancellationToken, Task<TResult>> command) | ||
{ | ||
_command = command; | ||
_cancelCommand = new CancelAsyncCommand(); | ||
} | ||
|
||
public override bool CanExecute(object parameter) | ||
{ | ||
return Execution == null || Execution.IsCompleted; | ||
} | ||
|
||
public override async Task ExecuteAsync(object parameter) | ||
{ | ||
_cancelCommand.NotifyCommandStarting(); | ||
Execution = new NotifyTaskCompletion<TResult>(_command(_cancelCommand.Token)); | ||
RaiseCanExecuteChanged(); | ||
await Execution.TaskCompletion; | ||
_cancelCommand.NotifyCommandFinished(); | ||
RaiseCanExecuteChanged(); | ||
} | ||
|
||
public ICommand CancelCommand | ||
{ | ||
get { return _cancelCommand; } | ||
} | ||
|
||
public NotifyTaskCompletion<TResult> Execution | ||
{ | ||
get { return _execution; } | ||
private set | ||
{ | ||
_execution = value; | ||
OnPropertyChanged(); | ||
} | ||
} | ||
|
||
public event PropertyChangedEventHandler PropertyChanged; | ||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) | ||
{ | ||
PropertyChangedEventHandler handler = PropertyChanged; | ||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); | ||
} | ||
|
||
private sealed class CancelAsyncCommand : ICommand | ||
{ | ||
private CancellationTokenSource _cts = new CancellationTokenSource(); | ||
private bool _commandExecuting; | ||
|
||
public CancellationToken Token { get { return _cts.Token; } } | ||
|
||
public void NotifyCommandStarting() | ||
{ | ||
_commandExecuting = true; | ||
if (!_cts.IsCancellationRequested) | ||
return; | ||
_cts = new CancellationTokenSource(); | ||
RaiseCanExecuteChanged(); | ||
} | ||
|
||
public void NotifyCommandFinished() | ||
{ | ||
_commandExecuting = false; | ||
RaiseCanExecuteChanged(); | ||
} | ||
|
||
bool ICommand.CanExecute(object parameter) | ||
{ | ||
return _commandExecuting && !_cts.IsCancellationRequested; | ||
} | ||
|
||
void ICommand.Execute(object parameter) | ||
{ | ||
_cts.Cancel(); | ||
RaiseCanExecuteChanged(); | ||
} | ||
|
||
public event EventHandler CanExecuteChanged | ||
{ | ||
add { CommandManager.RequerySuggested += value; } | ||
remove { CommandManager.RequerySuggested -= value; } | ||
} | ||
|
||
private void RaiseCanExecuteChanged() | ||
{ | ||
CommandManager.InvalidateRequerySuggested(); | ||
} | ||
} | ||
} | ||
|
||
public static class AsyncCommand | ||
{ | ||
public static AsyncCommand<object> Create(Func<Task> command) | ||
{ | ||
return new AsyncCommand<object>(async _ => { await command(); return null; }); | ||
} | ||
|
||
public static AsyncCommand<TResult> Create<TResult>(Func<Task<TResult>> command) | ||
{ | ||
return new AsyncCommand<TResult>(_ => command()); | ||
} | ||
|
||
public static AsyncCommand<object> Create(Func<CancellationToken, Task> command) | ||
{ | ||
return new AsyncCommand<object>(async token => { await command(token); return null; }); | ||
} | ||
|
||
public static AsyncCommand<TResult> Create<TResult>(Func<CancellationToken, Task<TResult>> command) | ||
{ | ||
return new AsyncCommand<TResult>(command); | ||
} | ||
} | ||
} | ||
// public interface AsyncCommand<TParam>: ICommand, IDisposable | ||
// { | ||
// | ||
// } | ||
// | ||
// public class AsyncCommand : ICommand, IDisposable | ||
// { | ||
// private readonly BackgroundWorker _backgroundWorker = new BackgroundWorker {WorkerSupportsCancellation = true}; | ||
// private readonly Func<bool> _canExecute; | ||
// | ||
// public AsyncCommand(Action action, Func<bool> canExecute = null, Action<object> completed = null, | ||
// Action<Exception> error = null) | ||
// { | ||
// _backgroundWorker.DoWork += (s, e) => | ||
// { | ||
// CommandManager.InvalidateRequerySuggested(); | ||
// action(); | ||
// }; | ||
// | ||
// _backgroundWorker.RunWorkerCompleted += (s, e) => | ||
// { | ||
// if (completed != null && e.Error == null) | ||
// completed(e.Result); | ||
// | ||
// if (error != null && e.Error != null) | ||
// error(e.Error); | ||
// | ||
// CommandManager.InvalidateRequerySuggested(); | ||
// }; | ||
// | ||
// _canExecute = canExecute; | ||
// } | ||
// | ||
// public void Cancel() | ||
// { | ||
// if (_backgroundWorker.IsBusy) | ||
// _backgroundWorker.CancelAsync(); | ||
// } | ||
// | ||
// public bool CanExecute(object parameter) | ||
// { | ||
// return _canExecute == null | ||
// ? !_backgroundWorker.IsBusy | ||
// : !_backgroundWorker.IsBusy && _canExecute(); | ||
// } | ||
// | ||
// public void Execute(object parameter) | ||
// { | ||
// _backgroundWorker.RunWorkerAsync(); | ||
// } | ||
// | ||
// public event EventHandler CanExecuteChanged | ||
// { | ||
// add { CommandManager.RequerySuggested += value; } | ||
// remove { CommandManager.RequerySuggested -= value; } | ||
// } | ||
// | ||
// public void Dispose() | ||
// { | ||
// Dispose(true); | ||
// GC.SuppressFinalize(this); | ||
// } | ||
// | ||
// protected virtual void Dispose(bool disposing) | ||
// { | ||
// if (disposing) | ||
// { | ||
// if (_backgroundWorker != null) | ||
// _backgroundWorker.Dispose(); | ||
// } | ||
// } | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Created by SharpDevelop. | ||
* User: C3rebro | ||
* Date: 15.11.2017 | ||
* Time: 21:54 | ||
* | ||
* Based on the article: Patterns for Asynchronous MVVM Applications: Commands | ||
* http://msdn.microsoft.com/en-us/magazine/dn630647.aspx | ||
*/ | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using System.Windows.Input; | ||
|
||
namespace RFiDGear.DataAccessLayer | ||
{ | ||
public abstract class AsyncCommandBase : IAsyncCommand | ||
{ | ||
public abstract bool CanExecute(object parameter); | ||
|
||
public abstract Task ExecuteAsync(object parameter); | ||
|
||
public async void Execute(object parameter) | ||
{ | ||
await ExecuteAsync(parameter); | ||
} | ||
|
||
public event EventHandler CanExecuteChanged | ||
{ | ||
add { CommandManager.RequerySuggested += value; } | ||
remove { CommandManager.RequerySuggested -= value; } | ||
} | ||
|
||
protected void RaiseCanExecuteChanged() | ||
{ | ||
CommandManager.InvalidateRequerySuggested(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using System.Threading.Tasks; | ||
using System.Windows.Input; | ||
|
||
public interface IAsyncCommand : ICommand | ||
{ | ||
Task ExecuteAsync(object parameter); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Created by SharpDevelop. | ||
* Date: 31.08.2017 | ||
* Time: 20:32 | ||
* | ||
*/ | ||
|
||
using System; | ||
using System.IO; | ||
|
||
namespace PluginSystem.DataAccessLayer | ||
{ | ||
/// <summary> | ||
/// Description of LogWriter. | ||
/// </summary> | ||
public static class LogWriter | ||
{ | ||
private static StreamWriter textStream; | ||
|
||
private static readonly string _logFileName = "log.txt"; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="entry"></param> | ||
public static void CreateLogEntry(string entry) | ||
{ | ||
string _logFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "RFiDGear", "log"); | ||
|
||
if (!Directory.Exists(_logFilePath)) | ||
Directory.CreateDirectory(_logFilePath); | ||
try | ||
{ | ||
if (!File.Exists(Path.Combine(_logFilePath, _logFileName))) | ||
textStream = File.CreateText(Path.Combine(_logFilePath, _logFileName)); | ||
else | ||
textStream = File.AppendText(Path.Combine(_logFilePath, _logFileName)); | ||
textStream.WriteAsync(string.Format("{0}" + Environment.NewLine, entry.Replace("\r\n", "; "))); | ||
textStream.Close(); | ||
textStream.Dispose(); | ||
} | ||
catch | ||
{ | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.