mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Sonar code smells corrections
This commit is contained in:
@@ -63,10 +63,10 @@ namespace ModernKeePass
|
|||||||
/// Invoked when the application is launched normally by the end user. Other entry points
|
/// Invoked when the application is launched normally by the end user. Other entry points
|
||||||
/// will be used such as when the application is launched to open a specific file.
|
/// will be used such as when the application is launched to open a specific file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="e">Details about the launch request and process.</param>
|
/// <param name="args">Details about the launch request and process.</param>
|
||||||
protected override async void OnLaunched(LaunchActivatedEventArgs e)
|
protected override async void OnLaunched(LaunchActivatedEventArgs args)
|
||||||
{
|
{
|
||||||
OnLaunchOrActivated(e);
|
OnLaunchOrActivated(args);
|
||||||
await HockeyClient.Current.SendCrashesAsync(/* sendWithoutAsking: true */);
|
await HockeyClient.Current.SendCrashesAsync(/* sendWithoutAsking: true */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ namespace ModernKeePass
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (System.Diagnostics.Debugger.IsAttached)
|
if (System.Diagnostics.Debugger.IsAttached)
|
||||||
{
|
{
|
||||||
//DebugSettings.EnableFrameRateCounter = true;
|
DebugSettings.EnableFrameRateCounter = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -109,9 +109,9 @@ namespace ModernKeePass
|
|||||||
Window.Current.Content = rootFrame;
|
Window.Current.Content = rootFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e is LaunchActivatedEventArgs)
|
var lauchActivatedEventArgs = e as LaunchActivatedEventArgs;
|
||||||
|
if (lauchActivatedEventArgs != null)
|
||||||
{
|
{
|
||||||
var lauchActivatedEventArgs = (LaunchActivatedEventArgs) e;
|
|
||||||
if (rootFrame.Content == null)
|
if (rootFrame.Content == null)
|
||||||
{
|
{
|
||||||
// When the navigation stack isn't restored navigate to the first page,
|
// When the navigation stack isn't restored navigate to the first page,
|
||||||
@@ -119,20 +119,8 @@ namespace ModernKeePass
|
|||||||
// parameter
|
// parameter
|
||||||
rootFrame.Navigate(typeof(MainPage), lauchActivatedEventArgs.Arguments);
|
rootFrame.Navigate(typeof(MainPage), lauchActivatedEventArgs.Arguments);
|
||||||
}
|
}
|
||||||
/*else
|
|
||||||
{
|
|
||||||
// App is "launched" via the Toast Activation event
|
|
||||||
UndoEntityDelete(lauchActivatedEventArgs.Arguments);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
// This is only available on Windows 10...
|
|
||||||
/*else if (e is ToastNotificationActivatedEventArgs)
|
|
||||||
{
|
|
||||||
var toastActivationArgs = e as ToastNotificationActivatedEventArgs;
|
|
||||||
|
|
||||||
// Parse the query string (using QueryString.NET)
|
|
||||||
UndoEntityDelete(QueryString.Parse(toastActivationArgs.Argument));
|
|
||||||
}*/
|
|
||||||
// Ensure the current window is active
|
// Ensure the current window is active
|
||||||
Window.Current.Activate();
|
Window.Current.Activate();
|
||||||
}
|
}
|
||||||
|
@@ -74,7 +74,7 @@ namespace ModernKeePass.Common
|
|||||||
// Create the message dialog and set its content
|
// Create the message dialog and set its content
|
||||||
var messageDialog = new MessageDialog(message, title);
|
var messageDialog = new MessageDialog(message, title);
|
||||||
|
|
||||||
// Add commands and set their callbacks;
|
// Add commands and set their callbacks
|
||||||
messageDialog.Commands.Add(new UICommand(dismissActionText, cancelCommand));
|
messageDialog.Commands.Add(new UICommand(dismissActionText, cancelCommand));
|
||||||
|
|
||||||
// Set the command that will be invoked by default
|
// Set the command that will be invoked by default
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Windows.Foundation.Collections;
|
using Windows.Foundation.Collections;
|
||||||
|
|
||||||
@@ -15,15 +14,15 @@ namespace ModernKeePass.Common
|
|||||||
{
|
{
|
||||||
public ObservableDictionaryChangedEventArgs(CollectionChange change, string key)
|
public ObservableDictionaryChangedEventArgs(CollectionChange change, string key)
|
||||||
{
|
{
|
||||||
this.CollectionChange = change;
|
CollectionChange = change;
|
||||||
this.Key = key;
|
Key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CollectionChange CollectionChange { get; private set; }
|
public CollectionChange CollectionChange { get; private set; }
|
||||||
public string Key { get; private set; }
|
public string Key { get; private set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<string, object> _dictionary = new Dictionary<string, object>();
|
private readonly Dictionary<string, object> _dictionary = new Dictionary<string, object>();
|
||||||
public event MapChangedEventHandler<string, object> MapChanged;
|
public event MapChangedEventHandler<string, object> MapChanged;
|
||||||
|
|
||||||
private void InvokeMapChanged(CollectionChange change, string key)
|
private void InvokeMapChanged(CollectionChange change, string key)
|
||||||
@@ -37,13 +36,13 @@ namespace ModernKeePass.Common
|
|||||||
|
|
||||||
public void Add(string key, object value)
|
public void Add(string key, object value)
|
||||||
{
|
{
|
||||||
this._dictionary.Add(key, value);
|
_dictionary.Add(key, value);
|
||||||
this.InvokeMapChanged(CollectionChange.ItemInserted, key);
|
InvokeMapChanged(CollectionChange.ItemInserted, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(KeyValuePair<string, object> item)
|
public void Add(KeyValuePair<string, object> item)
|
||||||
{
|
{
|
||||||
this.Add(item.Key, item.Value);
|
Add(item.Key, item.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRange(IEnumerable<KeyValuePair<string, object>> values)
|
public void AddRange(IEnumerable<KeyValuePair<string, object>> values)
|
||||||
@@ -56,9 +55,9 @@ namespace ModernKeePass.Common
|
|||||||
|
|
||||||
public bool Remove(string key)
|
public bool Remove(string key)
|
||||||
{
|
{
|
||||||
if (this._dictionary.Remove(key))
|
if (_dictionary.Remove(key))
|
||||||
{
|
{
|
||||||
this.InvokeMapChanged(CollectionChange.ItemRemoved, key);
|
InvokeMapChanged(CollectionChange.ItemRemoved, key);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -67,10 +66,10 @@ namespace ModernKeePass.Common
|
|||||||
public bool Remove(KeyValuePair<string, object> item)
|
public bool Remove(KeyValuePair<string, object> item)
|
||||||
{
|
{
|
||||||
object currentValue;
|
object currentValue;
|
||||||
if (this._dictionary.TryGetValue(item.Key, out currentValue) &&
|
if (_dictionary.TryGetValue(item.Key, out currentValue) &&
|
||||||
Object.Equals(item.Value, currentValue) && this._dictionary.Remove(item.Key))
|
Equals(item.Value, currentValue) && _dictionary.Remove(item.Key))
|
||||||
{
|
{
|
||||||
this.InvokeMapChanged(CollectionChange.ItemRemoved, item.Key);
|
InvokeMapChanged(CollectionChange.ItemRemoved, item.Key);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -80,53 +79,53 @@ namespace ModernKeePass.Common
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this._dictionary[key];
|
return _dictionary[key];
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
this._dictionary[key] = value;
|
_dictionary[key] = value;
|
||||||
this.InvokeMapChanged(CollectionChange.ItemChanged, key);
|
InvokeMapChanged(CollectionChange.ItemChanged, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
var priorKeys = this._dictionary.Keys.ToArray();
|
var priorKeys = _dictionary.Keys.ToArray();
|
||||||
this._dictionary.Clear();
|
_dictionary.Clear();
|
||||||
foreach (var key in priorKeys)
|
foreach (var key in priorKeys)
|
||||||
{
|
{
|
||||||
this.InvokeMapChanged(CollectionChange.ItemRemoved, key);
|
InvokeMapChanged(CollectionChange.ItemRemoved, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICollection<string> Keys
|
public ICollection<string> Keys
|
||||||
{
|
{
|
||||||
get { return this._dictionary.Keys; }
|
get { return _dictionary.Keys; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ContainsKey(string key)
|
public bool ContainsKey(string key)
|
||||||
{
|
{
|
||||||
return this._dictionary.ContainsKey(key);
|
return _dictionary.ContainsKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetValue(string key, out object value)
|
public bool TryGetValue(string key, out object value)
|
||||||
{
|
{
|
||||||
return this._dictionary.TryGetValue(key, out value);
|
return _dictionary.TryGetValue(key, out value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICollection<object> Values
|
public ICollection<object> Values
|
||||||
{
|
{
|
||||||
get { return this._dictionary.Values; }
|
get { return _dictionary.Values; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Contains(KeyValuePair<string, object> item)
|
public bool Contains(KeyValuePair<string, object> item)
|
||||||
{
|
{
|
||||||
return this._dictionary.Contains(item);
|
return _dictionary.Contains(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Count
|
public int Count
|
||||||
{
|
{
|
||||||
get { return this._dictionary.Count; }
|
get { return _dictionary.Count; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsReadOnly
|
public bool IsReadOnly
|
||||||
@@ -136,18 +135,18 @@ namespace ModernKeePass.Common
|
|||||||
|
|
||||||
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
|
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
|
||||||
{
|
{
|
||||||
return this._dictionary.GetEnumerator();
|
return _dictionary.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||||
{
|
{
|
||||||
return this._dictionary.GetEnumerator();
|
return _dictionary.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
|
public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
|
||||||
{
|
{
|
||||||
int arraySize = array.Length;
|
int arraySize = array.Length;
|
||||||
foreach (var pair in this._dictionary)
|
foreach (var pair in _dictionary)
|
||||||
{
|
{
|
||||||
if (arrayIndex >= arraySize) break;
|
if (arrayIndex >= arraySize) break;
|
||||||
array[arrayIndex++] = pair;
|
array[arrayIndex++] = pair;
|
||||||
|
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace ModernKeePass.Common
|
namespace ModernKeePass.Common
|
||||||
@@ -55,7 +51,7 @@ namespace ModernKeePass.Common
|
|||||||
/// <returns>true if this command can be executed; otherwise, false.</returns>
|
/// <returns>true if this command can be executed; otherwise, false.</returns>
|
||||||
public bool CanExecute(object parameter)
|
public bool CanExecute(object parameter)
|
||||||
{
|
{
|
||||||
return _canExecute == null ? true : _canExecute();
|
return _canExecute?.Invoke() ?? true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -1,11 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Windows.ApplicationModel;
|
|
||||||
using Windows.Storage;
|
using Windows.Storage;
|
||||||
using Windows.Storage.Streams;
|
using Windows.Storage.Streams;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
@@ -23,7 +20,7 @@ namespace ModernKeePass.Common
|
|||||||
internal sealed class SuspensionManager
|
internal sealed class SuspensionManager
|
||||||
{
|
{
|
||||||
private static Dictionary<string, object> _sessionState = new Dictionary<string, object>();
|
private static Dictionary<string, object> _sessionState = new Dictionary<string, object>();
|
||||||
private static List<Type> _knownTypes = new List<Type>();
|
private static readonly List<Type> _knownTypes = new List<Type>();
|
||||||
private const string sessionStateFilename = "_sessionState.xml";
|
private const string sessionStateFilename = "_sessionState.xml";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -33,20 +30,14 @@ namespace ModernKeePass.Common
|
|||||||
/// <see cref="DataContractSerializer"/> and should be as compact as possible. Strings
|
/// <see cref="DataContractSerializer"/> and should be as compact as possible. Strings
|
||||||
/// and other self-contained data types are strongly recommended.
|
/// and other self-contained data types are strongly recommended.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Dictionary<string, object> SessionState
|
public static Dictionary<string, object> SessionState => _sessionState;
|
||||||
{
|
|
||||||
get { return _sessionState; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of custom types provided to the <see cref="DataContractSerializer"/> when
|
/// List of custom types provided to the <see cref="DataContractSerializer"/> when
|
||||||
/// reading and writing session state. Initially empty, additional types may be
|
/// reading and writing session state. Initially empty, additional types may be
|
||||||
/// added to customize the serialization process.
|
/// added to customize the serialization process.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static List<Type> KnownTypes
|
public static List<Type> KnownTypes => _knownTypes;
|
||||||
{
|
|
||||||
get { return _knownTypes; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save the current <see cref="SessionState"/>. Any <see cref="Frame"/> instances
|
/// Save the current <see cref="SessionState"/>. Any <see cref="Frame"/> instances
|
||||||
|
@@ -8,20 +8,20 @@ namespace ModernKeePass.Converters
|
|||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, string language)
|
public object Convert(object value, Type targetType, object parameter, string language)
|
||||||
{
|
{
|
||||||
var boolean = value is bool ? (bool) value : false;
|
var boolean = value as bool? ?? false;
|
||||||
return boolean ? Visibility.Visible : Visibility.Collapsed;
|
return boolean ? Visibility.Visible : Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need to implement this
|
// No need to implement this
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||||
{
|
{
|
||||||
var visibility = value is Visibility ? (Visibility) value : Visibility.Visible;
|
var visibility = value as Visibility? ?? Visibility.Visible;
|
||||||
switch (visibility)
|
switch (visibility)
|
||||||
{
|
{
|
||||||
case Visibility.Visible: return true;
|
case Visibility.Visible: return true;
|
||||||
case Visibility.Collapsed: return false;
|
case Visibility.Collapsed: return false;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException(nameof(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,12 +40,9 @@ namespace ModernKeePass.Converters
|
|||||||
case PwIcon.Screen: return Symbol.GoToStart;
|
case PwIcon.Screen: return Symbol.GoToStart;
|
||||||
case PwIcon.EnergyCareful: return Symbol.FourBars;
|
case PwIcon.EnergyCareful: return Symbol.FourBars;
|
||||||
case PwIcon.Disk: return Symbol.Save;
|
case PwIcon.Disk: return Symbol.Save;
|
||||||
//case PwIcon.PaperQ: return Symbol.;
|
|
||||||
//case PwIcon.TerminalEncrypted: return Symbol.;
|
|
||||||
case PwIcon.Console: return Symbol.SlideShow;
|
case PwIcon.Console: return Symbol.SlideShow;
|
||||||
case PwIcon.Printer: return Symbol.Scan;
|
case PwIcon.Printer: return Symbol.Scan;
|
||||||
case PwIcon.ProgramIcons: return Symbol.GoToStart;
|
case PwIcon.ProgramIcons: return Symbol.GoToStart;
|
||||||
//case PwIcon.Run: return Symbol.;
|
|
||||||
case PwIcon.Settings:
|
case PwIcon.Settings:
|
||||||
case PwIcon.Tool: return Symbol.Repair;
|
case PwIcon.Tool: return Symbol.Repair;
|
||||||
case PwIcon.Archive: return Symbol.Crop;
|
case PwIcon.Archive: return Symbol.Crop;
|
||||||
@@ -53,15 +50,12 @@ namespace ModernKeePass.Converters
|
|||||||
case PwIcon.Clock: return Symbol.Clock;
|
case PwIcon.Clock: return Symbol.Clock;
|
||||||
case PwIcon.EMailSearch: return Symbol.Find;
|
case PwIcon.EMailSearch: return Symbol.Find;
|
||||||
case PwIcon.PaperFlag: return Symbol.Flag;
|
case PwIcon.PaperFlag: return Symbol.Flag;
|
||||||
//case PwIcon.Memory: return Symbol.;
|
|
||||||
case PwIcon.TrashBin: return Symbol.Delete;
|
case PwIcon.TrashBin: return Symbol.Delete;
|
||||||
case PwIcon.Expired: return Symbol.Cancel;
|
case PwIcon.Expired: return Symbol.Cancel;
|
||||||
case PwIcon.Info: return Symbol.Help;
|
case PwIcon.Info: return Symbol.Help;
|
||||||
//case PwIcon.Package: return Symbol.;
|
|
||||||
case PwIcon.Folder:
|
case PwIcon.Folder:
|
||||||
case PwIcon.FolderOpen:
|
case PwIcon.FolderOpen:
|
||||||
case PwIcon.FolderPackage: return Symbol.Folder;
|
case PwIcon.FolderPackage: return Symbol.Folder;
|
||||||
//case PwIcon.LockOpen: return Symbol.;
|
|
||||||
case PwIcon.PaperLocked: return Symbol.ProtectedDocument;
|
case PwIcon.PaperLocked: return Symbol.ProtectedDocument;
|
||||||
case PwIcon.Checked: return Symbol.Accept;
|
case PwIcon.Checked: return Symbol.Accept;
|
||||||
case PwIcon.Pen: return Symbol.Edit;
|
case PwIcon.Pen: return Symbol.Edit;
|
||||||
@@ -71,10 +65,6 @@ namespace ModernKeePass.Converters
|
|||||||
case PwIcon.UserKey: return Symbol.ContactPresence;
|
case PwIcon.UserKey: return Symbol.ContactPresence;
|
||||||
case PwIcon.Home: return Symbol.Home;
|
case PwIcon.Home: return Symbol.Home;
|
||||||
case PwIcon.Star: return Symbol.OutlineStar;
|
case PwIcon.Star: return Symbol.OutlineStar;
|
||||||
//case PwIcon.Tux: return Symbol.;
|
|
||||||
//case PwIcon.Feather: return Symbol.;
|
|
||||||
//case PwIcon.Apple: return Symbol.;
|
|
||||||
//case PwIcon.Wiki: return Symbol.;
|
|
||||||
case PwIcon.Money: return Symbol.Shop;
|
case PwIcon.Money: return Symbol.Shop;
|
||||||
case PwIcon.Certificate: return Symbol.PreviewLink;
|
case PwIcon.Certificate: return Symbol.PreviewLink;
|
||||||
case PwIcon.BlackBerry: return Symbol.CellPhone;
|
case PwIcon.BlackBerry: return Symbol.CellPhone;
|
||||||
@@ -87,392 +77,8 @@ namespace ModernKeePass.Converters
|
|||||||
var symbol = (Symbol) value;
|
var symbol = (Symbol) value;
|
||||||
switch (symbol)
|
switch (symbol)
|
||||||
{
|
{
|
||||||
/*case Symbol.Previous:
|
|
||||||
break;
|
|
||||||
case Symbol.Next:
|
|
||||||
break;
|
|
||||||
case Symbol.Play:
|
|
||||||
break;
|
|
||||||
case Symbol.Pause:
|
|
||||||
break;
|
|
||||||
case Symbol.Edit:
|
|
||||||
break;
|
|
||||||
case Symbol.Save:
|
|
||||||
break;
|
|
||||||
case Symbol.Clear:
|
|
||||||
break;*/
|
|
||||||
case Symbol.Delete:
|
case Symbol.Delete:
|
||||||
return PwIcon.TrashBin;
|
return PwIcon.TrashBin;
|
||||||
/*case Symbol.Remove:
|
|
||||||
break;
|
|
||||||
case Symbol.Add:
|
|
||||||
break;
|
|
||||||
case Symbol.Cancel:
|
|
||||||
break;
|
|
||||||
case Symbol.Accept:
|
|
||||||
break;
|
|
||||||
case Symbol.More:
|
|
||||||
break;
|
|
||||||
case Symbol.Redo:
|
|
||||||
break;
|
|
||||||
case Symbol.Undo:
|
|
||||||
break;
|
|
||||||
case Symbol.Home:
|
|
||||||
break;
|
|
||||||
case Symbol.Up:
|
|
||||||
break;
|
|
||||||
case Symbol.Forward:
|
|
||||||
break;
|
|
||||||
case Symbol.Back:
|
|
||||||
break;
|
|
||||||
case Symbol.Favorite:
|
|
||||||
break;
|
|
||||||
case Symbol.Camera:
|
|
||||||
break;
|
|
||||||
case Symbol.Setting:
|
|
||||||
break;
|
|
||||||
case Symbol.Video:
|
|
||||||
break;
|
|
||||||
case Symbol.Sync:
|
|
||||||
break;
|
|
||||||
case Symbol.Download:
|
|
||||||
break;
|
|
||||||
case Symbol.Mail:
|
|
||||||
break;
|
|
||||||
case Symbol.Find:
|
|
||||||
break;
|
|
||||||
case Symbol.Help:
|
|
||||||
break;
|
|
||||||
case Symbol.Upload:
|
|
||||||
break;
|
|
||||||
case Symbol.Emoji:
|
|
||||||
break;
|
|
||||||
case Symbol.TwoPage:
|
|
||||||
break;
|
|
||||||
case Symbol.LeaveChat:
|
|
||||||
break;
|
|
||||||
case Symbol.MailForward:
|
|
||||||
break;
|
|
||||||
case Symbol.Clock:
|
|
||||||
break;
|
|
||||||
case Symbol.Send:
|
|
||||||
break;
|
|
||||||
case Symbol.Crop:
|
|
||||||
break;
|
|
||||||
case Symbol.RotateCamera:
|
|
||||||
break;
|
|
||||||
case Symbol.People:
|
|
||||||
break;
|
|
||||||
case Symbol.OpenPane:
|
|
||||||
break;
|
|
||||||
case Symbol.ClosePane:
|
|
||||||
break;
|
|
||||||
case Symbol.World:
|
|
||||||
break;
|
|
||||||
case Symbol.Flag:
|
|
||||||
break;
|
|
||||||
case Symbol.PreviewLink:
|
|
||||||
break;
|
|
||||||
case Symbol.Globe:
|
|
||||||
break;
|
|
||||||
case Symbol.Trim:
|
|
||||||
break;
|
|
||||||
case Symbol.AttachCamera:
|
|
||||||
break;
|
|
||||||
case Symbol.ZoomIn:
|
|
||||||
break;
|
|
||||||
case Symbol.Bookmarks:
|
|
||||||
break;
|
|
||||||
case Symbol.Document:
|
|
||||||
break;
|
|
||||||
case Symbol.ProtectedDocument:
|
|
||||||
break;
|
|
||||||
case Symbol.Page:
|
|
||||||
break;
|
|
||||||
case Symbol.Bullets:
|
|
||||||
break;
|
|
||||||
case Symbol.Comment:
|
|
||||||
break;
|
|
||||||
case Symbol.MailFilled:
|
|
||||||
break;
|
|
||||||
case Symbol.ContactInfo:
|
|
||||||
break;
|
|
||||||
case Symbol.HangUp:
|
|
||||||
break;
|
|
||||||
case Symbol.ViewAll:
|
|
||||||
break;
|
|
||||||
case Symbol.MapPin:
|
|
||||||
break;
|
|
||||||
case Symbol.Phone:
|
|
||||||
break;
|
|
||||||
case Symbol.VideoChat:
|
|
||||||
break;
|
|
||||||
case Symbol.Switch:
|
|
||||||
break;
|
|
||||||
case Symbol.Contact:
|
|
||||||
break;
|
|
||||||
case Symbol.Rename:
|
|
||||||
break;
|
|
||||||
case Symbol.Pin:
|
|
||||||
break;
|
|
||||||
case Symbol.MusicInfo:
|
|
||||||
break;
|
|
||||||
case Symbol.Go:
|
|
||||||
break;
|
|
||||||
case Symbol.Keyboard:
|
|
||||||
break;
|
|
||||||
case Symbol.DockLeft:
|
|
||||||
break;
|
|
||||||
case Symbol.DockRight:
|
|
||||||
break;
|
|
||||||
case Symbol.DockBottom:
|
|
||||||
break;
|
|
||||||
case Symbol.Remote:
|
|
||||||
break;
|
|
||||||
case Symbol.Refresh:
|
|
||||||
break;
|
|
||||||
case Symbol.Rotate:
|
|
||||||
break;
|
|
||||||
case Symbol.Shuffle:
|
|
||||||
break;
|
|
||||||
case Symbol.List:
|
|
||||||
break;
|
|
||||||
case Symbol.Shop:
|
|
||||||
break;
|
|
||||||
case Symbol.SelectAll:
|
|
||||||
break;
|
|
||||||
case Symbol.Orientation:
|
|
||||||
break;
|
|
||||||
case Symbol.Import:
|
|
||||||
break;
|
|
||||||
case Symbol.ImportAll:
|
|
||||||
break;
|
|
||||||
case Symbol.BrowsePhotos:
|
|
||||||
break;
|
|
||||||
case Symbol.WebCam:
|
|
||||||
break;
|
|
||||||
case Symbol.Pictures:
|
|
||||||
break;
|
|
||||||
case Symbol.SaveLocal:
|
|
||||||
break;
|
|
||||||
case Symbol.Caption:
|
|
||||||
break;
|
|
||||||
case Symbol.Stop:
|
|
||||||
break;
|
|
||||||
case Symbol.ShowResults:
|
|
||||||
break;
|
|
||||||
case Symbol.Volume:
|
|
||||||
break;
|
|
||||||
case Symbol.Repair:
|
|
||||||
break;
|
|
||||||
case Symbol.Message:
|
|
||||||
break;
|
|
||||||
case Symbol.Page2:
|
|
||||||
break;
|
|
||||||
case Symbol.CalendarDay:
|
|
||||||
break;
|
|
||||||
case Symbol.CalendarWeek:
|
|
||||||
break;
|
|
||||||
case Symbol.Calendar:
|
|
||||||
break;
|
|
||||||
case Symbol.Character:
|
|
||||||
break;
|
|
||||||
case Symbol.MailReplyAll:
|
|
||||||
break;
|
|
||||||
case Symbol.Read:
|
|
||||||
break;
|
|
||||||
case Symbol.Link:
|
|
||||||
break;
|
|
||||||
case Symbol.Account:
|
|
||||||
break;
|
|
||||||
case Symbol.ShowBcc:
|
|
||||||
break;
|
|
||||||
case Symbol.HideBcc:
|
|
||||||
break;
|
|
||||||
case Symbol.Cut:
|
|
||||||
break;
|
|
||||||
case Symbol.Attach:
|
|
||||||
break;
|
|
||||||
case Symbol.Paste:
|
|
||||||
break;
|
|
||||||
case Symbol.Filter:
|
|
||||||
break;
|
|
||||||
case Symbol.Copy:
|
|
||||||
break;
|
|
||||||
case Symbol.Emoji2:
|
|
||||||
break;
|
|
||||||
case Symbol.Important:
|
|
||||||
break;
|
|
||||||
case Symbol.MailReply:
|
|
||||||
break;
|
|
||||||
case Symbol.SlideShow:
|
|
||||||
break;
|
|
||||||
case Symbol.Sort:
|
|
||||||
break;
|
|
||||||
case Symbol.Manage:
|
|
||||||
break;
|
|
||||||
case Symbol.AllApps:
|
|
||||||
break;
|
|
||||||
case Symbol.DisconnectDrive:
|
|
||||||
break;
|
|
||||||
case Symbol.MapDrive:
|
|
||||||
break;
|
|
||||||
case Symbol.NewWindow:
|
|
||||||
break;
|
|
||||||
case Symbol.OpenWith:
|
|
||||||
break;
|
|
||||||
case Symbol.ContactPresence:
|
|
||||||
break;
|
|
||||||
case Symbol.Priority:
|
|
||||||
break;
|
|
||||||
case Symbol.GoToToday:
|
|
||||||
break;
|
|
||||||
case Symbol.Font:
|
|
||||||
break;
|
|
||||||
case Symbol.FontColor:
|
|
||||||
break;
|
|
||||||
case Symbol.Contact2:
|
|
||||||
break;
|
|
||||||
case Symbol.Folder:
|
|
||||||
break;
|
|
||||||
case Symbol.Audio:
|
|
||||||
break;
|
|
||||||
case Symbol.Placeholder:
|
|
||||||
break;
|
|
||||||
case Symbol.View:
|
|
||||||
break;
|
|
||||||
case Symbol.SetLockScreen:
|
|
||||||
break;
|
|
||||||
case Symbol.SetTile:
|
|
||||||
break;
|
|
||||||
case Symbol.ClosedCaption:
|
|
||||||
break;
|
|
||||||
case Symbol.StopSlideShow:
|
|
||||||
break;
|
|
||||||
case Symbol.Permissions:
|
|
||||||
break;
|
|
||||||
case Symbol.Highlight:
|
|
||||||
break;
|
|
||||||
case Symbol.DisableUpdates:
|
|
||||||
break;
|
|
||||||
case Symbol.UnFavorite:
|
|
||||||
break;
|
|
||||||
case Symbol.UnPin:
|
|
||||||
break;
|
|
||||||
case Symbol.OpenLocal:
|
|
||||||
break;
|
|
||||||
case Symbol.Mute:
|
|
||||||
break;
|
|
||||||
case Symbol.Italic:
|
|
||||||
break;
|
|
||||||
case Symbol.Underline:
|
|
||||||
break;
|
|
||||||
case Symbol.Bold:
|
|
||||||
break;
|
|
||||||
case Symbol.MoveToFolder:
|
|
||||||
break;
|
|
||||||
case Symbol.LikeDislike:
|
|
||||||
break;
|
|
||||||
case Symbol.Dislike:
|
|
||||||
break;
|
|
||||||
case Symbol.Like:
|
|
||||||
break;
|
|
||||||
case Symbol.AlignRight:
|
|
||||||
break;
|
|
||||||
case Symbol.AlignCenter:
|
|
||||||
break;
|
|
||||||
case Symbol.AlignLeft:
|
|
||||||
break;
|
|
||||||
case Symbol.Zoom:
|
|
||||||
break;
|
|
||||||
case Symbol.ZoomOut:
|
|
||||||
break;
|
|
||||||
case Symbol.OpenFile:
|
|
||||||
break;
|
|
||||||
case Symbol.OtherUser:
|
|
||||||
break;
|
|
||||||
case Symbol.Admin:
|
|
||||||
break;
|
|
||||||
case Symbol.Street:
|
|
||||||
break;
|
|
||||||
case Symbol.Map:
|
|
||||||
break;
|
|
||||||
case Symbol.ClearSelection:
|
|
||||||
break;
|
|
||||||
case Symbol.FontDecrease:
|
|
||||||
break;
|
|
||||||
case Symbol.FontIncrease:
|
|
||||||
break;
|
|
||||||
case Symbol.FontSize:
|
|
||||||
break;
|
|
||||||
case Symbol.CellPhone:
|
|
||||||
break;
|
|
||||||
case Symbol.ReShare:
|
|
||||||
break;
|
|
||||||
case Symbol.Tag:
|
|
||||||
break;
|
|
||||||
case Symbol.RepeatOne:
|
|
||||||
break;
|
|
||||||
case Symbol.RepeatAll:
|
|
||||||
break;
|
|
||||||
case Symbol.OutlineStar:
|
|
||||||
break;
|
|
||||||
case Symbol.SolidStar:
|
|
||||||
break;
|
|
||||||
case Symbol.Calculator:
|
|
||||||
break;
|
|
||||||
case Symbol.Directions:
|
|
||||||
break;
|
|
||||||
case Symbol.Target:
|
|
||||||
break;
|
|
||||||
case Symbol.Library:
|
|
||||||
break;
|
|
||||||
case Symbol.PhoneBook:
|
|
||||||
break;
|
|
||||||
case Symbol.Memo:
|
|
||||||
break;
|
|
||||||
case Symbol.Microphone:
|
|
||||||
break;
|
|
||||||
case Symbol.PostUpdate:
|
|
||||||
break;
|
|
||||||
case Symbol.BackToWindow:
|
|
||||||
break;
|
|
||||||
case Symbol.FullScreen:
|
|
||||||
break;
|
|
||||||
case Symbol.NewFolder:
|
|
||||||
break;
|
|
||||||
case Symbol.CalendarReply:
|
|
||||||
break;
|
|
||||||
case Symbol.UnSyncFolder:
|
|
||||||
break;
|
|
||||||
case Symbol.ReportHacked:
|
|
||||||
break;
|
|
||||||
case Symbol.SyncFolder:
|
|
||||||
break;
|
|
||||||
case Symbol.BlockContact:
|
|
||||||
break;
|
|
||||||
case Symbol.SwitchApps:
|
|
||||||
break;
|
|
||||||
case Symbol.AddFriend:
|
|
||||||
break;
|
|
||||||
case Symbol.TouchPointer:
|
|
||||||
break;
|
|
||||||
case Symbol.GoToStart:
|
|
||||||
break;
|
|
||||||
case Symbol.ZeroBars:
|
|
||||||
break;
|
|
||||||
case Symbol.OneBar:
|
|
||||||
break;
|
|
||||||
case Symbol.TwoBars:
|
|
||||||
break;
|
|
||||||
case Symbol.ThreeBars:
|
|
||||||
break;
|
|
||||||
case Symbol.FourBars:
|
|
||||||
break;
|
|
||||||
case Symbol.Scan:
|
|
||||||
break;
|
|
||||||
case Symbol.Preview:
|
|
||||||
break;*/
|
|
||||||
default:
|
default:
|
||||||
return PwIcon.Folder;
|
return PwIcon.Folder;
|
||||||
}
|
}
|
||||||
|
@@ -8,20 +8,20 @@ namespace ModernKeePass.Converters
|
|||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, string language)
|
public object Convert(object value, Type targetType, object parameter, string language)
|
||||||
{
|
{
|
||||||
var boolean = value is bool ? (bool)value : false;
|
var boolean = value as bool? ?? false;
|
||||||
return boolean ? Visibility.Collapsed : Visibility.Visible;
|
return boolean ? Visibility.Collapsed : Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need to implement this
|
// No need to implement this
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||||
{
|
{
|
||||||
var visibility = value is Visibility ? (Visibility)value : Visibility.Visible;
|
var visibility = value as Visibility? ?? Visibility.Visible;
|
||||||
switch (visibility)
|
switch (visibility)
|
||||||
{
|
{
|
||||||
case Visibility.Visible: return false;
|
case Visibility.Visible: return false;
|
||||||
case Visibility.Collapsed: return true;
|
case Visibility.Collapsed: return true;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException(nameof(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,6 @@ namespace ModernKeePass.Interfaces
|
|||||||
{
|
{
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
bool RecycleBinEnabled { get; set; }
|
bool RecycleBinEnabled { get; set; }
|
||||||
//int Status { get; set; }
|
|
||||||
GroupVm RootGroup { get; set; }
|
GroupVm RootGroup { get; set; }
|
||||||
GroupVm RecycleBin { get; set; }
|
GroupVm RecycleBin { get; set; }
|
||||||
StorageFile DatabaseFile { get; set; }
|
StorageFile DatabaseFile { get; set; }
|
||||||
|
@@ -22,7 +22,6 @@ namespace ModernKeePass.Services
|
|||||||
private StorageFile _realDatabaseFile;
|
private StorageFile _realDatabaseFile;
|
||||||
private StorageFile _databaseFile;
|
private StorageFile _databaseFile;
|
||||||
private GroupVm _recycleBin;
|
private GroupVm _recycleBin;
|
||||||
private CompositeKey _compositeKey;
|
|
||||||
|
|
||||||
public GroupVm RootGroup { get; set; }
|
public GroupVm RootGroup { get; set; }
|
||||||
|
|
||||||
@@ -57,11 +56,7 @@ namespace ModernKeePass.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompositeKey CompositeKey
|
public CompositeKey CompositeKey { get; set; }
|
||||||
{
|
|
||||||
get { return _compositeKey; }
|
|
||||||
set { _compositeKey = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public PwUuid DataCipher
|
public PwUuid DataCipher
|
||||||
{
|
{
|
||||||
@@ -112,7 +107,7 @@ namespace ModernKeePass.Services
|
|||||||
throw new ArgumentNullException(nameof(key));
|
throw new ArgumentNullException(nameof(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
_compositeKey = key;
|
CompositeKey = key;
|
||||||
var ioConnection = IOConnectionInfo.FromFile(DatabaseFile);
|
var ioConnection = IOConnectionInfo.FromFile(DatabaseFile);
|
||||||
if (createNew)
|
if (createNew)
|
||||||
{
|
{
|
||||||
@@ -153,7 +148,7 @@ namespace ModernKeePass.Services
|
|||||||
|
|
||||||
public async Task ReOpen()
|
public async Task ReOpen()
|
||||||
{
|
{
|
||||||
await Open(_compositeKey);
|
await Open(CompositeKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -20,8 +20,7 @@ namespace ModernKeePass.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IReadOnlyDictionary<string, ProductListing> Products { get; }
|
public IReadOnlyDictionary<string, ProductListing> Products { get; }
|
||||||
|
|
||||||
//private LicenseInformation _licenseInformation;
|
|
||||||
private readonly HashSet<Guid> _consumedTransactionIds = new HashSet<Guid>();
|
private readonly HashSet<Guid> _consumedTransactionIds = new HashSet<Guid>();
|
||||||
|
|
||||||
public LicenseService()
|
public LicenseService()
|
||||||
@@ -51,7 +50,7 @@ namespace ModernKeePass.Services
|
|||||||
case ProductPurchaseStatus.AlreadyPurchased:
|
case ProductPurchaseStatus.AlreadyPurchased:
|
||||||
return (int) PurchaseResult.AlreadyPurchased;
|
return (int) PurchaseResult.AlreadyPurchased;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException(nameof(purchaseResults.Status));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,6 +4,8 @@ namespace ModernKeePass.Services
|
|||||||
{
|
{
|
||||||
public abstract class SingletonServiceBase<T> where T : new()
|
public abstract class SingletonServiceBase<T> where T : new()
|
||||||
{
|
{
|
||||||
|
protected SingletonServiceBase() { }
|
||||||
|
|
||||||
private static readonly Lazy<T> LazyInstance =
|
private static readonly Lazy<T> LazyInstance =
|
||||||
new Lazy<T>(() => new T());
|
new Lazy<T>(() => new T());
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml;
|
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
using Windows.UI.Xaml.Navigation;
|
using Windows.UI.Xaml.Navigation;
|
||||||
using ModernKeePass.Common;
|
using ModernKeePass.Common;
|
||||||
@@ -28,22 +27,8 @@ namespace ModernKeePass.Views
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
NavigationHelper = new NavigationHelper(this);
|
NavigationHelper = new NavigationHelper(this);
|
||||||
NavigationHelper.LoadState += navigationHelper_LoadState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Remplit la page à l'aide du contenu passé lors de la navigation. Tout état enregistré est également
|
|
||||||
/// fourni lorsqu'une page est recréée à partir d'une session antérieure.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender">
|
|
||||||
/// Source de l'événement ; en général <see cref="Common.NavigationHelper"/>
|
|
||||||
/// </param>
|
|
||||||
/// <param name="e">Données d'événement qui fournissent le paramètre de navigation transmis à
|
|
||||||
/// <see cref="Frame.Navigate(Type, object)"/> lors de la requête initiale de cette page et
|
|
||||||
/// un dictionnaire d'état conservé par cette page durant une session
|
|
||||||
/// antérieure. L'état n'aura pas la valeur Null lors de la première visite de la page.</param>
|
|
||||||
private void navigationHelper_LoadState(object sender, LoadStateEventArgs e) {}
|
|
||||||
|
|
||||||
#region Inscription de NavigationHelper
|
#region Inscription de NavigationHelper
|
||||||
|
|
||||||
/// Les méthodes fournies dans cette section sont utilisées simplement pour permettre
|
/// Les méthodes fournies dans cette section sont utilisées simplement pour permettre
|
||||||
|
@@ -31,22 +31,8 @@ namespace ModernKeePass.Views
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
NavigationHelper = new NavigationHelper(this);
|
NavigationHelper = new NavigationHelper(this);
|
||||||
NavigationHelper.LoadState += navigationHelper_LoadState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Populates the page with content passed during navigation. Any saved state is also
|
|
||||||
/// provided when recreating a page from a prior session.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender">
|
|
||||||
/// The source of the event; typically <see cref="Common.NavigationHelper"/>
|
|
||||||
/// </param>
|
|
||||||
/// <param name="e">Event data that provides both the navigation parameter passed to
|
|
||||||
/// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
|
|
||||||
/// a dictionary of state preserved by this page during an earlier
|
|
||||||
/// session. The state will be null the first time a page is visited.</param>
|
|
||||||
private void navigationHelper_LoadState(object sender, LoadStateEventArgs e) {}
|
|
||||||
|
|
||||||
#region NavigationHelper registration
|
#region NavigationHelper registration
|
||||||
|
|
||||||
/// The methods provided in this section are simply used to allow
|
/// The methods provided in this section are simply used to allow
|
||||||
@@ -62,10 +48,15 @@ namespace ModernKeePass.Views
|
|||||||
{
|
{
|
||||||
NavigationHelper.OnNavigatedTo(e);
|
NavigationHelper.OnNavigatedTo(e);
|
||||||
|
|
||||||
if (e.Parameter is PasswordEventArgs)
|
var args = e.Parameter as PasswordEventArgs;
|
||||||
DataContext = ((PasswordEventArgs) e.Parameter).RootGroup;
|
if (args != null)
|
||||||
else if (e.Parameter is GroupVm)
|
DataContext = args.RootGroup;
|
||||||
DataContext = (GroupVm) e.Parameter;
|
else
|
||||||
|
{
|
||||||
|
var vm = e.Parameter as GroupVm;
|
||||||
|
if (vm != null)
|
||||||
|
DataContext = vm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||||
@@ -134,7 +125,7 @@ namespace ModernKeePass.Views
|
|||||||
private void SemanticZoom_ViewChangeStarted(object sender, SemanticZoomViewChangedEventArgs e)
|
private void SemanticZoom_ViewChangeStarted(object sender, SemanticZoomViewChangedEventArgs e)
|
||||||
{
|
{
|
||||||
// We need to synchronize the two lists (zoomed-in and zoomed-out) because the source is different
|
// We need to synchronize the two lists (zoomed-in and zoomed-out) because the source is different
|
||||||
if (e.IsSourceZoomedInView == false)
|
if (!e.IsSourceZoomedInView)
|
||||||
{
|
{
|
||||||
e.DestinationItem.Item = e.SourceItem.Item;
|
e.DestinationItem.Item = e.SourceItem.Item;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user