Compare commits
No commits in common. "ce5806257c6572b6c745cf22f2da41dd4497ea00" and "509c0f21d77d3f8b80316b2f96b67861be86e80a" have entirely different histories.
ce5806257c
...
509c0f21d7
|
@ -26,7 +26,6 @@
|
||||||
<PackageReference Include="InputSimulator" Version="1.0.4" />
|
<PackageReference Include="InputSimulator" Version="1.0.4" />
|
||||||
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
|
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -60,14 +60,11 @@ namespace EscribePassword
|
||||||
}
|
}
|
||||||
else if (tipo == TiposEstadosPersistentes.Obsidean)
|
else if (tipo == TiposEstadosPersistentes.Obsidean)
|
||||||
{
|
{
|
||||||
// if (Passwords.Any(o => o.IsModified))
|
|
||||||
{
|
|
||||||
Obsidean obs = new Obsidean();
|
Obsidean obs = new Obsidean();
|
||||||
var tabla = EscribePassword.Passwords.ConvertPasswordsListToArray(Passwords);
|
var tabla = EscribePassword.Passwords.ConvertPasswordsListToArray(Passwords);
|
||||||
obs.EscribirPasswords(tabla);
|
obs.EscribirPasswords(tabla);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// Método estático para cargar el estado desde un archivo JSON
|
// Método estático para cargar el estado desde un archivo JSON
|
||||||
private static EstadoPersistente CargarEstado(TiposEstadosPersistentes tipo)
|
private static EstadoPersistente CargarEstado(TiposEstadosPersistentes tipo)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:EscribePassword" mc:Ignorable="d" Title="MainWindow"
|
xmlns:local="clr-namespace:EscribePassword" mc:Ignorable="d" Title="MainWindow" Height="450" Width="300"
|
||||||
AllowsTransparency="True" WindowStyle="None" MouseDown="Window_MouseDown" Topmost="True" Width="400" Height="500">
|
AllowsTransparency="True" WindowStyle="None" MouseDown="Window_MouseDown" Topmost="True">
|
||||||
<Window.DataContext>
|
<Window.DataContext>
|
||||||
<local:MView />
|
<local:MView />
|
||||||
</Window.DataContext>
|
</Window.DataContext>
|
||||||
|
@ -13,15 +13,13 @@
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<DataGrid Grid.Row="0" ItemsSource="{Binding Passwords}" SelectedItem="{Binding SelectedPassword}"
|
<DataGrid Grid.Row="0" ItemsSource="{Binding Passwords}" SelectedItem="{Binding SelectedPassword}"
|
||||||
AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" SelectionMode="Single"
|
AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" SelectionMode="Single">
|
||||||
MouseRightButtonUp="DataGrid_MouseRightButtonUp">
|
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="Categoria" Binding="{Binding Categoria}" Width="Auto" />
|
<DataGridTextColumn Header="Categoria" Binding="{Binding Categoria}" Width="Auto" />
|
||||||
<DataGridTextColumn Header="Usuario" Binding="{Binding Usuario}" Width="*" />
|
<DataGridTextColumn Header="Usuario" Binding="{Binding Usuario}" Width="*" />
|
||||||
<DataGridTextColumn Header="Contraseña" Binding="{Binding Password}" Width="*" />
|
<DataGridTextColumn Header="Contraseña" Binding="{Binding Password}" Width="*" />
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
||||||
<StackPanel Grid.Row="1" Orientation="Vertical">
|
<StackPanel Grid.Row="1" Orientation="Vertical">
|
||||||
<StackPanel Orientation="Horizontal" Margin="1,1,1,1" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" Margin="1,1,1,1" HorizontalAlignment="Center">
|
||||||
<ToolBarTray>
|
<ToolBarTray>
|
||||||
|
@ -32,7 +30,7 @@
|
||||||
<TextBlock Text="Agregar" />
|
<TextBlock Text="Agregar" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding UtilizarCommand}" ToolTip="Use - Se puede usar el boton central del mouse.">
|
<Button Command="{Binding UtilizarCommand}" ToolTip="Use">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Image Source="Icons/use.png" Width="24" Height="24" />
|
<Image Source="Icons/use.png" Width="24" Height="24" />
|
||||||
<TextBlock Text="Utilizar" />
|
<TextBlock Text="Utilizar" />
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Application = System.Windows.Application;
|
using Application = System.Windows.Application;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using MouseButton = System.Windows.Input.MouseButton;
|
using MouseButton = System.Windows.Input.MouseButton;
|
||||||
using Gma.System.MouseKeyHook;
|
using Gma.System.MouseKeyHook;
|
||||||
using MouseEventArgs = System.Windows.Forms.MouseEventArgs;
|
using MouseEventArgs = System.Windows.Forms.MouseEventArgs;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using Clipboard = System.Windows.Clipboard;
|
|
||||||
|
|
||||||
namespace EscribePassword
|
namespace EscribePassword
|
||||||
{
|
{
|
||||||
|
@ -29,40 +30,6 @@ namespace EscribePassword
|
||||||
HookManager();
|
HookManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataGrid_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
|
|
||||||
{
|
|
||||||
if (sender is DataGrid dataGrid && dataGrid.CurrentCell.Item is Passwords selectedPassword)
|
|
||||||
{
|
|
||||||
var cellContent = (dataGrid.CurrentCell.Column.GetCellContent(selectedPassword) as TextBlock)?.Text;
|
|
||||||
if (!string.IsNullOrEmpty(cellContent))
|
|
||||||
{
|
|
||||||
Clipboard.SetText(cellContent);
|
|
||||||
|
|
||||||
// Mostrar notificación de que el valor fue copiado
|
|
||||||
ShowNotification("Valor copiado al portapapeles.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ShowNotification(string message)
|
|
||||||
{
|
|
||||||
NotifyIcon notifyIcon = new NotifyIcon();
|
|
||||||
notifyIcon.Visible = true;
|
|
||||||
notifyIcon.Icon = SystemIcons.Information;
|
|
||||||
notifyIcon.BalloonTipTitle = "Notificación";
|
|
||||||
notifyIcon.BalloonTipText = message;
|
|
||||||
notifyIcon.ShowBalloonTip(2000);
|
|
||||||
|
|
||||||
// Ocultar el icono después de 2 segundos
|
|
||||||
var timer = new System.Timers.Timer(2000);
|
|
||||||
timer.Elapsed += (s, e) =>
|
|
||||||
{
|
|
||||||
notifyIcon.Dispose();
|
|
||||||
timer.Dispose();
|
|
||||||
};
|
|
||||||
timer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
((App)Application.Current).SetInitialWindowPosition();
|
((App)Application.Current).SetInitialWindowPosition();
|
||||||
|
@ -140,25 +107,19 @@ namespace EscribePassword
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private Passwords selectedPassword;
|
private Passwords selectedPassword;
|
||||||
|
|
||||||
Stopwatch timeSteps = new Stopwatch();
|
|
||||||
|
|
||||||
public void OnWheel(object sender, MouseWheelEventArgs e)
|
public void OnWheel(object sender, MouseWheelEventArgs e)
|
||||||
{
|
{
|
||||||
if (Passwords.Count == 0) return;
|
if (Passwords.Count == 0) return;
|
||||||
|
|
||||||
if (timeSteps.ElapsedMilliseconds > 200)
|
|
||||||
{
|
|
||||||
var index = Passwords.IndexOf(SelectedPassword);
|
var index = Passwords.IndexOf(SelectedPassword);
|
||||||
var max = Passwords.Count;
|
var max = Passwords.Count;
|
||||||
if (e.Delta < 0)
|
if (e.Delta > 0)
|
||||||
index++;
|
index++;
|
||||||
else if (e.Delta > 0) index--;
|
else index--;
|
||||||
if (index < 0) index = max-1;
|
if (index < 0) index = max-1;
|
||||||
if (index >= max) index = 0;
|
if (index >= max) index = 0;
|
||||||
|
|
||||||
SelectedPassword = Passwords[index];
|
SelectedPassword = Passwords[index];
|
||||||
timeSteps.Restart();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnSelectedPasswordChanged(Passwords value)
|
partial void OnSelectedPasswordChanged(Passwords value)
|
||||||
|
@ -175,8 +136,6 @@ namespace EscribePassword
|
||||||
top_passwords = new ObservableCollection<Passwords>();
|
top_passwords = new ObservableCollection<Passwords>();
|
||||||
passwords = new ObservableCollection<Passwords>(EstadoPersistente.Instance.Passwords);
|
passwords = new ObservableCollection<Passwords>(EstadoPersistente.Instance.Passwords);
|
||||||
SelectedPassword = passwords.FirstOrDefault();
|
SelectedPassword = passwords.FirstOrDefault();
|
||||||
|
|
||||||
timeSteps.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnApplicationExit(object sender, ExitEventArgs e)
|
private void OnApplicationExit(object sender, ExitEventArgs e)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace EscribePassword
|
namespace EscribePassword
|
||||||
{
|
{
|
||||||
|
@ -14,7 +13,6 @@ namespace EscribePassword
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private string categoria;
|
private string categoria;
|
||||||
|
|
||||||
|
|
||||||
public static List<Passwords> ConvertArrayToPasswordsList(string[,] tableArray)
|
public static List<Passwords> ConvertArrayToPasswordsList(string[,] tableArray)
|
||||||
{
|
{
|
||||||
var passwordsList = new List<Passwords>();
|
var passwordsList = new List<Passwords>();
|
||||||
|
@ -53,9 +51,9 @@ namespace EscribePassword
|
||||||
// Fill data
|
// Fill data
|
||||||
for (int i = 0; i < rows; i++)
|
for (int i = 0; i < rows; i++)
|
||||||
{
|
{
|
||||||
tableArray[i + 1, 0] = passwordsList[i].Categoria;
|
tableArray[i + 1, 0] = passwordsList[i].Usuario;
|
||||||
tableArray[i + 1, 1] = passwordsList[i].Usuario;
|
tableArray[i + 1, 1] = passwordsList[i].Password;
|
||||||
tableArray[i + 1, 2] = passwordsList[i].Password;
|
tableArray[i + 1, 2] = passwordsList[i].Categoria;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tableArray;
|
return tableArray;
|
||||||
|
|
Loading…
Reference in New Issue