-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
270 additions
and
10 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
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,41 @@ | ||
<controls:MetroWindow x:Class="vpm.ChooseDir" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf" | ||
xmlns:local="clr-namespace:vpm" | ||
mc:Ignorable="d" Height="96" Width="399" | ||
BorderThickness="0" | ||
GlowBrush="Black" | ||
ResizeMode="CanResizeWithGrip" | ||
Initialized="ChooseDir_OnInitialized_OnInitialized" | ||
Background="#FF2C2C2C" | ||
NonActiveWindowTitleBrush="#FF2C2C2C" | ||
OverrideDefaultWindowCommandsBrush="White" | ||
TitleForeground="White" | ||
WindowTitleBrush="#FF2C2C2C" | ||
Foreground="White" | ||
WindowStyle="ToolWindow" Closed="OnCancelled"> | ||
<controls:MetroWindow.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! --> | ||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" /> | ||
<!-- Accent and AppTheme setting --> | ||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</controls:MetroWindow.Resources> | ||
<Grid> | ||
<TextBox x:Name="DirBox" Height="23" TextWrapping="Wrap" Text="TextBox" Margin="0,0,28,0" VerticalAlignment="Top" TabIndex="0" Drop="OnDirDrop"/> | ||
<Button x:Name="PickButton" Content="..." HorizontalAlignment="Right" Width="28" Height="26" VerticalAlignment="Top" Click="OnBrowseDir"/> | ||
<Button x:Name="OkButton" Content="OK" Margin="0,26,0,0" IsDefault="True" TabIndex="1" Click="OnConfirm"/> | ||
|
||
</Grid> | ||
</controls:MetroWindow> |
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,83 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
using MahApps.Metro.Controls; | ||
using Microsoft.WindowsAPICodePack.Dialogs; | ||
using Path = System.IO.Path; | ||
|
||
namespace vpm | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ChooseDir.xaml | ||
/// </summary> | ||
public partial class ChooseDir | ||
{ | ||
public string PathFromVpm { get; set; } | ||
public string PathResult { get; set; } | ||
public bool Cancelled { get; set; } | ||
|
||
public ChooseDir(string pathin) | ||
{ | ||
PathFromVpm = pathin; | ||
InitializeComponent(); | ||
} | ||
|
||
private void ChooseDir_OnInitialized_OnInitialized(object sender, EventArgs e) | ||
{ | ||
DirBox.Text = PathFromVpm; | ||
} | ||
|
||
private void OnDirDrop(object sender, DragEventArgs e) | ||
{ | ||
if (e.Data.GetDataPresent(DataFormats.FileDrop)) | ||
{ | ||
var files = (string[])e.Data.GetData(DataFormats.FileDrop); | ||
if (files != null) | ||
{ | ||
DirBox.Text = files[0]; | ||
} | ||
} | ||
} | ||
|
||
private void OnBrowseDir(object sender, RoutedEventArgs e) | ||
{ | ||
var dialog = new CommonOpenFileDialog | ||
{ | ||
IsFolderPicker = true, | ||
Multiselect = false | ||
}; | ||
var result = dialog.ShowDialog(); | ||
if (result == CommonFileDialogResult.Ok) | ||
{ | ||
DirBox.Text = dialog.FileName; | ||
} | ||
} | ||
|
||
private void OnConfirm(object sender, RoutedEventArgs e) | ||
{ | ||
Cancelled = false; | ||
PathResult = DirBox.Text; | ||
VpmConfig.Instance.WaitSignal = false; | ||
VpmConfig.Instance.DirWindow.Close(); | ||
} | ||
|
||
private void OnCancelled(object sender, EventArgs e) | ||
{ | ||
Cancelled = true; | ||
VpmConfig.Instance.WaitSignal = false; | ||
VpmConfig.Instance.DirWindow.Close(); | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.