|
|
@ -197,13 +197,13 @@ namespace v2rayN.Views
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (action == "AdjustMainLvColWidth")
|
|
|
|
if (action == "AdjustMainLvColWidth")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Application.Current.Dispatcher.Invoke((Action)(() =>
|
|
|
|
Application.Current.Dispatcher.Invoke(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach (var it in lstProfiles.Columns)
|
|
|
|
foreach (var it in lstProfiles.Columns)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.Width = new DataGridLength(1, DataGridLengthUnitType.Auto);
|
|
|
|
it.Width = new DataGridLength(1, DataGridLengthUnitType.Auto);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (action == "ProfilesFocus")
|
|
|
|
else if (action == "ProfilesFocus")
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -355,7 +355,7 @@ namespace v2rayN.Views
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (e.Key == Key.Enter || e.Key == Key.Return)
|
|
|
|
if (e.Key is Key.Enter or Key.Return)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ViewModel?.SetDefaultServer();
|
|
|
|
ViewModel?.SetDefaultServer();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -471,9 +471,8 @@ namespace v2rayN.Views
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void MenuItem_Click(object sender, RoutedEventArgs e)
|
|
|
|
private void MenuItem_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (sender is MenuItem)
|
|
|
|
if (sender is MenuItem item)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MenuItem item = (MenuItem)sender;
|
|
|
|
|
|
|
|
Utils.ProcessStart(item.Tag.ToString());
|
|
|
|
Utils.ProcessStart(item.Tag.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -482,7 +481,7 @@ namespace v2rayN.Views
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Drag and Drop
|
|
|
|
#region Drag and Drop
|
|
|
|
|
|
|
|
|
|
|
|
private Point startPoint = new Point();
|
|
|
|
private Point startPoint = new();
|
|
|
|
private int startIndex = -1;
|
|
|
|
private int startIndex = -1;
|
|
|
|
private string formatData = "ProfileItemModel";
|
|
|
|
private string formatData = "ProfileItemModel";
|
|
|
|
|
|
|
|
|
|
|
@ -523,8 +522,7 @@ namespace v2rayN.Views
|
|
|
|
Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance))
|
|
|
|
Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Get the dragged Item
|
|
|
|
// Get the dragged Item
|
|
|
|
var listView = sender as DataGrid;
|
|
|
|
if (sender is not DataGrid listView) return;
|
|
|
|
if (listView == null) return;
|
|
|
|
|
|
|
|
var listViewItem = FindAnchestor<DataGridRow>((DependencyObject)e.OriginalSource);
|
|
|
|
var listViewItem = FindAnchestor<DataGridRow>((DependencyObject)e.OriginalSource);
|
|
|
|
if (listViewItem == null) return; // Abort
|
|
|
|
if (listViewItem == null) return; // Abort
|
|
|
|
// Find the data behind the ListViewItem
|
|
|
|
// Find the data behind the ListViewItem
|
|
|
@ -532,7 +530,7 @@ namespace v2rayN.Views
|
|
|
|
if (item == null) return; // Abort
|
|
|
|
if (item == null) return; // Abort
|
|
|
|
// Initialize the drag & drop operation
|
|
|
|
// Initialize the drag & drop operation
|
|
|
|
startIndex = lstProfiles.SelectedIndex;
|
|
|
|
startIndex = lstProfiles.SelectedIndex;
|
|
|
|
DataObject dragData = new DataObject(formatData, item);
|
|
|
|
DataObject dragData = new(formatData, item);
|
|
|
|
DragDrop.DoDragDrop(listViewItem, dragData, DragDropEffects.Copy | DragDropEffects.Move);
|
|
|
|
DragDrop.DoDragDrop(listViewItem, dragData, DragDropEffects.Copy | DragDropEffects.Move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -550,8 +548,7 @@ namespace v2rayN.Views
|
|
|
|
if (e.Data.GetDataPresent(formatData) && sender == e.Source)
|
|
|
|
if (e.Data.GetDataPresent(formatData) && sender == e.Source)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Get the drop Item destination
|
|
|
|
// Get the drop Item destination
|
|
|
|
var listView = sender as DataGrid;
|
|
|
|
if (sender is not DataGrid listView) return;
|
|
|
|
if (listView == null) return;
|
|
|
|
|
|
|
|
var listViewItem = FindAnchestor<DataGridRow>((DependencyObject)e.OriginalSource);
|
|
|
|
var listViewItem = FindAnchestor<DataGridRow>((DependencyObject)e.OriginalSource);
|
|
|
|
if (listViewItem == null)
|
|
|
|
if (listViewItem == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|